On GUI Scripting...

Just curious how many of you are using GUI scripting?

I personally hate it. (System Events has much cooler stuff in it than this!:)) It has some real weaknesses from what I’ve seen (not unlike folderActions which I’m not a big proponent of either) and a lack of elegance. It’s too explicit. “Push this button, then push that button…” This is a like a recorded macro not a living, thinking script ! :smiley:

I was just wondering since I see many newbies in here that are attempting to use GUI Scripting when it’s usually not the best solution. Too many hardcoded instructions make things VERY inflexible and less portable. (Portability of code would be a great topic for unScripted.) Instead of digging into an app’s dictionary (which is NOT infallible (which can lead to the ever satisfying brute force methods of scripting :stuck_out_tongue: )) there seems to be a tendency to just try and make the machine push the button they want it to push.

Granted, there are always unscriptable things (or ARE THERE ?? I’ve scripted quite a few unscriptable things in my time… a few of which are still great mysteries to others. Brute force has its good points!) but GUI Scripting should be a last resort. Unless your boss demands a solution now (and won’t believe it can’t be done), I say ,“Dig deeper first.”

Anyways, the original question stands… any serious Scripters using it? Successfully ??

Regards,
Jim Neumann
BLUEFROG

Hi Jim,

whenever there is a way to avoid GUI scripting, I use it (including all available shell tricks).
But somtimes there isn’t :wink:

I don’t know if I would consider myself a serious scripter or not, but I personally do not use GUI scripting in anythig I’ve done seriously. I’m more than happy to help others though find a way around nonscriptable problems through the GUI though.

I only use it as a last resort for programs with little or incomplete AppleScript support. For example:

–Lotus Notes’ AppleScript abilities assume you’re using it as a single user, not in a secure corporate environment, which means I can do all sorts of stuff with it via AppleScript that would have Corporate IS prepping my pink slip. Safer to UI script the interface and stay within their guidelines. Besides, Lotus Notes’ idea of an AppleScript command structure violates the “language readable” tenants of AppleScript in favor of an ugly JavaScript like style. ick

–Adobe’s whacky, quirky, incomplete, and buggy implementation of AppleScript and their print dialog boxes. I won’t even go into how they force you into JavaScript and that “Watcher” plugin for Photoshop…

–TeachText not having scriptable search-n-replace. Yeah, there are ways to resort to command-line, but that often seems nearly as clunky and cryptic as UI scripting when you’re not a UNIX geek. :wink:

Also depends on expediency too…sometimes it’s just quicker to do it GUI, though not often.

Because UI scripting isn’t as easy as one would think in most cases (especially if you don’t use one of the UI browsers like Prefab’s UI Browser), I avoid it unless forced to go that route.

I like some other will avoid using GUI script , copy and paste, as well as the clipboard and the selection of objects first. Then if I absolutely necessary I will use those methods. I have successfully wrtten GUI scripting. Most of the time I need to surround the GUI actions with delays to get things to work consistently.

mm

If I could only give a single piece of advice to GUI scripters, it would be “delay is your friend.”