[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [sc-users] error when using .gui method on an Instr



On Dec 21, 2007, at 10:16 AM, felix wrote:

the one thing I would say is that its actually lastExecutedFile, not nowExecutingPath

Currently it *is* nowExecutingPath - right now it's populated **only** when running a file with executeFile. When the file is done, the variable is cleared.

If we make it pick up the current document's path, then the name probably would have to change because it would be the last executed file. Unless we tweak the error handler to clear it?

This is something we have to define before going further... when the interpreter is idle, what should this variable hold?


right now I can't see why it wouldn't have worked before.

Well, it doesn't. I just commented out the path setting in Instr:init and the path is nil for all my Instr's.

Wait... I see what the issue is. I use Instr.loadAll in my startup.rtf file. That method doesn't do anything to set the path for the Instr.

Anyway, looking more deeply, the only other place that sets the path -- objectAt -- doesn't do it properly. That method gets the result of loading the file and saves it in a variable instr, then assigns the path to the object in that variable. But this variable can hold the only the last Instr created within the file. If you create 20 Instr's in that file, only one of them will have the path automatically assigned.

Maybe you could work around that in objectAt by assigning the path to the object pulled out of the library (i.e. the return object), but that seems kind of weak compared to just setting the path properly for all Instr's in the file to begin with.

hjh



: H. James Harkins

: jamshark70@xxxxxxxxxxxxxxxxx

: http://www.dewdrop-world.net

.::!:.:.......:.::........:..!.::.::...:..:...:.:.:.:..:


"Come said the Muse,

Sing me a song no poet has yet chanted,

Sing me the universal."  -- Whitman