AppleScript GUI scripting problem.

Hi All,
I've created a script that will automatically open new document in Indesign CS2. But when i run the script i'm getting system events error as "NSReceiverEvaluationScriptError: 4". I tried following the instruction given in forums but still couldn't figure out. Below is the script i wrote. Can any one tell where and what i'm missing.
tell application "Adobe InDesign CS2" to activate
tell application "System Events"
tell process "Adobe InDesign CS2"
tell menu bar 1
tell menu bar item "File"
tell menu "File"
tell menu item "New"
tell menu "New"
click menu item "Document"
end tell
end tell
end tell
end tell
end tell
click button "Ok" of window 1
end tell
end tell
This is the submenu of menu New. This might be the problem cos the below script works for for which i'm clicking the menu not sub menu
tell application "Adobe InDesign CS2" to activate
tell application "System Events"
tell application process "Adobe InDesign CS2"
tell menu bar 1
tell menu bar item "Help"
tell menu "Help"
click menu item "Welcome Screen..."
end tell
end tell
end tell
end tell
end tell
My Mac version 10.4.10
Any help would be appreciated.
-Jacintha

Using GUI scripting is the road to madness; it's for emergency use only.<br />Try:<br /><br />tell application "Adobe InDesign CS2"<br />make document<br />end tell<br /><br />-- <br />Shane Stanley <[email protected]>

Similar Messages

  • AppleScript GUI scripting WGM

    In preparation for adding over 700 users, we've written an AppleScript script that uses GUI scripting on WGM. Everything works as expected, except that data entered into the Comment field (Advanced tab) disppears after switching to a different user and then returning to the newly-added user. All other fields are fine, it's just Comments.
    Has anyone else done AppleScript GUI scripting on WGM?

    I can't answer directly, but there are numerous other reports of text fields not 'sticking' via UI scripting (not just in WGM).
    If it's not too late, I wouldn't recommend using UI scripting for such a large task. There are too many variables that could mess it up.
    If you haven't run the import yet I'd recommend taking a look at dscl, the Directory Service Command Line tool - it lets you manipulate any data in your directory via a command line interface. It should be more robust than UI scripting when dealing with mass updates like this.

  • Easy AppleScript/TextEdit scripting problem...

    Hi All:
    I'm new to AppleScript, and we recently upgraded to Lion. We had a simple AppleScript we were using to strip quotation marks out of a .csv file using TextEdit, but the keystroke commands in Lion are different.
    Here is the original script, which worked under Leopard/SnowLeopard:
    tell application "TextEdit" to activate
    tell application "System Events" to tell process "TextEdit"
              keystroke "f" using command down
              keystroke "\"" & tab
              keystroke delete key
              click button "Replace All" of window "Find"
              keystroke "s" using command down
    end tell
    This would tell TextEdit to take the current file, replace all the quotation marks with nothing, then save the file again. Now, TextEdit uses a floating menu bar to do Find/Replace. I can get the script to go as far as selecting all the quotation marks:
    tell application "TextEdit" to activate
    tell application "System Events" to tell process "TextEdit"
      keystroke "f" using command down & option down
      keystroke tab using shift down
      keystroke "\""
    end tell
    ...but I can't figure out how to tell it to click the "All" then "Done" buttons to strip the quotes. Any assistance would be appreciated. Thanks!

    If all you're doing is stripping quotation marks out of a CSV file, then you are making your life difficult by GUI scripting. TextEdit is scriptable, so something like this should work without breaking across OS revisions:
    tell application "TextEdit"
              set documentText to text of document 1
              set {oldTID, my text item delimiters} to {my text item delimiters, "\""}
              set textBits to text items of documentText
              set my text item delimiters to ""
              set text of document 1 to textBits as text
              set my text item delimiters to oldTID
    end tell
    if you're wanting to do this to multiple documents rather than just one already-open document, you shouldn't even use TE; just open the document in applescript, modify it, and save it back to disk.

  • Applescript GUI scripting, selecting a window element

    HI everyone,
    I have an issue where I need to programmtically generate a list of Activation Requests for the ColorEyes Display Pro application. In order to get the info I need, I have to launch the app while holding the command and shift keys, then select from a drop down list. The information does present as a field that I can select and copy, but I can't figure out how to simulate a click on that field.
    I have every piece of this together except what UI element I need to access and how to select it so I can save it in a varialbe or at least copy and paste it.
    I’m only interested in the request number item of Show Field Data. Here is the code I’ve written so far:
    tell application "System Events"
        key down command
       key down shift
       do shell script "open '/Applications/ColorEyes Display Pro/ColorEyes Display Pro.app'"
        delay 10
        key up command
       key up shift
       tell process "QuickLicenseRT"
            delay 3
            click pop up button 1 of window "License Options"
            key code 125 -- down arrow key
           key code 125 -- down arrow key
           keystroke return
           delay 1
            click UI element 33 of window "License Options" --- this doesn't seem to be right. Don't know what it would be
            --delay 1
           --keystroke return
           --delay 1
           --keystroke return
       end tell
    end tell
    and the events I get when running the code:
    tell application "System Events"
       key down command
       key down shift
       do shell script "open '/Applications/ColorEyes Display Pro/ColorEyes Display Pro.app'"
           --> error number -10004
    end tell
    tell current application
       do shell script "open '/Applications/ColorEyes Display Pro/ColorEyes Display Pro.app'"
           --> ""
    end tell
    tell application "System Events"
       key up command
       key up shift
       click pop up button 1 of window "License Options" of process "QuickLicenseRT"
           --> pop up button 1 of window "License Options" of application process "QuickLicenseRT"
       key code 125
       key code 125
       keystroke "
       click UI element 33 of window "License Options" of process "QuickLicenseRT"
           --> missing value
    end tell
    Result:
    missing value
    The script runs and opens color eyes and gets to the show field data window and selects it. I can see the request number, but cant get that data into a variable.
    This is what a short applescript I found to list the elements of a given window says about this QuickLicenseRT window:
    I also have screen shots of what the QuickLicenseRT window looks like:
    The request number is different on each Mac, and I need to know which ones are active and which aren't. These activations are distributed globally so I HAVE to be able to do this programmatically.
    Any ideas?
    TIA!
    Andrew

    I can't answer directly, but there are numerous other reports of text fields not 'sticking' via UI scripting (not just in WGM).
    If it's not too late, I wouldn't recommend using UI scripting for such a large task. There are too many variables that could mess it up.
    If you haven't run the import yet I'd recommend taking a look at dscl, the Directory Service Command Line tool - it lets you manipulate any data in your directory via a command line interface. It should be more robust than UI scripting when dealing with mass updates like this.

  • Tool Tip / GUI-script battle

    I've got a slider that invokes a handler that performs some AppleScript GUI scripting ( ... unfortunate, yes, but there's no other way.)
    The slider has a Tool Tip.
    If I click and drag outside of the slider's mouseDown region, no problem. The GUI stuff works as expected.
    If I drag inside the slider's mouseDown region, the ToolTip appears at it designated time, as if I were hovering. This causes a NSReceiverEvaluationScriptError: 4 (1) error. Certainly makes sense that I'd get an error when the Tool Tip comes to the front. But I'm confused as to why it appears. None of my non-GUI related sliders have this problem.
    Suggestions?
    Here are a few other Tool Tip questions:
    1) Can I increase or decrease the display length for all tool tips?
    2) Is it possible to keep tool tips visible indefinitely while the user hovers the mouse over the object, closing on mouseLeave?
    3) Can I toggle all Tool Tips to enabled or disabled?
    Thanks, John

    I've got a slider that invokes a handler that
    performs some AppleScript GUI scripting ( ...
    unfortunate, yes, but there's no other way.)
    The slider has a Tool Tip.
    If I click and drag outside of the slider's mouseDown
    region, no problem. The GUI stuff works as expected.
    If I drag inside the slider's mouseDown region, the
    ToolTip appears at it designated time, as if I were
    hovering. This causes a
    NSReceiverEvaluationScriptError: 4 (1) error.
    Certainly makes sense that I'd get an error when the
    Tool Tip comes to the front. But I'm confused as to
    why it appears. None of my non-GUI related sliders
    have this problem.
    Suggestions?
    Just noticed: on another computer (a powerBook) I get the NSReceiver error at any click or drag. Cleaned all targets and got the same result.
    I set a one second delay to make sure the GUI window gets time to come to the front but to no avail. There's a error at every click or drag.
    John

  • Enabling GUI scripting via AppleScript

    So I have a launch-daemon that needs to utilize GUI scripting.  I need to be able to enable it through AppleScript (or really any scriptable, automated means).  I am trying to do this:
    tell application "System Events" to if not UI elements enabled then
              set UI elements enabled to true
              return UI elements enabled
    end if
    but it doesn't seem to do anything.  The return query is just to check that it worked, but it never does.  I have tried saving the script and running it as administrator (sudo osascript myScript.scpt) but it still doesn't work.  I never get prompted for admin credentials.  This occurs when logged in as administrator or non-admin user.  Any ideas?

    tell application "System Events"
              set UI elements enabled to true
    end tell
    tell application "System Events"
              return UI elements enabled
    end tell
    The second part is just to test what the current setting it.  It always stays false.

  • Using AppleScript to re-format with GUI scripting

    Background:
    I use Pages 4.1 under Mac OSX 10.6.8.
    I use medical practice software called Genie, built on 4D. When I create a new letter based on a template in Genie, some formatting is required before the letter is sent. This is repetitive and frequent - just the sort of task for scripting. With help from many people on Apple discussions, I now have a script that converts the text in Pages from A (starting and ending with =====) to B (starting and ending with +++++). The text and the script are edited, as there are about 30 lines in the real Mental State Exam.
    The script uses Styles within Pages to change the formatting of the headings. It uses GUI scripting with find and replace to add spaces before measurement abbreviations. It use GUI scripting to italicise some sub-headings.
    I tried to use GUI scripting of the Advanced tab of the Find & Replace window, but I was unsuccessful, as I don't know how to find out the names of the various items in the Find & Replace window. (E.g. Where it says "Style:" with a dropdown menu starting with "Any", I don't know how to refer to this dropdown menu).
    Although this script works, it's slower than I would like, and it's a bit clunky because of the way I have incorporated elements of scripts more knowledgable users, and cobbled them together.
    I would appreciate any advice on how to improve the script.
    Thanks,
    Peter
    =====
    MEDICATIONS:
    Lexapro  10mg  Tablets one daily with the evening meal
    Panadol Osteo  665mg  Modified release tablets ii mane
    Seroquel  102mg  Tablets one nocte
    MENTAL STATE EXAMINATION
    Appearance and Behaviour
    General appearance: Casually dressed. 
    Patient Attitude: Cooperative
    Psychomotor Activity: Normal
    Insight and Judgement
    Insight: Good
    Aware of abnormal phenomena: Yes
    Attributes to Illness: Yes
    Willing to accept treatment: Yes
    Judgement: Consistent with personality
    =====
    +++++
    MEDICATIONS:
    Lexapro 10 mg Tablets one daily with the evening meal
    Panadol Osteo 665 mg Modified release tablets ii mane
    Seroquel 102 mg Tablets one nocte
    MENTAL STATE EXAMINATION
    Appearance and Behaviour
       General appearance: Casually dressed.
       Patient Attitude: Cooperative
       Psychomotor Activity: Normal
    Insight and Judgement
       Insight: Good
          Aware of abnormal phenomena: Yes
          Attributes to Illness: Yes
          Willing to accept treatment: Yes
       Judgement: Consistent with personality
    +++++
    Script:
    property replacements : {¬
       {"0mg ", "0 mg "}, ¬
       {"1mg ", "1 mg "}, ¬
       {"2mg ", "2 mg "}, ¬
       {"3mg ", "3 mg "}, ¬
       {"4mg ", "4 mg "}, ¬
       {"5mg ", "5 mg "}, ¬
       {"6mg ", "6 mg "}, ¬
       {"7mg ", "7 mg "}, ¬
       {"8mg ", "8 mg "}, ¬
       {"9mg ", "9 mg "}, ¬
       {"  ", " "}, ¬
       {"  ", " "} ¬
    tell application "Pages" to activate
    tell application "System Events" to tell process "Pages"
       keystroke "f" using command down
       repeat until exists window "Find & Replace"
       end repeat
       tell window "Find & Replace"
          repeat with thisReplacement in replacements
             set {X, Y} to thisReplacement
             set value of text area 1 of scroll area "Find:" of tab group 1 to X
             set value of text area 1 of scroll area "Replace:" of tab group 1 to Y
             click button "Replace All" of tab group 1
          end repeat
          click button 1
       end tell
    end tell
    property styleHeadings : {¬
       {"MENTAL STATE", "MSE Heading 1"}, ¬
       {"Appearance and B", "MSE Heading 2"}, ¬
       {"General appe", "Indent-single"}, ¬
       {"Patient attit", "Indent-single"}, ¬
       {"Psychomotor ", "Indent-single"}, ¬
       {"Rapport:", "Indent-single"}, ¬
       {"Insight and j", "MSE Heading 2"}, ¬
       {"Insight:", "Indent-single"}, ¬
       {"Judgement:", "Indent-single"}, ¬
       {"Aware of abn", "Indent-double"}, ¬
       {"Attributes to i", "Indent-double"}, ¬
       {"Willing to acc", "Indent-double"} ¬
    on stylise()
       tell application "Pages"
          tell document 1
             set paragraphTexts to paragraphs of body text
             repeat with p from (count paragraphTexts) to 1 by -1
                set paraText to item p of paragraphTexts
                repeat with k from 1 to (count styleHeadings)
                   set {marker, styleName} to item k of styleHeadings
                   if (paraText begins with marker) then
                      set paragraph style of paragraph p of body text to paragraph style styleName
                      exit repeat
                   end if
                end repeat
             end repeat
          end tell
       end tell
    end stylise
    stylise()
    set italicHeadings to {"General appearance:", "Patient Attitude:", "Psychomotor activity:", "Rapport:", ¬
       "Insight:", "Aware of abnormal phenomena:", "Attributes to Illness:", ¬
       "Willing to accept treatment:", "Judgement:"}
    tell application "Pages" to activate
    tell application "System Events" to tell process "Pages"
       repeat with findPhrase in italicHeadings
          keystroke "f" using command down
          repeat until exists window "Find & Replace"
          end repeat
          tell window "Find & Replace"
             set value of text area 1 of scroll area "Find:" of tab group 1 to findPhrase
             click button "Next" of tab group 1
             keystroke "w" using command down
             keystroke "i" using command down
          end tell
       end repeat
    end tell

    Hi,
    This can be done without "Gui Scripting" when the document does not contain many lines, otherwise it's much slower.
    Here is an example:
    tell application "Pages" to tell document 1
        set tWords to (words whose it ends with "mg")
        repeat with i from (count tWords) to 1 by -1
            set thisWord to item i of tWords
            if (length of thisWord) > 2 and text -3 of thisWord is in "1234567890" then
                set (word i whose it ends with "mg") to (text 1 thru -3 of thisWord) & " mg"
            end if
        end repeat
        set L to character offset of characters whose it = " " or it = " "
        set n to -2
        repeat with i from (count L) to 1 by -1
            set n2 to item i of L
            if n - 1 = n2 then delete character n2
            set n to n2
        end repeat
        set styleHeadings to {{"MENTAL STATE", "Sous-section 2"}, ¬
            {"Appearance and B", "MSE Heading 2"}, ¬
            {"General appe", "Indent-single"}, ¬
            {"Patient attit", "Indent-single"}, ¬
            {"Psychomotor ", "Indent-single"}, ¬
            {"Rapport:", "Indent-single"}, ¬
            {"Insight and j", "MSE Heading 2"}, ¬
            {"Insight:", "Indent-single"}, ¬
            {"Judgement:", "Indent-single"}, ¬
            {"Aware of abn", "Indent-double"}, ¬
            {"Attributes to i", "Indent-double"}, ¬
            {"Willing to acc", "Indent-double"}}
        repeat with k from 1 to (count styleHeadings)
            set {marker, styleName} to item k of styleHeadings
            set paragraph style of (paragraphs whose it begins with marker) to paragraph style styleName
        end repeat
        set italicHeadings to {"General appearance:", "Patient Attitude:", "Psychomotor Activity:", "Rapport:", ¬
            "Insight:", "Aware of abnormal phenomena:", "Attributes to Illness:", ¬
            "Willing to accept treatment:", "Judgement:"}
        repeat with findPhrase in italicHeadings
            set len to length of findPhrase
            tell (first paragraph whose it begins with findPhrase) to if exists then
                set italic of characters 1 thru len to true
                -- you can add other line to change properties of this paragraph or properties of specific word in this paragraph
            end if
        end repeat
        tell (paragraphs whose it contains "MENTAL STATE EXAMINATION" or it contains "Insight and Judgement") to if exists then
            set underline type to single underline
            -- you can add other line to change properties of these paragraphs or properties of specific word in these paragraphs
        end if
    end tell

  • Error in executing eCATT GUI Script

    Hi
    I am getting following error (in bold) while executing eCATT GUI Script. This happens only for GUI Scripts and not for TCD scripts. Please help me to solve this issue.
    <b>0000000195  Test Scrpt ZGUI_SCRIPT4 Version 1 - SECATT [Without Interruption]
    R01 800 SANDEEPK1 E 620 sapnw10 Windows NT MSSQL 26.05.2006 12:42:29
    ZGUI_SCRIPT4 [0,109 sec] Version 1 ZGUI_SCRIPT4
    Tgt System TEST_ECAT->ECATT_SAPNW10_800_E->T90CLNT090 (R01 800 ALEREMOTE E 620 sapnw10
    Windows NT MSSQL)
    Error in eCATT function SAPGUI
    Destination ECATT_SAPNW10_800_E RFC error
    service 'sapgw-1' unknown / CPI-C error CM_PRODUCT_SPECIFIC_ERROR.</b>
    Thanks in Advance.
    Regards,
    Sandeep K.

    Hi Sandeep,
        My self , Sreedhar D, working eCATT using SAPGUI recording.
        i think ur problem is resolved. Can u help for the below issue.
          Scenario:       
           And i working on testing server which does not have any trasaction, i have to record the transaction using RFC connection to different machine.
           I did all the that process and able to connect  remote machine.
          i started doing the recoding in SAPGUI after creation of sys. Data container by specifying RFC connection.
            I recorded the script, but when i try to execute the same this attached error r coming.
           But i recorded the same using TCD(Recorded) using remote connection and able to sucessfully execute.
           One more thing also, we used write the script for reading the test data from Excel and pass as parameters using TCD(Recording).
    Below is the error
         Target sys ECATT_SAPTD120_400_E_0002
         Destination ECATT_SAPTD120_400_E_0002 RFC Error
          Waiting for ur response. Thanks in Adavance.
    Sreedhar d

  • SAP GUI Scripting: Script Is Running.....Help!

    Hello all,
    I'm new to the forums and have an SAP question problem. I'm an end user of SAP and have been using it since 2002. A couple of weeks ago when I logged into SAP I noticed a red/white icon in the lower right corner of my screen. When I hover over it it says "SAP GUI Scripting: Script Is Running". The problem is, I have never created a script. When I start working in SAP I have noticed a lot of the screens have a different format now and I get a lot of ABAP errors.
    After doing some research I found under "Customize Local Layout", "Options" I can uncheck the box "Enable Scripting". I click "Apply" and "OK". Now the red/white icon goes away in the lower right corner and all my screens go back to normal with no ABAP errors.
    The problem now is that every minute or two I get a pop up window that says "Scripting support is disabled by the user".
    Has anyone else had this problem?
    1. I've never created a script. Why is one running now?
    2. Is there a way to stop the pop up message "Scripting support is disabled...." if I uncheck "Enable Scripting"?
    Thanks for any feedback

    Here's the properties of the connection....
    http://www.lstwo.com/images/97735141499811194923.jpg
    http://www.lstwo.com/images/27092678568585605702.jpg
    http://www.lstwo.com/images/02572789823840845106.jpg
    Here's the properties of the desktop icon....
    http://www.lstwo.com/images/36703668322706084468.jpg
    http://www.lstwo.com/images/40729387005252851113.jpg
    http://www.lstwo.com/images/48149337890555671928.jpg
    I agree, I'm stumped. I even tried looking through the SAP entries in my registry to see if I could find anything. It's a bit confusing but I didn't see anything out of place.

  • Documentation on GUI scripting

    I am looking for some detailed documentation on GUI scripting. I am trying to figure out the click command so that I may use it in fireFox.
    Robert

    Chances are, your problem isn't with click because its options are very straightforward:
    click
    click (verb)cause the target process to behave as if the UI element were clicked (from Processes Suite)
    function syntax
    set theResult to click UI element ¬
    at list
    result
    UI element
    direct parameter optional UI element The UI element to be clicked.
    at optional list when sent to a "process" object, the { x, y } location at which to click, in global coordinates
    The problem is more likely to be how to work out the UI Element you want to click. Many applications make this less than obvious since it's often an object in a pane of a window and you need to know all the parts. If that is the case, get a copy of Prefab's UI Browser which does all the hard work of working out the UI element.

  • Having trouble GUI scripting

    Hi there,
    I'm trying to script a small app called Deeper (that doesn't work natively with ascript).
    I tried GUI scripting with apple script editor but I'm not how it works so I put that aside and went trying with UI Element Inspector.
    So I'm trying to select something from a scroll menu, and then click a start button.
    What it does is it activates the Flurry screensaver as a background, but some bugs turn it off, so I wanted that by running this script, it would use Deeper to turn it back on without having to do it manually.
    I tried as best as I can to stick with the example given in the UIElementInspector page, but I am really a starter in scripting.
    First, I did:
    tell application "Deeper"
    activate
    end tell
    tell application "System Events"
    tell process "Deeper"
    tell menu "PopUpButton"
    But then I found out there was no way to distinguish that pop up menu from others (with UIElementInspector) other than by the size and location of the menu in the app.
    So first I'd need help finding out how to tell the script wich menu to go check in, and then probably stick with the example page.
    As you can see, I'll really trying to learn applescript from the start, because it looks so useful.
    Thanks to anyone for helping!

    You shouldn't need this:
    "open application file "Deeper.app" of folder "Applications" of startup disk"
    as this activates your app for you:
    "activate application "Deeper""
    activate application "Deeper"
    delay 1
    tell application "System Events"
    tell process "Deeper"
    click button "General" of tool bar 1 of window "Deeper"
    delay 0.5
    tell pop up button 4 of window "Deeper"
    click
    click menu item "Flurry" of menu 1
    end tell
    delay 0.5
    click button "Start" of window "Deeper"
    delay 0.5
    tell application "Finder"
    quit application "Deeper"
    end tell
    end tell
    end tell
    Budgie

  • Activate a session via Gui scripting

    Hi,
    how to activate an active SAP-session via Gui Scripting or maybe a workaround?
    There are some SAP sessions running and I want to activate a certain one of them.
    I tried to activate a session with:
    AppActivate session.findById("wnd[0]").Text
    but, as we know, if there are the same task names in Task Manager, the function will start any one of them.
    Any idea?
    Edited by: Stefan Benkö on Feb 9, 2009 7:07 AM

    Dear Casmir,
    I use the following code:
                suFound = False
                suError = False
                sgSystem = Trim(Cells(Target.Row, scSysCol))
                sgClient = Trim(Cells(Target.Row, scCliCol))
                sgUser = Trim(Cells(Target.Row, scUsrCol))
                sgPW = Trim(Cells(Target.Row, scPwdCol))
                suError = True
                suError = Not ssApplication
                If suError Then GoTo StopSub
                For Each suConnection In sgApplication.Connections
                    suSysName = suConnection.Description
                    If suSysName = sgSystem Then
                        For Each suSession In suConnection.sessions
                            suSysClient = suSession.info.client
                            If suSysClient = sgClient Then
                                AppActivate suSession.findById("wnd[0]").Text
                                'Aktive Instanz herausfinden, SID/Client checken
                                Set suAkt = sgApplication.ActiveSession()
                                suAktName = suAkt.Parent.Description
                                suAktClient = suAkt.info.client
                                If sgSystem <> suAktName Or sgClient <> suAktClient Then
                                    If Not suFound Then
                                        suFound = True
                                        AppActivate "Microsoft Excel"
                                        A = MsgBox(sgSystem & " - " & sgClient & "  NOT selectable", vbOKOnly + vbCritical + vbDefaultButton1, "SAP Automation")
                                    End If
                                Else
                                    suFound = True
                                End If
                                Exit For
                            End If
                            suSysClient = ""
                        Next
                    End If
                    If suFound Then Exit For
                    suSysName = ""
                Next
    As you can see, I got at that point all the necessary session and connection data.
    There are several SAP-Tasks open and what I want is to get a specific one as active window on my screen. That doesn't work if the sessions have the same Task-name, for instance "SAP Easy Access". Because Windos is not albe to find the right SAP-task - they have the same name - and it takes usally the wrong one of them. Thats my problem.
    Many Thanks for your Help

  • "Expand All Conversations" GUI Script-Mail

    Hi,
    I prefer to use the "Expand All Conversations" view in Mail, however, it doesn't automatically enable after you recieve new messages, so I wrote a GUI script 2 days that selects the "Expand All Conversations" menu (under View) in Mail and I then setup a rule (To Every Message-Run this script).
    My only problem is that now whenever I get a new email, the active program switches to Mail (which is extremely annoying, especially as I have assigned Mail to another Desktop!)
    Here is the script:
    tell application "Mail" to activate
    tell application "System Events" to tell process "Mail"
              tell menu bar 1
                        tell menu bar item "View"
                                  tell menu "View"
                                            click menu item "Expand All Conversations"
                                            tell menu "Expand All Conversations"
                                            end tell
                                  end tell
                        end tell
              end tell
    end tell
    Does anyone know a way to work around the "Activate Mail" line of this script, or another way of doing the same thing without using a script?
    Thanks.

    Actually, just avoid the first line:
    tell application "System Events" to tell process "Mail"
         tell menu bar 1
              tell menu bar item "View"
                   tell menu "View"
                        click menu item "Expand All Conversations"
                        tell menu "Expand All Conversations"
                        end tell
                   end tell
              end tell
         end tell
    end tell
    This can run in the background.

  • Adding *SAP Gui Scripting* in windows 2003

    Hi,
    we r devloped some z programs, and it is displayed properly in client desktp (XP). But it is not displyed properly in (OS) Windows 2003 server.
    So i added SAP Gui Scripting through Gui instalation and it displyed ok. But at same time my SAP Logon pad will hide from my desktop.
    So again i installed my SAP gui with
    1. SAP Gui Suite
    2. R/3 Add-on
    3. General Add-on
    Again same problem that is not visible when i am adding SAP Gui Scripting saplogon pad will automatically hide from my desktop.
    GUI version 7.10
    What could be resons?
    Regards
    Edited by: manoj nayak on Apr 6, 2010 9:51 AM
    Edited by: manoj nayak on Apr 6, 2010 10:18 AM

    Hi,
    Can u give more information how to troubleshot this one?
    And why after install (add) of SAP GUI SCRIPT SAP logon pad will automatically remove from desktop?
    Error:
    The system cannot find the file specified.
    Destination:
    C:\Program Files (x86)\SAP\FrontEnd\sapgui\wwi\wwilabel.exe
    Error-Code:
    2147024894
    Any idea?
    Regards.

  • GUI scripting question -am I sunk?

    Hi all,
    I am working on an Applescript to bring up two different non-Applescript-able applications (ie. ones w/o a dictionary) and am getting the error:
    NSReceiverEvaluationScriptError : 4 from Applescript.
    I have "Enable access for assitive devices" checked in SystemPreferences and am GUI scripting.
    Here's the snippet of code that gives the error:
    tell application "System Events"
    if UI elements enabled then
    activate application "TRx Recorder"
    tell button " Record " of tool bar 1 of window "TRx Recorder"
    click
    end tell
    end if
    end tell
    I generated the code "tell button ..." from the Prefab's UI Browser.
    I've tried clicking via the name of the button, and via the position of the button. Same error.
    Does this mean I'm sunk and can't get the app to respond to my Applescript?
    When I select the Action of button " Record " from within the UI Browser, it works fine.
    What am I doing wrong?
    Thanks!
    Ed

    Hi Camelot,
    Yes indeed I needed a "tell process ..." block, as well as, 2 extra spaces in the label for the Record button.
    I got the following to work:
    tell application "System Events"
    if UI elements enabled then
    activate application "TRx Recorder"
    tell process "TRx Recorder"
    click button " Record " of tool bar 1 of window "TRx Recorder"
    end tell
    end if
    end tell
    I dug around using UI Browser and discovered that I needed 2 blanks in front of and 2 blanks behind of the label "Record" to correctly access the button. I originally had 1 space in front of Record and 1 space after Record within the quotes. With only 1 space I get the Applescript error I mentioned. With 2 I don't get the error.
    Many thanks for the tip, it made me look closer at the labels of the buttons in UI Browser.
    Ed

Maybe you are looking for