Syntax conflicts between computers using Shane's Dialog Toolkit.

I have a long script that uses Shane Stanley’s Dialog Toolkit.

One handler in that script is this:


on setActiveOnMain:sender
	set theAlert to theAlert of _alertRecord
	((theAlert's buttons()'s objectAtIndex:0)'s setEnabled:true)
end setActiveOnMain:

On my computer, this will not compile, it highlights the parenthesis after “buttons” and errors: “Expected “,” but found “(”.”
If I remove those parenthesis, it compiles and runs fine on my computer. So on my computer, it has to be this:


on setActiveOnMain:sender
	set theAlert to theAlert of _alertRecord
	((theAlert's buttons's objectAtIndex:0)'s setEnabled:true)
end setActiveOnMain:

But if I compile it this way and save it as a .scpt and run it from FastScripts, then when it’s run on other user’s computers (several other users) the “OK” button in the dialog of the Dialog Toolkit window will never be enabled. It works fine on my computer.

On out other developer’s computer, it won’t compile without those parentheses. I can’t check right now, but I believe he said that if he opens a copy without the parentheses and compiles, that they are automatically added back in. I can not save an executable with the parenthesis, because I can’t compile with them. He has to compile on his computer and save it with the parenthesis so it will work on other people’s computers.

The copies he saves with the parenthesis still run fine on my computer.

So right now, I can’t even make small changes to any part of this script, because in order to compile, I have to remove the parenthesis, which breaks the script for other users.

We are all on the identical copy of Dialog toolkit.

Both of us are editing in the latest version of Script Debugger.

I’m on Sierra… it’s possible the other developer and the users who’s buttons don’t become active might all be on High Sierra.

Is this caused by the OS Version difference? If not what? And is there any way around this, short of getting on the same OS version?

I can paste the whole script if anyone wants it, but it’s 5,200 lines and isn’t going to compile for you without heaps of dependencies… or run without heaps more… and I hoped that context wouldn’t be relevant to this problem.

Thanks in advance for any help…

  • tspoon.

That sounds like a terminology conflict. Try:

   ((theAlert's |buttons|()'s objectAtIndex:0)'s setEnabled:true)

Thanks so much Shane! Looks like that works, you saved me!

While grateful for the solution, I’m still slightly unclear on the details of the cause - I have some other scripting component or something installed on just my computer, that the other users don’t have, that also uses the term “buttons?” I can’t imagine what that would be, but it’s certainly possible.

Either way, wonderful to get a solution so fast.

  • tspoon

The term buttons is defined in the library itself, and also in Standard Additions, but both times as a parameter, which shouldn’t cause a problem. (That code is not part of Dialog Toolkit itself, so someone has added it there.)

However, FastScripts loads all scripts into a single component instance, which means the terminology pool is shared by all scripts. So it may be they’ve run some script that uses an app or library that has defined it in a way your code isn’t happy with.

But I’m curious: are you opening the script from a script file of some sort or a text file? Because in the former case, if there’s any terminology collision AppleScript should add the pipes for you.

IAC, for compilation errors, adding pipes is probably one of the first things to try.