Running into a problem with InDesign changing my compiled AS files. It appears that certain values are being cached (by InDesign) within the compiled version after being run from the Scripts Panel and when those scripts are then shared with other users, they contain references to paths and hard drives on my machine. However, if I share the compiled versions without running them first within the Scripts Panel, they won't have the cached values.
So my question, why is InDesign changing the compiled versions of my AS?
How to do I prevent InDesign from changing the the compiled scripts?
Could it have something with the undo modes in the do script even though my scripts aren't using do script?
tell application "Adobe InDesign CS5.5"
set myScript to active script
display dialog ("The current script is: " & myScript)
tell application "Finder"
set myFile to file myScript
set myParentFolder to container of myFile
display dialog ("The folder containing the active script is: " & myParentFolder)
Here is the process to reproduce:
In fact, if you do #2-5 over and over again, you'll see the file size increasingly grow in size. For instance:
Script Editor compile: 2,971 bytes
InDesign run: 4,049 bytes
Script Editor compile and save: 3,168 bytes (Gives warning: "This document’s file has been changed by another application since you opened or saved it. The changes made by the other application will be lost if you save. Save anyway?")
InDesign run: 4,246 bytes
Script Editor compile and save: 3,365 bytes (Gives warning: "This document’s file has been changed by another application since you opened or saved it. The changes made by the other application will be lost if you save. Save anyway?")
InDesign run: 4,443 bytes
My environment: OSX 10.6, InDesign CS5.5, AppleScript 2.1.2
I would usually expect to see this kind of behaviour with a "property : value" construct, where properties would usually be stored back into the script.
After running your script a few times, it seemed to me the file size stopped increasing after a certain point.
I can't really comment on why exactly this is happening, I've not experienced such a thing before. I never had to use active script or display info about it.
Could you give us some background on what exactly you are using it for? It seems unusual to have to display the current script name or location. Maybe there is a better way.
Have you tried simply setting the var to nothing at the beginning of the script? It's not necessarily elegant but it might do the job.
OSX 10.6.8, IDCS5, Script Debugger 4.5x
That's normal behavior. When an app runs a script, it then saves it back to disk. That version contains the contents of any modified properties, as SuperMacGuy says, but it also includes the value of any *top level* variables. So you need move any variables you don't want stored out of the top level of the script -- essentially put it all in a handler.