Calling a script from another stack
Posted: Mon Nov 04, 2013 12:40 am
Hi Guys,
I've got a main stack file with a number of cards. I've also got a substack within that file called Scripts and a card within that substack called ScriptUtils and I plan to paste all the reusable code snippets in there. Two of the main handlers I have are the following database.
From one of the cards on the main stack Im trying to call the GetDatabaseID handler so I have the following, but it doesn't seem to be displaying the gConnID from my GetDatabaseID handler. Is there something else I should be doing apart from loading the stack and calling the script?
I've got a main stack file with a number of cards. I've also got a substack within that file called Scripts and a card within that substack called ScriptUtils and I plan to paste all the reusable code snippets in there. Two of the main handlers I have are the following database.
Code: Select all
global gConnID -- connection ID
command GetDatabaseID
put the effective filename of this stack into filepath
set the itemdelimiter to slash
put "mydb.sqlite" into the last item of filepath
put revOpenDatabase("sqlite", filepath,,,,,,) into gConnID
answer gConnID
end GetDatabaseID
on CloseDatabaseID
if (gConnID > 0) then
revCloseDatabase gConnID
end if
end CloseDatabaseID
Code: Select all
global gConnID
local sInitializedFlag
on openStack
if sInitializedFlag is not true then
start using stack "Scripts"
put true into sInitializedFlag
end if
pass openStack
GetDatabaseID
end openStack