#175250 - 2007-04-05 08:31 PM
GLOBAL Variables not carrying through second KiXtart session
|
Turkey77
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! 
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:
;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.
;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"
;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
|
|
|
|
#175253 - 2007-04-05 11:09 PM
Re: GLOBAL Variables not carrying through second KiXtart session
[Re: Turkey77]
|
Allen
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
;CALL servers.kix ; I tried CALLing servers.kix here, but no luck
? "" + @serror + " - " + @serror
|
|
Top
|
|
|
|
#175307 - 2007-04-10 12:33 PM
Re: GLOBAL Variables not carrying through second KiXtart session
[Re: Turkey77]
|
Arend_
MM club member
   
Registered: 2005-01-17
Posts: 1896
Loc: Hilversum, The Netherlands
|
;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:
;filename servers.kix
GLOBAL $Carlisle, $NYC, $Boston, $Bloomfield
$Carlisle = "Gettysburg"
$NYC = "Manhattan"
$Boston = "Capecod"
$Bloomfield = "Pinelands"
|
|
Top
|
|
|
|
#175383 - 2007-04-12 09:51 PM
Re: GLOBAL Variables not carrying through second KiXtart session
[Re: Arend_]
|
Turkey77
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! 
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.
;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
;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
;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)
;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)
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
|
|
|
|
Moderator: Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart
|
1 registered
(Allen)
and 1198 anonymous users online.
|
|
|