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.

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.

  • 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]>

  • GUI scripting-select menu item in Mail's Styles popupbutton

    Hi,
    The following script complies without returning an error.
    In Mail, with a new message window displayed, the Styles sheet displayed (select Format>Style>Styles...), and the Favorite Styles radio button selected, the script below returns an error when it gets to the line "click pop up button item 'Bold'" (the menu does contain an item "Bold!").
    I'd prefer to select the menu item by name rather than by using keystrokes in the script because I will be adding styles to the Styles menu, which will result in changes in the numbering of items in that menu.
    Could someone please explain to me how to accomplish this?
    Thanks in advance!
    tell application "System Events"
    tell application process "Mail"
    tell first window
    tell first sheet
    tell first radio group
    tell radio button 2
    click
    end tell
    end tell
    tell pop up button 1
    click
    click pop up button item "Bold"
    end tell
    end tell
    end tell
    end tell
    end tell

    When you click the pop up button, the result is a menu, so you will need to click an item of that menu - for example:
    tell pop up button 1
          click
          click menu item "Bold" of menu 1
    end tell

  • 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

  • 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.

  • 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

  • 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

  • SAP GUI Scripting Wizzard Windows7 does not work

    Dear Experts,
    I am quite a novice when it comes to SAP GUI scripting (let alone any other development), therefore my question might be rather stupid. After my PC was migrated from XP to Windows 7 it is no longer possible to use the SAP GUI scripting wizzard. When you select it from the menue, simply nothing happens.
    Does anyone have an idea what I need to do to have this useful tool back on my PC?
    We are running SAP GUi 7.1
    Thanks for your help
    Theo

      Here is SAP GUI wizard replacement tool...its in auto IT - enjoy
    http://www.autoitscript.com/forum/topic/149540-sapwizardudf/
    I had the tech guys here install ,  the latest GUI patch level 15,
    and the script development tools not working issue has been fixed
    They (SAP?) removed the 'script development tools' menu option!?
    I have not installed the MS hotfix, but
    My question is,  it true the 'Script development tools' is gone?
    Other methods
    a) This (free) non SAP solution seems to work however...any other ideas?
    Scripting Tracker Lite
    http://scn.sap.com/docs/DOC-32728
    b) The Activate GuiXT tool in SAP GUI also does give you some clues in the element window
    and could be an alternative way , to get control names.
    eg a radio button is R[P_CONTROL_ID] when it should be radP_CONTROL_ID
    c) The SAP script recording and playback ,  to a vbs script will give you the control names also, if you edit the script.
    You must of course have GUI scripting on in rz11
    I can't read this note https://service.sap.com/sap/support/notes/1633639 - need a password!

  • 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.

  • Simple GUI script with a list

    Good day
    As my first Powershell project i'd like to write a script which will present to the user a GUI with a list of servers. The user then chooses a server and on click of the OK button connects to it with MSTSC. The window can look like this:
    Probably a script accomplishing a similar task already exists. Can you point it out? Also i'd like to learn more about developing specifically GUI scripts. Can you direct me to a source of information on that subject? A book maybe?
    Regards
    Kamil

    I know you want to learn how to build GUI, but what you asked for can actually be accomplished with just a few lines of code. The downside is you will not have any control over the layout.
    You can load the list of servers from CSV:
    $CSV = @"
    "Name","OperatingSystem","Description"
    "SERVER01","Windows Server 2008 R2","File Server"
    "SERVER02","Windows Server 2012 R2","Domain Controller"
    "SERVER03","Windows Server 2012","Print Server"
    $Servers = ConvertFrom-Csv $CSV
    $Servers | Out-GridView -Title "Select a server" -PassThru | Select Name |
    %{Start-Process "$env:windir\system32\mstsc.exe" -ArgumentList "/v:$($_.Name)"}
    Or you can get them directly from Active Directory:
    Get-ADComputer -Filter 'Name -like "SERVER*"' -Properties OperatingSystem, Description |
    Select Name, OperatingSystem, Description |
    Out-GridView -Title "Select a server" -PassThru | Select Name |
    %{Start-Process "$env:windir\system32\mstsc.exe" -ArgumentList "/v:$($_.Name)"}

  • 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.

  • Need help with GUI Scripting Audio Midi Setup

    I want to read the value of the sampling frequency set by default in Audio Midi Setup.
    If there is an easy unix way to gleen this, please let me know. Otherwise, I am trying to get it via GUI scripting. I think I am almost there, but am doing something stupid.
    Here is what I have:
    tell application "Audio MIDI Setup"
    activate
    end tell
    tell application "System Events"
    activate
    tell application process "Audio MIDI Setup"
    select window 1
    select group
    select tab group
    select group
    select combo box
    set FrequencyValue to contents of combo box
    end tell
    end tell
    Basically, this comes down to the question of how to extract the default text field from the combo box.

    Once you click on the combo box to get the list of items, you can do stuff with the results. The easiest thing would probably be to use the up and down arrows to change the selection, since the text field is not editable. You can compare the list of items with the current value and do something from there - how do you plan to choose the item to change to?
    <pre style="
    font-family: Monaco, 'Courier New', Courier, monospace;
    font-size: 10px;
    font-weight: normal;
    margin: 0px;
    padding: 5px;
    border: 1px solid #000000;
    width: 720px;
    color: #000000;
    background-color: #DAFFB6;
    overflow: auto;"
    title="this text can be pasted into the Script Editor">
    tell application "Audio MIDI Setup" to activate
    tell application "System Events" to tell application process "Audio MIDI Setup"
    set comboBox to combo box 1 of group 1 of tab group 1 of group 1 of window "Audio Devices"
    set frequencyValue to value of comboBox -- get current value
    click button 1 of comboBox -- perform action "AXPress" to drop the list
    set theChoices to value of text fields of list 1 of scroll area 1 of comboBox -- get all the values
    -- keystroke (ASCII character 31) -- down arrow
    -- keystroke (ASCII character 30) -- up arrow
    -- keystroke return -- select and dismiss the list
    end tell
    activate me
    choose from list theChoices default items {frequencyValue} -- just show the results
    </pre>

Maybe you are looking for