Thursday, October 17, 2019

#1 2019-10-10 04:05:13 pm

t.spoon
Member
From:: BFE, Massachusetts
Registered: 2013-01-13
Posts: 425

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:

Applescript:


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:

Applescript:


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.


Hackintosh built February, 2012 |  Mac OS Sierra
GIGABYTE GA-Z68X-UD3H-B3 | Core i5 2500k | 16 GB DDR3 | GIGABYTE Geforce 1050 TI 4GB
250 GB Samsung 850 EVO | 4 TB RAID
Dell Ultrasharp U3011 | Dell Ultrasharp 2007FPb

Offline

 

#2 2019-10-10 04:54:03 pm

Shane Stanley
Member
From:: Australia
Registered: 2002-12-07
Posts: 5959

Re: Syntax conflicts between computers using Shane's Dialog Toolkit.

That sounds like a terminology conflict. Try:

Applescript:

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


Shane Stanley <sstanley@myriad-com.com.au>
www.macosxautomation.com/applescript/apps/
latenightsw.com

Offline

 

#3 2019-10-10 06:21:22 pm

t.spoon
Member
From:: BFE, Massachusetts
Registered: 2013-01-13
Posts: 425

Re: Syntax conflicts between computers using Shane's Dialog Toolkit.

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


Hackintosh built February, 2012 |  Mac OS Sierra
GIGABYTE GA-Z68X-UD3H-B3 | Core i5 2500k | 16 GB DDR3 | GIGABYTE Geforce 1050 TI 4GB
250 GB Samsung 850 EVO | 4 TB RAID
Dell Ultrasharp U3011 | Dell Ultrasharp 2007FPb

Offline

 

#4 2019-10-10 08:26:49 pm

Shane Stanley
Member
From:: Australia
Registered: 2002-12-07
Posts: 5959

Re: Syntax conflicts between computers using Shane's Dialog Toolkit.

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.


Shane Stanley <sstanley@myriad-com.com.au>
www.macosxautomation.com/applescript/apps/
latenightsw.com

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)