Page 1 of 1 1
Topic Options
#175250 - 2007-04-05 08:31 PM GLOBAL Variables not carrying through second KiXtart session
Turkey77 Offline
Fresh Scripter

Registered: 2007-04-05
Posts: 6
Loc: Pennsylvania
Hello,

First of all, I would like to thank you in advance for any help or ideas you may have for me. Criticism is welcome too! If you are wondering why in the world I am even trying to do it this way, please tell me. THANKS! \:D

Using KiXtart 2010 4.51

My goal is to have all my servers defined as GLOBALS to save from editing server names across many scripts when the server name changes. I defined my GLOBALS:
 Code:
;filename servers.kix
GLOBAL $Carlisle, $NYC, $Boston, $BLoomfield
$Carlisle = Gettysburg
$NYC = Manhattan
$Boston = Capecod
$Bloomfield = Pinelands
RETURN


The server names are carried through all the scripts until I try to start a second KiXtart session in the existing session.

Script A needs to run as the user logging on.
Script B needs to run as an administrator.

 Code:
;filename - Script-A.kix
CALL servers.kix
;the value of Carlisle is written to the log file as expected
Open (1, "c:\kix\test.log", 5)
	writeline (1, "value of Carlisle = " + $carlisle + Chr(13) + Chr(10) )
Close (1)  
;high-kix.exe is a file that runs kix32.exe as an administrator
Shell @LDRIVE + "\high-kix.exe Script-B.kix"



 Code:
;filename - Script-B.kix
;CALL servers.kix ; I tried CALLing servers.kix here, but no luck
;$Boston = Capecod ;the value of boston is not written to the log unless I define the variable in script B
Open (1, "c:\kix\test.log", 5)
	writeline (1, "value of BOSTON = " + $boston + Chr(13) + Chr(10) )
Close (1)  
RETURN


Thanks for taking a look!

Turkey77

Top
#175251 - 2007-04-05 08:58 PM Re: GLOBAL Variables not carrying through second KiXtart session [Re: Turkey77]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
Hi and welcome to the board.

Looks like this is by design. Global variables are available in the master script and all sub scripts in the same kix session but not in a second kix session. You need to Dim the variables again.

 Quote:

GLOBAL

Action
Declare one or more global variables.

Syntax
GLOBAL "variable1" [<,>"variablex"]

Remarks
Global variables are visible everywhere in every script during the current KiXtart session.

Examples
GLOBAL $X
GLOBAL $X, $Y, $Z


Edited by Mart (2007-04-05 08:59 PM)
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#175252 - 2007-04-05 09:37 PM Re: GLOBAL Variables not carrying through second KiXtart session [Re: Turkey77]
Turkey77 Offline
Fresh Scripter

Registered: 2007-04-05
Posts: 6
Loc: Pennsylvania
Thanks for the welcome and reply!

The part the stumps me is I can CALL servers.kix from the main script-A and the GLOBALS are happy. If I CALL servers.kix from script-B, no luck. Could there be a better way to run a second session as administrator and also CALL servers.kix? Of course, assigning the variables in script-B works, but doesn't keep my server names in one file.

Thanks,
Turkey77

Top
#175253 - 2007-04-05 11:09 PM Re: GLOBAL Variables not carrying through second KiXtart session [Re: Turkey77]
Allen Administrator Online   shocked
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4562
Loc: USA
Put some error checking in your code and see if its something simple...

For example
 Code:
;CALL servers.kix ; I tried CALLing servers.kix here, but no luck
? "" + @serror + " - " + @serror

Top
#175254 - 2007-04-05 11:25 PM Re: GLOBAL Variables not carrying through second KiXtart session [Re: Turkey77]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4401
Loc: New Jersey
When you Shell, you are stating a new kix session, with a fresh environment. There's no way for it to inherit global vars, however...

You can pass args on the Kix comamnd line, and they are automatically Globals.
 Code:
$ = SetOption('WrapAtEOL', 'On')

$Dollar = Chr(36)        ; contains "$"

Call "Servers.kix"       ; vars are defined here
'NYC=' $NYC ?            ; proof of var content.. debugging!
Call "AnotherScript.kix" ; will have Servers info - have it print vars

$Cmd = 'High-Kix.exe script-b.kix'
$Cmd = $Cmd + ' ' + $Dollar + 'Carlisle=' + $Carlisle 
$Cmd = $Cmd + ' ' + $Dollar + 'NYC=' + $NYC
$Cmd = $Cmd + ' ' + $Dollar + 'Boston=' + $Boston
$Cmd = $Cmd + ' ' + $Dollar + 'Bloomfield=' + $Bloomfield

'Cmd is: ' $Cmd ? ; just for debugging...

Shell $Cmd

This will pass the global vars to the next kix on the command line.

Of course, if the first script does not modify these values, you should just load the Servers.Kix in Script-b!

Also - ditch the RETURN - you're not using GOSUB! Use "Exit 0" instead.

Glenn

PS - this is untested example, but the concept definitely works. ;\)
_________________________
Actually I am a Rocket Scientist! \:D

Top
#175307 - 2007-04-10 12:33 PM Re: GLOBAL Variables not carrying through second KiXtart session [Re: Turkey77]
Arend_ Moderator Offline
MM club member
*****

Registered: 2005-01-17
Posts: 1896
Loc: Hilversum, The Netherlands
 Originally Posted By: Turkey77

 Code:
;filename servers.kix
GLOBAL $Carlisle, $NYC, $Boston, $BLoomfield
$Carlisle = Gettysburg
$NYC = Manhattan
$Boston = Capecod
$Bloomfield = Pinelands
RETURN



It's the little things that count. Your code should be:
 Code:
;filename servers.kix
GLOBAL $Carlisle, $NYC, $Boston, $Bloomfield
$Carlisle = "Gettysburg"
$NYC = "Manhattan"
$Boston = "Capecod"
$Bloomfield = "Pinelands"

Top
#175358 - 2007-04-12 01:47 PM Re: GLOBAL Variables not carrying through second KiXtart session [Re: Arend_]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4401
Loc: New Jersey
Agree that it is "best practice" to wrap strings in quotes at all times, but "technically" it would not affect his outcome. Since his string has no spaces in it, Kix will happily assign it correctly to the variable as Turkey77 has written it. Not good coding practice, but not an error, either. (this is a nasty golfing trick \:o )

The RETURN, however, could make all kinds of mess, as it would try to pop a return address off the stack where none existed. I would expect it to generate a "Return without gosub" error, although I find in simple testing that code beyond the Return is not processed.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#175367 - 2007-04-12 05:38 PM Re: GLOBAL Variables not carrying through second KiXtart session [Re: Glenn Barnas]
Arend_ Moderator Offline
MM club member
*****

Registered: 2005-01-17
Posts: 1896
Loc: Hilversum, The Netherlands
Hence why I left RETURN out, it doesn't do anything.
Top
#175383 - 2007-04-12 09:51 PM Re: GLOBAL Variables not carrying through second KiXtart session [Re: Arend_]
Turkey77 Offline
Fresh Scripter

Registered: 2007-04-05
Posts: 6
Loc: Pennsylvania
SOLUTION:

Need to define the GLOBALS from the command line as Glenn suggested when starting the second kix session to pass them through to the next script. Now, when I replace a server, all I have to do is edit servers.kix! SWEET! \:D

This has been tested and I am including all 4 kix files and the output as proof!

From the command line I keyed in "kix32.exe test.kix" to achieve test.log.

 Code:
;servers.kix
Global $Atlanta, $Baltimore, $BLoomfield, $Boston, $Carlisle, $Charlotte,
 $Chicago, $Culpeper, $Dallas, $Danville, $Fairfax, $Frederick, 
$Fredericksburg, $Gaithersburg, $Lanham, $Leesburg, $Manassas, $MtLaurel, 
$Naperville, $NewHaven, $NewOrleans, $NYC, $Parsippany, $Peoria, $Phoenix, 
$Raleigh, $Ranson, $Richmond, $Rochester, $Tampa, $Tulsa, $Waldorf, 
$Winchester, $WinchesterPARR

$Atlanta = "Caneriver"
$Baltimore = "Arctic"
$Bloomfield = "Liberty"
$Boston = "Capecod"
$Carlisle = "Gettysburg"
$Charlotte = "Fireisland"
$Chicago = "Wrangell"
$Culpeper = "Greatfalls"
$Dallas = "Pecos"
$Danville = "Shenandoah"
$Fairfax = "Saratoga"
$Frederick = "Acadia"
$Fredericksburg = "Aztec"
$Gaithersburg = "Amistad"
$Lanham = "Tenton"
$Leesburg = "Mesaverde"
$Manassas = "Battlefield"
$MtLaurel = "Wharton"
$Naperville = "Glacier"
$NewHaven = "Aleutian"
$NewOrleans = "Katrina"
$NYC = "Manhattan"
$Parsippany = "Sandyhook"
$Peoria = "Rocky"
$Phoenix = "Hoover"
$Raleigh = "Catoctin"
$Ranson = "Carlsbad"
$Richmond = "Echo"
$Rochester = "Ontario"
$Tampa = "Windcave"
$Tulsa = "Sitka"
$Waldorf = "RockCreek"
$Winchester = "Whitesands"
$WinchesterPARR = "Yorktown"
EXIT 0

 Code:
;test.kix

$Dollar = Chr(36)        ; contains "$"

Call "Servers.kix"       ; vars are defined here

Call "test2.kix" ; verifies the GLOBALS carry to next script in current session because they are written to the log

;high-kix.exe = kix32.exe ran as administrator named BONA
; @LDRIVE = \\server\netlogon\

$Cmd = '@LDRIVEhigh-kix.exe test3.kix'
$Cmd = $Cmd + ' ' + $Dollar + 'Atlanta=' + $Atlanta
$Cmd = $Cmd + ' ' + $Dollar + 'Baltimore=' + $Baltimore
$Cmd = $Cmd + ' ' + $Dollar + 'Bloomfield=' + $Bloomfield
$Cmd = $Cmd + ' ' + $Dollar + 'Boston=' + $Boston
$Cmd = $Cmd + ' ' + $Dollar + 'Carlisle=' + $Carlisle
$Cmd = $Cmd + ' ' + $Dollar + 'Charlotte=' + $Charlotte
$Cmd = $Cmd + ' ' + $Dollar + 'Chicago=' + $Chicago
$Cmd = $Cmd + ' ' + $Dollar + 'Culpeper=' + $Culpeper
$Cmd = $Cmd + ' ' + $Dollar + 'Dallas=' + $Dallas
$Cmd = $Cmd + ' ' + $Dollar + 'Danville=' + $Danville
$Cmd = $Cmd + ' ' + $Dollar + 'Fairfax=' + $Fairfax
$Cmd = $Cmd + ' ' + $Dollar + 'Frederick=' + $Frederick
$Cmd = $Cmd + ' ' + $Dollar + 'Fredericksburg=' + $Fredericksburg
$Cmd = $Cmd + ' ' + $Dollar + 'Gaithersburg=' + $Gaithersburg
$Cmd = $Cmd + ' ' + $Dollar + 'Lanham=' + $Lanham
$Cmd = $Cmd + ' ' + $Dollar + 'Leesburg=' + $Leesburg
$Cmd = $Cmd + ' ' + $Dollar + 'Manassas=' + $Manassas
$Cmd = $Cmd + ' ' + $Dollar + 'MtLaurel=' + $MtLaurel
$Cmd = $Cmd + ' ' + $Dollar + 'Naperville=' + $Naperville
$Cmd = $Cmd + ' ' + $Dollar + 'NewHaven=' + $NewHaven
$Cmd = $Cmd + ' ' + $Dollar + 'NewOrleans=' + $NewOrleans
$Cmd = $Cmd + ' ' + $Dollar + 'NYC=' + $NYC
$Cmd = $Cmd + ' ' + $Dollar + 'Parsippany=' + $Parsippany
$Cmd = $Cmd + ' ' + $Dollar + 'Peoria=' + $Peoria
$Cmd = $Cmd + ' ' + $Dollar + 'Phoenix=' + $Phoenix
$Cmd = $Cmd + ' ' + $Dollar + 'Raleigh=' + $Raleigh
$Cmd = $Cmd + ' ' + $Dollar + 'Ranson=' + $Ranson
$Cmd = $Cmd + ' ' + $Dollar + 'Richmond=' + $Richmond
$Cmd = $Cmd + ' ' + $Dollar + 'Rochester=' + $Rochester
$Cmd = $Cmd + ' ' + $Dollar + 'Tampa=' + $Tampa
$Cmd = $Cmd + ' ' + $Dollar + 'Tulsa=' + $Tulsa
$Cmd = $Cmd + ' ' + $Dollar + 'Waldorf=' + $Waldorf
$Cmd = $Cmd + ' ' + $Dollar + 'Winchester=' + $Winchester
$Cmd = $Cmd + ' ' + $Dollar + 'WinchesterPARR=' + $WinchesterPARR
Shell $Cmd

 Code:
;test2.kix
Open (1, "c:\kix\test.log", 5)
	writeline (1, "test2.kix Atlanta        = " + $Atlanta + " accessed by = "+@userid + Chr(13) + Chr(10) )
	writeline (1, "test2.kix Baltimore      = " + $Baltimore + " accessed by = "+@userid + Chr(13) + Chr(10) )
	writeline (1, "test2.kix Bloomfield     = " + $Bloomfield + " accessed by = "+@userid + Chr(13) + Chr(10) )
	writeline (1, "test2.kix Boston         = " + $Boston + " accessed by = "+@userid + Chr(13) + Chr(10) )
	writeline (1, "test2.kix Carlisle       = " + $Carlisle + " accessed by = "+@userid + Chr(13) + Chr(10) )
	writeline (1, "test2.kix Charlotte      = " + $Charlotte + " accessed by = "+@userid + Chr(13) + Chr(10) )
	writeline (1, "test2.kix Chicago        = " + $Chicago + " accessed by = "+@userid + Chr(13) + Chr(10) )
	writeline (1, "test2.kix Culpeper       = " + $Culpeper + " accessed by = "+@userid + Chr(13) + Chr(10) )
	writeline (1, "test2.kix Dallas         = " + $Dallas + " accessed by = "+@userid + Chr(13) + Chr(10) )
	writeline (1, "test2.kix Danville       = " + $Danville + " accessed by = "+@userid + Chr(13) + Chr(10) )
	writeline (1, "test2.kix Fairfax        = " + $Fairfax + " accessed by = "+@userid + Chr(13) + Chr(10) )
	writeline (1, "test2.kix Frederick      = " + $Frederick + " accessed by = "+@userid + Chr(13) + Chr(10) )
	writeline (1, "test2.kix Fredericksburg = " + $Fredericksburg + " accessed by = "+@userid + Chr(13) + Chr(10) )
	writeline (1, "test2.kix Gaithersburg   = " + $Gaithersburg + " accessed by = "+@userid + Chr(13) + Chr(10) )
	writeline (1, "test2.kix Lanham         = " + $Lanham + " accessed by = "+@userid + Chr(13) + Chr(10) )
	writeline (1, "test2.kix Leesburg       = " + $Leesburg + " accessed by = "+@userid + Chr(13) + Chr(10) )
	writeline (1, "test2.kix Manassas       = " + $Manassas + " accessed by = "+@userid + Chr(13) + Chr(10) )
	writeline (1, "test2.kix MtLaurel       = " + $MtLaurel + " accessed by = "+@userid + Chr(13) + Chr(10) )
	writeline (1, "test2.kix Naperville     = " + $Naperville + " accessed by = "+@userid + Chr(13) + Chr(10) )
	writeline (1, "test2.kix NewHaven       = " + $NewHaven + " accessed by = "+@userid + Chr(13) + Chr(10) )
	writeline (1, "test2.kix NewOrleans     = " + $NewOrleans + " accessed by = "+@userid + Chr(13) + Chr(10) )
	writeline (1, "test2.kix NYC            = " + $NYC + " accessed by = "+@userid + Chr(13) + Chr(10) )
	writeline (1, "test2.kix Parsippany     = " + $Parsippany + " accessed by = "+@userid + Chr(13) + Chr(10) )
	writeline (1, "test2.kix Peoria         = " + $Peoria + " accessed by = "+@userid + Chr(13) + Chr(10) )
	writeline (1, "test2.kix Phoenix        = " + $Phoenix + " accessed by = "+@userid + Chr(13) + Chr(10) )
	writeline (1, "test2.kix Raleigh        = " + $Raleigh + " accessed by = "+@userid + Chr(13) + Chr(10) )
	writeline (1, "test2.kix Ranson         = " + $Ranson + " accessed by = "+@userid + Chr(13) + Chr(10) )
	writeline (1, "test2.kix Richmond       = " + $Richmond + " accessed by = "+@userid + Chr(13) + Chr(10) )
	writeline (1, "test2.kix Rochester      = " + $Rochester + " accessed by = "+@userid + Chr(13) + Chr(10) )
	writeline (1, "test2.kix Tampa          = " + $Tampa + " accessed by = "+@userid + Chr(13) + Chr(10) )
	writeline (1, "test2.kix Tulsa          = " + $Tulsa + " accessed by = "+@userid + Chr(13) + Chr(10) )
	writeline (1, "test2.kix Waldorf        = " + $Waldorf + " accessed by = "+@userid + Chr(13) + Chr(10) )
	writeline (1, "test2.kix Winchester     = " + $Winchester + " accessed by = "+@userid + Chr(13) + Chr(10) )
	writeline (1, "test2.kix WinchesterPARR = " + $WinchesterPARR + " accessed by = "+@userid + Chr(13) + Chr(10) + Chr(13) + Chr(10) )
Close (1)

 Code:
;test3.kix
Open (1, "c:\kix\test.log", 5)
	writeline (1, "test3.kix Atlanta        = " + $Atlanta + " accessed by Administrator = "+@userid + Chr(13) + Chr(10) )
	writeline (1, "test3.kix Baltimore      = " + $Baltimore + " accessed by Administrator = "+@userid + Chr(13) + Chr(10) )
	writeline (1, "test3.kix Bloomfield     = " + $Bloomfield + " accessed by Administrator = "+@userid + Chr(13) + Chr(10) )
	writeline (1, "test3.kix Boston         = " + $Boston + " accessed by Administrator = "+@userid + Chr(13) + Chr(10) )
	writeline (1, "test3.kix Carlisle       = " + $Carlisle + " accessed by Administrator = "+@userid + Chr(13) + Chr(10) )
	writeline (1, "test3.kix Charlotte      = " + $Charlotte + " accessed by Administrator = "+@userid + Chr(13) + Chr(10) )
	writeline (1, "test3.kix Chicago        = " + $Chicago + " accessed by Administrator = "+@userid + Chr(13) + Chr(10) )
	writeline (1, "test3.kix Culpeper       = " + $Culpeper + " accessed by Administrator = "+@userid + Chr(13) + Chr(10) )
	writeline (1, "test3.kix Dallas         = " + $Dallas + " accessed by Administrator = "+@userid + Chr(13) + Chr(10) )
	writeline (1, "test3.kix Danville       = " + $Danville + " accessed by Administrator = "+@userid + Chr(13) + Chr(10) )
	writeline (1, "test3.kix Fairfax        = " + $Fairfax + " accessed by Administrator = "+@userid + Chr(13) + Chr(10) )
	writeline (1, "test3.kix Frederick      = " + $Frederick + " accessed by Administrator = "+@userid + Chr(13) + Chr(10) )
	writeline (1, "test3.kix Fredericksburg = " + $Fredericksburg + " accessed by Administrator = "+@userid + Chr(13) + Chr(10) )
	writeline (1, "test3.kix Gaithersburg   = " + $Gaithersburg + " accessed by Administrator = "+@userid + Chr(13) + Chr(10) )
	writeline (1, "test3.kix Lanham         = " + $Lanham + " accessed by Administrator = "+@userid + Chr(13) + Chr(10) )
	writeline (1, "test3.kix Leesburg       = " + $Leesburg + " accessed by Administrator = "+@userid + Chr(13) + Chr(10) )
	writeline (1, "test3.kix Manassas       = " + $Manassas + " accessed by Administrator = "+@userid + Chr(13) + Chr(10) )
	writeline (1, "test3.kix MtLaurel       = " + $MtLaurel + " accessed by Administrator = "+@userid + Chr(13) + Chr(10) )
	writeline (1, "test3.kix Naperville     = " + $Naperville + " accessed by Administrator = "+@userid + Chr(13) + Chr(10) )
	writeline (1, "test3.kix NewHaven       = " + $NewHaven + " accessed by Administrator = "+@userid + Chr(13) + Chr(10) )
	writeline (1, "test3.kix NewOrleans     = " + $NewOrleans + " accessed by Administrator = "+@userid + Chr(13) + Chr(10) )
	writeline (1, "test3.kix NYC            = " + $NYC + " accessed by Administrator = "+@userid + Chr(13) + Chr(10) )
	writeline (1, "test3.kix Parsippany     = " + $Parsippany + " accessed by Administrator = "+@userid + Chr(13) + Chr(10) )
	writeline (1, "test3.kix Peoria         = " + $Peoria + " accessed by Administrator = "+@userid + Chr(13) + Chr(10) )
	writeline (1, "test3.kix Phoenix        = " + $Phoenix + " accessed by Administrator = "+@userid + Chr(13) + Chr(10) )
	writeline (1, "test3.kix Raleigh        = " + $Raleigh + " accessed by Administrator = "+@userid + Chr(13) + Chr(10) )
	writeline (1, "test3.kix Ranson         = " + $Ranson + " accessed by Administrator = "+@userid + Chr(13) + Chr(10) )
	writeline (1, "test3.kix Richmond       = " + $Richmond + " accessed by Administrator = "+@userid + Chr(13) + Chr(10) )
	writeline (1, "test3.kix Rochester      = " + $Rochester + " accessed by Administrator = "+@userid + Chr(13) + Chr(10) )
	writeline (1, "test3.kix Tampa          = " + $Tampa + " accessed by Administrator = "+@userid + Chr(13) + Chr(10) )
	writeline (1, "test3.kix Tulsa          = " + $Tulsa + " accessed by Administrator = "+@userid + Chr(13) + Chr(10) )
	writeline (1, "test3.kix Waldorf        = " + $Waldorf + " accessed by Administrator = "+@userid + Chr(13) + Chr(10) )
	writeline (1, "test3.kix Winchester     = " + $Winchester + " accessed by Administrator = "+@userid + Chr(13) + Chr(10) )
	writeline (1, "test3.kix WinchesterPARR = " + $WinchesterPARR + " accessed by Administrator = "+@userid + Chr(13) + Chr(10) + Chr(13) + Chr(10) )
Close (1)

 Code:
test.log looks like this:

test2.kix Atlanta        = Caneriver accessed by = rshull
test2.kix Baltimore      = Arctic accessed by = rshull
test2.kix Bloomfield     = Liberty accessed by = rshull
test2.kix Boston         = Capecod accessed by = rshull
test2.kix Carlisle       = Gettysburg accessed by = rshull
test2.kix Charlotte      = Fireisland accessed by = rshull
test2.kix Chicago        = Wrangell accessed by = rshull
test2.kix Culpeper       = Greatfalls accessed by = rshull
test2.kix Dallas         = Pecos accessed by = rshull
test2.kix Danville       = Shenandoah accessed by = rshull
test2.kix Fairfax        = Saratoga accessed by = rshull
test2.kix Frederick      = Acadia accessed by = rshull
test2.kix Fredericksburg = Aztec accessed by = rshull
test2.kix Gaithersburg   = Amistad accessed by = rshull
test2.kix Lanham         = Tenton accessed by = rshull
test2.kix Leesburg       = Mesaverde accessed by = rshull
test2.kix Manassas       = Battlefield accessed by = rshull
test2.kix MtLaurel       = Wharton accessed by = rshull
test2.kix Naperville     = Glacier accessed by = rshull
test2.kix NewHaven       = Aleutian accessed by = rshull
test2.kix NewOrleans     = Katrina accessed by = rshull
test2.kix NYC            = Manhattan accessed by = rshull
test2.kix Parsippany     = Sandyhook accessed by = rshull
test2.kix Peoria         = Rocky accessed by = rshull
test2.kix Phoenix        = Hoover accessed by = rshull
test2.kix Raleigh        = Catoctin accessed by = rshull
test2.kix Ranson         = Carlsbad accessed by = rshull
test2.kix Richmond       = Echo accessed by = rshull
test2.kix Rochester      = Ontario accessed by = rshull
test2.kix Tampa          = Windcave accessed by = rshull
test2.kix Tulsa          = Sitka accessed by = rshull
test2.kix Waldorf        = RockCreek accessed by = rshull
test2.kix Winchester     = Whitesands accessed by = rshull
test2.kix WinchesterPARR = Yorktown accessed by = rshull

test3.kix Atlanta        = Caneriver accessed by Administrator = BONA
test3.kix Baltimore      = Arctic accessed by Administrator = BONA
test3.kix Bloomfield     = Liberty accessed by Administrator = BONA
test3.kix Boston         = Capecod accessed by Administrator = BONA
test3.kix Carlisle       = Gettysburg accessed by Administrator = BONA
test3.kix Charlotte      = Fireisland accessed by Administrator = BONA
test3.kix Chicago        = Wrangell accessed by Administrator = BONA
test3.kix Culpeper       = Greatfalls accessed by Administrator = BONA
test3.kix Dallas         = Pecos accessed by Administrator = BONA
test3.kix Danville       = Shenandoah accessed by Administrator = BONA
test3.kix Fairfax        = Saratoga accessed by Administrator = BONA
test3.kix Frederick      = Acadia accessed by Administrator = BONA
test3.kix Fredericksburg = Aztec accessed by Administrator = BONA
test3.kix Gaithersburg   = Amistad accessed by Administrator = BONA
test3.kix Lanham         = Tenton accessed by Administrator = BONA
test3.kix Leesburg       = Mesaverde accessed by Administrator = BONA
test3.kix Manassas       = Battlefield accessed by Administrator = BONA
test3.kix MtLaurel       = Wharton accessed by Administrator = BONA
test3.kix Naperville     = Glacier accessed by Administrator = BONA
test3.kix NewHaven       = Aleutian accessed by Administrator = BONA
test3.kix NewOrleans     = Katrina accessed by Administrator = BONA
test3.kix NYC            = Manhattan accessed by Administrator = BONA
test3.kix Parsippany     = Sandyhook accessed by Administrator = BONA
test3.kix Peoria         = Rocky accessed by Administrator = BONA
test3.kix Phoenix        = Hoover accessed by Administrator = BONA
test3.kix Raleigh        = Catoctin accessed by Administrator = BONA
test3.kix Ranson         = Carlsbad accessed by Administrator = BONA
test3.kix Richmond       = Echo accessed by Administrator = BONA
test3.kix Rochester      = Ontario accessed by Administrator = BONA
test3.kix Tampa          = Windcave accessed by Administrator = BONA
test3.kix Tulsa          = Sitka accessed by Administrator = BONA
test3.kix Waldorf        = RockCreek accessed by Administrator = BONA
test3.kix Winchester     = Whitesands accessed by Administrator = BONA
test3.kix WinchesterPARR = Yorktown accessed by Administrator = BONA


THANKS TO ALL WHO HELPED ME FIGURE THIS OUT!!

TURKEY77

Top
#175385 - 2007-04-13 12:18 AM Re: GLOBAL Variables not carrying through second KiXtart session [Re: Turkey77]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4401
Loc: New Jersey
OK - now that you know the trick, you can consider simplifying it a bit..

Think of a 2-element array - the site and the server. If you can load all your data into this array, you can simply pass the array value from script to script.

Before anyone suggests a global declaration or using the CALL statement to preserve var content, remember that the first script (where the var is defined) is run in one user context, and the data is passed to another script run in a different user context - hence the need for this level of complication if you want to PASS variables.

There are other methods, with differing complexities and capabilities..
You could write your vars and values to a .kix file and call that file from the second script is one way. This example would require NoVarsInStrings to work as is. This creates a .KIX file with the variables and their values that the second script would simply CALL. Use DIM or GLOBAL as needed.
 Code:
$ = RedirectOutput('temp.kix')
'Dim $Arg1, $Arg2' ?
'$Arg1=' $Arg1 ?
'$Arg2=' $Arg2 ?


Using an external INI file and READPROFILESTRING/WRITEPROFILESTRING functions is another method, and might be the way I'd have done it.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#175386 - 2007-04-13 12:27 AM Re: GLOBAL Variables not carrying through second KiXtart session [Re: Glenn Barnas]
Gargoyle Offline
MM club member
*****

Registered: 2004-03-09
Posts: 1597
Loc: Valley of the Sun (Arizona, US...
Or there is my Convert2Array() UDF http://www.kixtart.org/UDF/UDF_lister.php?what=post&code=154136
_________________________
Today is the tomorrow you worried about yesterday.

Top
Page 1 of 1 1


Moderator:  Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
1 registered (Allen) and 1198 anonymous users online.
Newest Members
M_Moore, BeeEm, min_seow, Audio, Hoschi
17883 Registered Users

Generated in 0.161 seconds in which 0.083 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org