GUI scripting problem

Hi everyone,

I’ve written a couple of applets that use GUI scripting to print PDFs using Adobe Acrobat and specific printing presets. The only way to activate the presets that I could find was to use GUI scripting. The two applets differ only in the preset they choose, and the filename of the applet of course.

I’m having trouble getting them allowed in the Accessibility section of the Security & Privacy settings. I can add one and get it to work but then after I add the second one, the first one doesn’t work and vice-versa. I can only ever get one name to appear in the list of allowed apps (apps that are allowed to control your computer).

Any ideas why this is happening – does the system think they are the same app or something?

I’m going to guess that you made one script, then modified it and saved it again as the other script, and they both ended up with the same Bundle ID. That’s how Accessibility Inspector identifies things, and it thinks they’re both the same script. Or something like that.

I’d delete both of them out of Accessibility Inspector. Then I’d open each script, copy the all the code, make a new Script Editor document for each, paste the code in, compile, and save each with a new name - unique from each other, and from the previous names used. Then try adding those two new copies to Accessibility inspector.

Not guaranteeing this will work, but it’s the first thing I’d try. Good luck.

Thanks for your reply t.spoon. You are correct – I did duplicate the file to make the second version, then just changed some code and its name. I tried what you suggested (copying the code and making two new apps, deleting the old ones from the Accessibility Inspector and adding the new ones) but I only got the same result, only one would work.

I noticed in the Bundle info that they both still have the same Bundle ID, in fact every app that I make will have the same ID. I tried changing that between the two files but that didn’t make any difference. Maybe do you think the apps need to be code signed?

Sorry, I’m afraid I don’t know the answer to that. I rarely run scripts as applications, I overwhelmingly use FastScripts to run .scpt files, so I don’t have Applescript applications individually added to allow accessibility. Just giving FastScripts accessibility access lets all my scripts run.

I hope someone else here has a better idea.