Open scripting opened 2 years ago
@scripting -- I created the startup script in Electric Drummer per the instructions above and I am still getting the "localfile is not defined" error.
Here is the startup script:
Here is the script in my scripts menu:
Here is my Electric Drummer console:
@gwthompson -- there is a problem, i did what you should do, try a simpler test case, then simplify more, and figure out what i did wrong in the instructions. i did make a mistake, but i want you to start doing more investigation to help me so my job gets a little easier. at the level at which you're capable of working, you should be able to tell me exactly what i did wrong. come on you can do it.
A few hours later...
I debugged it by seeing if I replaced the complicated script with something simpler, and it didn't work either, but that factored out most of what was in the error report.
And sure enough in the console when I entered myColors it was undefined.
As an experiment I got rid of the var.
Restarted Drummer and this time myColors was defined.
So if you try dropping the var off the assignment to localfiles it'll work.
The reason, I suspect is that with var it creates a local and without it, a global is created, which is what we want.
@scripting -- I just got home and saw your message. It worked perfectly!
This came up in another forum. A programmer wants to use Electric Drummer as part of their code build system and needs to be able to write to the local file system. Since E/D runs native this is possible. However Drummer doesn't have any built in verbs to do local file writes. But you can add them.
How to add the localfile.xxx verbs
In Electric Drummer choose Scheduler from the Special files sub-menu of the file menu.
If there isn't already a top-level item in the outline called startup, create it
Under startup type a title, any text will do.
And under that paste the text from this script file.
Pause for a second (so the file can save automatically) before quitting and restarting E/D.
Now you should be able to call
localfile.write
andlocalfile.read
from your scripts.