Case changes in variable names no longer working?

(Stan Cleveland) #1

In earlier versions of SD, one could change the case of letters within a variable name (being sure to change all occurrences of the name) and get the changes to stick by just recompiling. Not sure when this stopped working, but it’s now failing for me.

I even tried changing all occurrences of a variable name to something completely different (xyzzy), recompiling, then changing the names back with the desired case changes. Upon recompiling again, the original variable name is restored with the original letter casing.

Is this happening to anyone else, or is it unique to my world?

Stan C.

– OS X 10.11.6 (15G1217), Debugger 6.0.4 (6A198)

(Shane Stanley) #2

You should be able to change the case in a variable’s name (assuming Script Debugger 6) – what matters is the case used for the first instance of the variable the compiler comes across.

There’s an expert preference that can turn this off. To turn it on, run this script:

use AppleScript version "2.4" 
use framework "Foundation"

current application's NSUserDefaults's standardUserDefaults()'s setObject:true forKey:"PrefResetIdentifiersOnCompile"

Edited to fix the boolean

(Stan Cleveland) #3

Hi Shane,

I tried the expert script (with the boolean fix), but it didn’t help. I’m also seeing other bizarre behavior.

Here’s an example (this follows a fresh reboot while holding cmd-opt-P-R):

  1. Open a new script window, delete my usual boilerplate text, and paste in a small script with a display dialog.
  2. Save as a script applet to the Desktop, then close it.
  3. Run the applet—no dialog appears.
  4. Drag the applet icon onto SD icon to open—the pasted text is gone and the boilerplate is back.
  5. When I look at the resources in the applet, I find:
    a. /Contents/Resources/Scripts/main.scpt contains the boilerplate text.
    b. /Contents/Resources/Scripts/main.recover.rtf contains the pasted script text.

It makes me wonder if my copy of SD or a prefs file is corrupt. Can I just drag the SD app to the trash and pull a new copy from the .dmg? Are there any preference or other files I should also drag to the trash? I don’t mind reentering registration info, resetting preferences, adding key shortcuts, etc.

Stan C.

(Shane Stanley) #4

The app itself is very unlikely to be corrupt, but you could try deleting the prefs file. Reboot and delete it before launching SD.

(Stan Cleveland) #5

Yes, dumping the prefs has fixed both (1) variable case changing and (2) retention of the correct code within a saved applet.

Many thanks for the help, Shane.

Stan C.