I found what, for me, is a simpler solution is to set the global variables using a set function, which I define in the file to be loaded. This file is a mock class that I am trying to use across all of my scripts, so I didn't want to have to copy and paste the code into multiple documents if I could avoid it. So instead of ... global ClassC set ClassC to load file alias pathToClassScptFile --contains global variable Class_myVar set Class_myVar to varValue ...now I use... global ClassC set ClassC to load file alias pathToClassScptFile --contains global variable Class_myVarClassC ClassC's set_Class_myVar(varValue) ... which works fine. Thanks for the help. -Rebecca
On Tue, Jun 23, 2009 at 6:35 PM, Jon Stovell (a.k.a. Sesquipedalian) < [email protected]> wrote: > > I don't know why that is happening, but a simple workaround would be > to consolidate all routines into a single script document, like this: > > global glbvar > > on open(thefiles) > --do something here > end open > > on routine_1(variable1, variable2) > --do somthing here > end routine_1 > > on routine_2() > --do something here > end routine_2 > > > On Jun 23, 5:59 pm, "Rebecca O'Connell" <[email protected]> wrote: > > I have a script that uses global variables to pass information to a > > subroutine. The script works perfectly when I run it from Script Editor > > using files selected in the Finder, but when I wrap it in "on open" tags > and > > run it as a Quicksilver action, I get variable not defined errors for > > global variables set in the parent script and used in the loaded > subroutine. > > Does anyone know why this is happening and how I can work around it? > > > > Thank you, > > Rebecca >
