Author Topic: GUI scripting...  (Read 5725 times)

0 Members and 1 Guest are viewing this topic.

Offline AutoFetishist

  • Sr. Member
  • ****
  • Posts: 397
  • Karma: 2
  • Gender: Male
GUI scripting...
« on: June 24, 2008, 10:55:25 AM »
Can anyone see where I'm goofing up?

I think its something here:
click menu item "Extrude & Bevel..." of menu item "3D" of menu bar item "Effect" of menu bar 1

from this script:

tell application "System Events" to tell process "Adobe Illustrator"
   set frontmost to true -- activates Illustrator
        click menu item "Extrude & Bevel..." of menu item "3D" of menu bar item "Effect" of menu bar 1
   delay 0.2
end tell


I'm getting the old "NSReceiverEvaluationScriptError: 4" error message.


Offline Jean-Marie Schwartz

  • Sr. Member
  • ****
  • Posts: 436
  • Karma: 6
  • Gender: Male
Re: GUI scripting...
« Reply #1 on: June 24, 2008, 11:16:10 AM »
When getting that message I try to simply ask System Events to list every UI element or entire contents (get entire contents of application process "Adobe Illustrator" of application "System Events", and you can see in the results all the possibilities you have; just Apple-F "extrude & bevel" and you're done, you copy-paste the relevant part back in the code and run.
Hope this helps!

PS: Prior to this, try correcting the line as above as for the last part of it (... of menu bar 1 of application process "Adobe Illustrator" of application "System Events").
Jean-Marie Schwartz
May the Schwartz be with you :-)

= Mac Pro Quad-Core Intel 2.8 GHz 10 Go 1066 MHz DDR3 Mac OS 10.8.5 QuarkXPress 9.5.4.1 Adobe CS5 =

Offline AutoFetishist

  • Sr. Member
  • ****
  • Posts: 397
  • Karma: 2
  • Gender: Male
Re: GUI scripting...
« Reply #2 on: June 24, 2008, 12:25:47 PM »
No dice.
tried adding the extra code, and still get the same error.


I did try running the System Events list routine, but that seems to be running ad infinitum.

How long should it take to compile the results?

Offline Jean-Marie Schwartz

  • Sr. Member
  • ****
  • Posts: 436
  • Karma: 6
  • Gender: Male
Re: GUI scripting...
« Reply #3 on: June 25, 2008, 03:05:37 AM »
I did try running the System Events list routine, but that seems to be running ad infinitum.

How long should it take to compile the results?
Well... ad infinitum, so it's hard to say from now on how long it should take  ;D
More seriously, you should probably narrow the search (sorry I haven't think of that yesterday), like <get entire contents of menu bar item "Effect" of menu bar 1 of application process "Adobe Illustrator" of application "System Events">.
Hope this helps.

EDIT: Modified the process name, I wrote Finder!  :(
« Last Edit: June 25, 2008, 03:34:30 AM by Jean-Marie Schwartz »
Jean-Marie Schwartz
May the Schwartz be with you :-)

= Mac Pro Quad-Core Intel 2.8 GHz 10 Go 1066 MHz DDR3 Mac OS 10.8.5 QuarkXPress 9.5.4.1 Adobe CS5 =

Offline AutoFetishist

  • Sr. Member
  • ****
  • Posts: 397
  • Karma: 2
  • Gender: Male
Re: GUI scripting...
« Reply #4 on: June 25, 2008, 06:53:47 AM »
No, what I'm saying is that I must not have the code exact for the System Events list routine. It never finishes getting the list.

Can you post it, so I know I'm doing it exactly?

Offline Jean-Marie Schwartz

  • Sr. Member
  • ****
  • Posts: 436
  • Karma: 6
  • Gender: Male
Re: GUI scripting...
« Reply #5 on: June 25, 2008, 08:32:05 AM »
No, what I'm saying is that I must not have the code exact for the System Events list routine. It never finishes getting the list.

Can you post it, so I know I'm doing it exactly?
???
To whom are you talking?
I gave you the line of code. Are you still getting an error?
Jean-Marie Schwartz
May the Schwartz be with you :-)

= Mac Pro Quad-Core Intel 2.8 GHz 10 Go 1066 MHz DDR3 Mac OS 10.8.5 QuarkXPress 9.5.4.1 Adobe CS5 =

Offline Publi-Script

  • Administrator
  • Hero Member
  • *****
  • Posts: 596
  • Karma: 16
  • Gender: Male
  • Automate your Life!
    • Publi-Script.com
Re: GUI scripting...
« Reply #6 on: June 25, 2008, 09:56:03 AM »
I believe the problem resides in the process name you are calling within System Events, it should be "Adobe Illustrator CS3".
Quote
001     tell application "Adobe Illustrator"
002          my doMenu_SE("Effect", "3D", "Extrude & Bevel...")
003     end tell

004     on doMenu_SE(This_Menu, First_Level, Second_Level)
005          tell application "Adobe Illustrator"
006               activate
007               tell application "System Events"
008                    tell process "Adobe Illustrator CS3"
009                         set frontmost to true
010                         
011                         tell menu bar 1
012                              tell menu bar item (This_Menu)
013                                   tell menu 1
014                                        if Second_Level is "" then
015                                             click menu item First_Level
016                                             
017                                        else
018                                             tell menu item First_Level
019                                                  tell menu 1
020                                                       click menu item Second_Level
021                                                  end tell
022                                             end tell
023                                        end if
024                                   end tell
025                              end tell
026                         end tell
027                    end tell
028               end tell
029          end tell
030     end doMenu_SE
Michel Lemieux
Forum Administrator
-------------------------
OS X 10.6.4
Quark 6.5 / 7.5 / 8.1.6
Adobe Design Premium CS / CS2 / CS3 / CS4 / CS5
Script Debugger 4.5

Offline larsen67

  • Sr. Member
  • ****
  • Posts: 459
  • Karma: 10
  • Gender: Male
Re: GUI scripting...
« Reply #7 on: June 26, 2008, 09:17:27 AM »
AutoFetishist, what are you intending to do with this?

Offline AutoFetishist

  • Sr. Member
  • ****
  • Posts: 397
  • Karma: 2
  • Gender: Male
Re: GUI scripting...
« Reply #8 on: June 26, 2008, 10:50:15 AM »
Trying to automate a 3-D conversion of one of our graphs.

From what I was told the 3-D effect menu was not part of the Illustrator dictionary...

Now that I think about it, I forget whether if any of that menu was accessible thru Actions.

Offline larsen67

  • Sr. Member
  • ****
  • Posts: 459
  • Karma: 10
  • Gender: Male
Re: GUI scripting...
« Reply #9 on: June 26, 2008, 11:17:22 AM »
You may also want to look at applying your 3D effect to an object and saving as a graphic style. This could then be applied to your graph. If you duplicate an item into other doc then graphic styles are imported with them if they don't exist.