Applescript repeat keystroke

How do i make it so this will repeat automatically forever until i stop it manually?
set L1 to "1"
set L2 to "2"
tell application "Safari" to activate
tell application "System Events" to tell process "Safari"
keystroke L1
delay 2
keystroke L2
end tell

Camelot - I thought the same (as you); but, followed 'to the letter' the originator's request.
'loo[' - thank you. Nice to know others, on occasion, strike an incorrect key ...

Similar Messages

  • Aluminium keyboard sending repeat keystrokes/not recognised during startup

    hi everyone, my first post here,
    i recent purchased an additional slimline alu-keyboard for my imac to customise as an editing keyboard for logic pro. only problem is i appear to be having issues with it. recently it has been sending repeat keystrokes in os x. it's not one of the letter keys because no text is typed onscreen. the other issue is that during startup none of the boot-up keys are recognised (ie. reset pram combination/bootup menu) with leads me to belive something is very wrong.
    i have already tried reseting the pram - although i had to use my other keyboard to do this as the new one isn't recognised. i also tried reseting the smc but it seems certain that there is an issue with the keyboard itself
    the keyboard is still well within warranty and i have my receipt but i'm concerned about the fact that it has been customised with a editing layout set and might not be replaced
    hope someone can suggest something!
    thanks
    j

    ps. i just did a little further googling and it seems to be suggest that this is a 10.5.6 usb related issue

  • Applescript for Repeated Keystroke

    Hey Everyone,
    First, I'm brand new to Applescript, so this may be a very obvious answer.
    I want to create a script that will enter the keystrokes "enter, tab, tab, command+V, enter, down" repeatedly, or for a certain amount of times.  I'm basically looking for a way to automate some copy/paste data entry.
    Thanks for any help you can offer!

    AppleScript is a programming language that is tied to certain Applications that support it. Pages v5.5.1 has a scripting dictionary of the terms it will support via AppleScript. Apple's answer to not including Mail Merge functionality in Pages v5.5.1 is for individual users to roll their own, download an example and adapt it, or use another application with built-in Mail merge features.
    See my previous post to you.

  • Using Applescript to make a repeatedly keystroke

    Hi, I am wondering if there's another place where this thread would be morewellplaced, but couldnt find anything about Applescripting, so here goes:
    I dont know if this is possible, but i would like to have a key pressed repeatedly - all the time - while i am playing World of Warcraft on my mac.
    I am playing in windowed mode - this means not in full screen.
    In the game i have bound a certain action to the button "0" (zero).
    I need to have this key repeatedly pressed every second or so.
    Is this possible with applescript? And how would the script look?
    Hope someone can help me
    Kind regards

    Hi,
    Thx for the suggestion
    I tried using this script. It didnt really do anything "inside" the game, other that my movements behaving strangely. I think it was running outside the game and kind of interfering in some manner.
    I then tried to make an extra line in the script myself:
    activate application "World of Warcraft"
    I dont really know what it does, but it sounded like it maybe would press the key inside the actual game (in the right application window)... but this didnt work either.
    So i may have to give up unless someone know something more about this.

  • Applescript Chrome Keystroke switch windows

    Hi guys,
    maybe someone can help me to complete this command. I´m going crazy....
    I Have 2 Chrome windows and i want to switch the active focus between them by pressing the following keys:
    cmd + shift + `  ( ` = shift + ´ )
    I m tryinig to do this command by using the applescript keytroke command. But i do not find the error..... it won t work
    tell application "System Events"
    -- switch window focus
    keystroke "´" using {command down, shift down}
    end tell
    Thank you for your help !

    Thx for response.
    i tried this code, but it only refreshes 1 of the two open chrome windows. The crazy Party is, that at window open script the swith between the two open windows is working ...... I give you my open Chrome Browser with 2 windows on different screens in fullscreen Mode script and my Browser refresh script. May you have a better look with the complete code.... i m frustrated
    refresh of the two Browser windows
    repeat 2 times
        tell application "Google Chrome"
            set index of window 2 to 1
        end tell
        tell application "System Events"
            keystroke "r" using {command down}
        end tell
        tell application "System Events" to delay 5
    end repeat
    Open 2 Browser windows on different Screens
    tell application "System Events" to delay 5
    tell application "Google Chrome"
        --Open new Window on Position
        --List item 1: {72, b,c ,d }
        --The distance in pixels from the left side of the screen to the left side of the Finder window.
        --List item 2: {a, 90, c, d}
        --The distance in pixels from the top of the screen to the top of the Finder window.
        --List item 3: {a, b, 512, d}
        --The distance in pixels from the left side of the screen to the right side of the Finder window.
        --List item 4: {a, b, c, 481}
        --The distance in pixels from the top of the screen to the bottom of the Finder window.
        set aWin to make new window with properties {mode:"normal", bounds:{0, 0, 1000, 1000}}
        tell window 1
            set URL of active tab to "http://www.apple.com"
        end tell
        --Set Fokus on 2nd Window and close
        tell application "Google Chrome"
            set index of window 2 to 1
        end tell
        tell window 1 to close
        tell application "System Events" to delay 7
        set aWin to make new window [1] with properties {mode:"normal", bounds:{1082, 0, 1800, 1000}}
        tell window 1
            set URL of active tab to "http://www.macrumors.com"
        end tell
        tell application "System Events" to delay 10
        tell application "System Events" to tell process "Google Chrome"
            perform action "AXRaise" of window 1
        end tell
    end tell
    --Make Them Fullscreen
    repeat 2 times
        tell application "Google Chrome"
            set index of window 2 to 1
        end tell
        tell application "System Events" to tell process "Google Chrome"
            perform action "AXRaise" of window 1
        end tell
        tell application "System Events"
            keystroke "f" using {command down, shift down}
        end tell
        tell application "System Events" to delay 5
    end repeat

  • Applescript help - keystroke part does not work

    Hi guys, I'm new to Applescript and would like some assistance. I have an application called iVPN that I would like to start with some applescript code - just one problem in that it requires the admin password at startup.
    I tried the following, but once the dialogue box appears to enter the password, nothing happens. It seems to stop just before the "delay 10" line. I've also tried it with just the keystroke line, but nothing happens (no password appears in the dialogue box that pops up).
    Any help greatly appreciated, Thanks!.
    tell application "iVPN" to open
    tell application "System Events"
    delay 10
    key code 48 using {command down}
    keystroke "password here"
    key code 36
    end tell

    I had you download the wrong file.
    The new name is XTool-2.0.dmg.tgz Notice the missing src.
    I simplified the example applescript file. You need to write your applescript file as needed.
    The basic plan for you is to move the mouse to the button then click the button.
    --Move mouse to input field.
    move mouse {100, 10} 
    click mouse
    --fill in the data.
    --move mouse & click button
    move mouse {120, 10} 
    click mouse
    Robert
       First, there is the XTools scripting addition, which will give AppleScript the ability to move the mouse. 
       Dowload from:
          http://www.lestang.org/osax/XTool/
       click on:
          XTool-2.0.dmg.tgz 
       Installation :
       Drag XTool.osax from insite the image to one of the following locations (create the directory if it does not exist) :
       a : ~/Library/ScriptingAdditions/
       b : /Library/ScriptingAdditions/
       c : /System/Library/ScriptingAdditions/
       I have it in directory /System/Library/ScriptingAdditions/ 
       My other two directories do not exit: ~/Library/ScriptingAdditions/ & 
          /Library/ScriptingAdditions/
       see download file XTool ReadMe.rtf for documentation
    log "  --- Starting on " & ((current date) as string) & " --- "
    set {x, y} to position of the mouse
    display dialog "mouse at " & x & " " & y giving up after 3
    display dialog "Move mouse to where you want to find coordinates, you have five seconds." giving up after 5
    set {x, y} to position of the mouse
    beep
    display dialog "New mouse position at " & x & " " & y giving up after 5
    -- Go after time message
    move mouse {10, 10}
    delay 5
    -- click mouse
    -- center mouse
    -- find the size of the display with a unix command
    do shell script "/usr/sbin/system_profiler SPDisplaysDataType | grep 'Resolution'" -- get info
    tell the result to set {DisplayWidth, DisplayHeight} to {word 2, word 4} -- get resolution
    move mouse {DisplayWidth div 2, DisplayHeight div 2} -- center mouse
    Message was edited by: rccharles

  • Run applescript on keystroke

    I have a script which I would like to invoke at will via keystrokes. Is there a simple way to do this with or without (preferably without) using third-party programs? My specific application involves a script that moves messages in Mail. Thanks!

    You appear to expect 'System Preferences' 'Keyboard & Mouse's 'Keyboard Shortcuts' to perform as a 'launcher' application. It is not. It is used to (re)assign menu item keyboard equivalents, and nothing else.
    To launch an application or AppleScript script (or applet) consider 'QuicKeys' (commercial)*, 'Butler' (freeware)*, and / or 'Spark' (freeware), to name a few. Other launchers, other links'.
    * - I personally use and like.

  • How can I keep AppleScript repeat resetting Safari in the background?

    I want to have an AppleScript which resets Safari every 10 seconds. Now I got a problem with repeating the script. After the script resets Safari it closes the app. I want to keep Safari open while the script is operating in the background.
    That was my try:
    =================
    tell application "Safari" to launch
              tell application "Safari" to activate
              tell application "Safari" to open location "http://www.apple.com"
    repeat
              tell application "Safari" to close every window
              try
                        tell application "Safari" to quit
              on error errmsg
                        display dialog "Safari App beenden gescheitert" with icon caution
              end try
              try
                        do shell script "rm -f ~/Library/Safari/history.plist"
              on error errmsg
                        display dialog "history.plist löschen gescheitert" with icon caution
              end try
              try
                        do shell script "rm -f ~/Library/Safari/HistoryIndex.sk"
              on error errmsg
                        display dialog "HistoryIndex.sk löschen gescheitert" with icon caution
              end try
              try
                        do shell script "rm -f ~/Library/Caches/com.apple.Safari/Cache.db"
              on error errmsg
                        display dialog "Cache.db löschen gescheitert" with icon caution
              end try
              try
                        do shell script "rm -rf ~/Library/Caches/Metadata/Safari/History"
              on error errmsg
                        display dialog "History löschen gescheitert" with icon caution
              end try
              try
                        do shell script "rm -f ~/Library/Cookies/Cookies.plist"
              on error errmsg
                        display dialog "Cookies.plist löschen gescheitert" with icon caution
              end try
              try
                        do shell script "rm -f ~/Library/Safari/LastSession.plist"
              on error errmsg
                        display dialog "LastSession.plist löschen gescheitert" with icon caution
              end try
              try
                        do shell script "rm -f ~/Library/Safari/TopSites.plist"
              on error errmsg
                        display dialog "TopSites.plist löschen gescheitert" with icon caution
              end try
              try
                        do shell script "rm -rf ~/Library/Caches/com.Apple.Safari/*"
              on error errmsg
                        display dialog "Safari Cache löschen gescheitert" with icon caution
              end try
              try
                        do shell script "rm -f ~/Library/Caches/Adobe/Flash Player/AssetCache"
              on error errmsg
                        display dialog "Flash Player AssetCache löschen gescheitert" with icon caution
              end try
              try
                        do shell script "rm -rf ~/Library/Preferences/Macromedia/Flash*/macromedia.com/support/flashplayer/sys/ #*"
              on error errmsg
                        display dialog "Flash Player macromedia.com löschen gescheitert" with icon caution
              end try
              try
                        do shell script "rm -rf ~/Library/Preferences/Macromedia/Flash*/#SharedObjects/*"
              on error errmsg
                        display dialog "Flash Player #SharedObjects löschen gescheitert" with icon caution
              end try
      delay 10
    end repeat
    =================
    PS: The dialogues are in German… But that shouldn't be a problem

    You can use the applescript Script Menu to run scripts in Photoshop (or any application).
    If you don't have it installed, run the AppleScript Utility.app (find it in the Applescript folder in your applications folder) and make sure the 'Show Script Menu in menu bar' is checked.
    Edit: I thought you'd be able to use this with an action by inserting a menu item, but apparently it doesn't recognize the appescript menu.

  • Applescript assistance keystroke command

    Hi guys,
    I have written this script but for some reason the like keystroke command w does not work as in it doesn't close the eye tv window. Is there somthing that I have missed. I dont want to quit the app but just close its windows.
    if application "EyeTV" is running then
              tell application "Finder"
                        set visible of process "EyeTV" to true
              end tell
              tell application "System Events"
                        tell application "EyeTV" to activate
                             keystroke "W" using command down
                  end tell
              tell application "Finder"
                        set visible of process "EyeTV" to false
              end tell
    end if
    tell application "XBMC"
      activate
    end tell

    try this:
    if application "EyeTV" is running then
              tell application "System Events"
                        tell process "EyeTV"
                                  set visible to true
                                  set frontmost to true
                                            keystroke "W" using command down
                                  set visible to false
                        end tell
              end tell
    end if
    tell application "XBMC"
      activate
    end tell
    your use of tell blocks was overly complex.

  • Applescript to start, stop and repeat background screensaver

    HI.
    I am very neww to applescript.
    Please help me fix this applescript?
    I get the error:
    "Can’t make current application into type string."
    This is my applescript
    repeat
      do shell script
                        "/System/Library/Frameworks/ScreenSaver.framework/Resources/ScreenSav erEngine.app/Contents/MacOS/ScreenSaverEngine -background &> /dev/null &"
                        delay 300
                        tell application "ScreenSaverEngine" to quit
      delay 1
    end repeat
    Much appreciated!

    Got it! Obivously a rookie mistake
    repeat
              do shell script "/System/Library/Frameworks/ScreenSaver.framework/Resources/ScreenSaverEngine.a pp/Contents/MacOS/ScreenSaverEngine -background &> /dev/null &"
              delay 300
              tell application "ScreenSaverEngine" to quit
      delay 1
    end repeat

  • Pages '09: Can't use AppleScript for selected text inside tables?

    When I run get selection on selected text in a Pages document, I get something like this:
    <pre>text from character 1 to character 4 of body text of document id 9943974 of application "Pages"</pre>
    When I run get selection on selected text inside a table cell in a table in a Pages document, I get something like this:
    <pre>text from character 1 to character 4 of some table of document id 3539679 of application "Pages"</pre>
    When I run get selection on selected text inside a table cell in ANOTHER table in the same Pages document, I get the exact same thing. It still says "some" table. So there is no way to distinguish between tables if there are more than one table in the same Pages document.
    Am I correct in understanding that this means that most AppleScript commands for manipulating text are unusable inside table cells?
    For example, it seems impossible to get the properties of the selection when the selection is selected text inside "some" table. So it's impossible do anything about text styles, etc.
    Is AppleScript support in Pages ’09 really that limited, or am I missing something?

    The first script below should return the character style of any selection made in Pages ’09, whereas the second script should apply the "XXX" character style to any selection:
    --BEGINNING OF SCRIPT 1
    tell application "Pages"
    activate
    tell application "System Events" to tell process "Pages"
    -- Show the format bar:
    if not (pop up button 1 of window 1 exists) then
    click menu item "Show Format Bar" of menu 1 of menu bar item "View" of menu bar 1
    end if
    -- Show the styles drawer and character styles:
    if menu item "Show Styles Drawer" of menu 1 of menu bar item "View" of menu bar 1 exists then
    keystroke "t" using {shift down, command down}
    end if
    tell front window
    tell checkbox 1 of group 1 of drawer 1 -- “Show or hide character styles.” checkbox
    repeat until it exists
    delay 0.1 -- wait until the styles drawer is open
    end repeat
    if description is "show character style" then click
    end tell
    -- Get the row index (although it is not a property) of the character style:
    tell menu button 2 -- “Choose a character style.” menu button
    click
    set k to 0
    repeat
    set k to k + 1
    if value of attribute "AXMenuItemMarkChar" of menu item k of menu 1 exists then exit repeat
    end repeat
    keystroke return -- hide the menu
    end tell
    -- Get the character style name:
    if k > 1 then set k to k + 1
    value of static text 1 of row k of outline 1 of scroll area 2 of splitter group 1 of group 1 of drawer 1
    end tell
    end tell
    end tell
    --END OF SCRIPT 1
    --BEGINNING OF SCRIPT 2
    set myStyle to "XXX" -- the name of the character style you want to apply
    tell application "Pages"
    activate
    tell application "System Events" to tell process "Pages"
    -- Show the format bar:
    if not (pop up button 1 of window 1 exists) then
    click menu item "Show Format Bar" of menu 1 of menu bar item "View" of menu bar 1
    end if
    -- Show the styles drawer and character styles:
    if menu item "Show Styles Drawer" of menu 1 of menu bar item "View" of menu bar 1 exists then
    keystroke "t" using {shift down, command down}
    end if
    tell front window
    tell checkbox 1 of group 1 of drawer 1 -- “Show or hide character styles.” checkbox
    repeat until it exists
    delay 0.1 -- wait until the styles drawer is open
    end repeat
    if description is "show character style" then click
    end tell
    set characterStyles to value of static text 1 of rows of outline 1 of scroll area 2 of splitter group 1 of group 1 of drawer 1
    set k to 0
    repeat with thisStyle in the characterStyles
    set k to k + 1
    if thisStyle as text is myStyle then exit repeat
    end repeat
    -- Apply the character style:
    if k > 1 then set k to k - 1
    click menu button 2 -- “Choose a character style.” menu button
    click menu item k of menu 1 of menu button 2
    end tell
    end tell
    end tell
    --END OF SCRIPT 2
    I suppose that +paragraph styles+ should work the same.
    I'm beginning to know Pages ’09 a little better now.
    Message was edited by: Pierre L. (show format bar)

  • How to avoid system events "ignoring" lines in applescript?

    Hello!
    I am trying to write a very simple script that will trigger macros on another application, however when the script is executed, it skips a couple of lines which makes the whole process go erratically.
    This is the code i'm using:
    tell application "Adam"
      activate front window
    end tell
    tell application "System Events"
      keystroke "4"
              repeat 10 times
              end repeat
      keystroke return
      keystroke (ASCII character 47)
              keystroke "tell test"
      delay 1
      keystroke return
      keystroke (ASCII character 36)
      keystroke "t"
      keystroke (ASCII character 36)
      delay 2
      keystroke return
    end tell
    The red lines are the ones that seem to be neglected somehow (keystroke "4" doesnt carry the expected action in application "Adam"). I'm a newbie at applescripting but i fail to see why this might be happening
    Any help is of course greatly appreciated

    Hi Arthur!
    Tried your solution without much success, after some playing around i found out changing the command to use any other keystroke (e.g. - ) actually made the script work as intended, although it also implied changing the macro trigger (4 to - ) in application Adam.
    repeat 10 times
    keystroke "-"
    end repeat
    Lately I've been testing with other applications and found out this "ignore" behaviour happens mostly when you use numbers for keystrokes, perhaps there is al alternate way of inputting these?
    Thanks for your and everyone's help

  • Applescript/Pages and adjusting column width (and paragraph style)

    I was hoping that some someone might know how to adjust the width of individual columns in Pages using Applescript. It seems like it should be a simple task, and I can adjust the overall width/height of the table, but I haven't found a way to adjust the column width. Alternatively, I could have the program create the table in Numbers and copy/paste it into Pages, but I'd imagine that would get a bit messy and wouldn't allow me to use a hanging indent in the cells (to the best of my knowledge).
    Also, is there a way to adjust the paragraph style used by the text in the table? Otherwise, I could just use a templet and define the the default table style appropriately. (Though not the most elegant solution).
    Thanks in advance for your help!
    (In case it helps, the script I'm working on parses an unformatted inventory and parses it into paragraphs/tables.)

    Try this:
    set tableCount to 0
    --open file to be pased here, excluded for example
    tell application "Pages"
        activate
        set theDoc to (make new document)
        tell theDoc
            --makes paragraph styles used
            make new paragraph style with properties {name:"Folio", font name:"Times New Roman", font size:12, bold:true, alignment:left, space after:5, keep with next paragraph:true, space before:15}
            make new paragraph style with properties {name:"Place", font name:"Times New Roman", font size:12, bold:false, alignment:left, line spacing type:relative, line spacing:100}
            make new paragraph style with properties {name:"Description", font name:"Times New Roman", font size:12, bold:false, italic:true, alignment:left, line spacing type:relative, line spacing:100}
            make new paragraph style with properties {name:"Table", font name:"Times New Roman", font size:12, alignment:left, left indent:0.5, first line indent:0.0}
            --begin repeat, gathers MS info from one doc (unformatted) and writes it into another with formatting, setting variables directly for example
            set MSName to "new Manuscript"
            set MSPlace to "place where MS is stored"
            set MSDesc to "description of MS"
            set tableData to {{"folio", "title", "composer"}, {"", "subtitle", ""}, {"etc", "next", "next"}}
            --write paragraph information from earlier
            set currentPar to (make new paragraph at end of paragraphs with data MSName)
            set paragraph style of currentPar to "Folio"
            set currentPar to (make new paragraph at end of paragraphs with data MSPlace)
            set paragraph style of currentPar to "Place"
            set currentPar to (make new paragraph at end of paragraphs with data MSDesc)
            set paragraph style of currentPar to "Description"
            --create table, add data, and format
            tell application "System Events" to tell process "Pages"
                key code 125 using {command down} -- move the insertion point to the end
                tell menu bar 1
                    -- Insert a new table:
                    click menu item "Table" of menu 1 of menu bar item "Insert"
                    -- Delete the header row:
                    tell menu 1 of menu bar item "Format"
                        click menu item "Delete Row" of menu 1 of menu item "Table"
                    end tell
                    -- Show the Inspector:
                    tell menu 1 of menu bar item "View"
                        if menu item "Show Inspector" exists then
                            click menu item "Show Inspector"
                        end if
                    end tell
                end tell
                tell window 1 -- the Inspector window
                    click radio button 7 of radio group 1 -- select the Table Inspector
                    perform action "AXRaise" -- activate the Table Inspector
                    tell tab group 1 of group 1
                        click radio button "Table" -- select “Table”
                        -- Reduce width of all three columns:
                        repeat 3 times
                            set value of text field 2 to "0.5 in"
                            set focused of text field 2 to true
                            keystroke return
                            keystroke tab -- next column
                        end repeat
                        key code 126 -- the Up Arrow
                        -- Set width of each column:
                        repeat with theValue in {"0.75 in", "4.25 in", "1.5 in"}
                            set value of text field 2 to theValue
                            set focused of text field 2 to true
                            keystroke return
                            keystroke tab -- next column
                        end repeat
                        key code 126 -- the Up Arrow
                    end tell
                end tell
                keystroke "i" using {option down, command down} -- hide the Inspector
                -- Add the data:
                repeat with i from 1 to 3
                    set thisRow to item i of tableData
                    repeat with j from 1 to 3
                        keystroke (item j of thisRow)
                        if (i * j = 9) then exit repeat
                        keystroke tab
                    end repeat
                end repeat
            end tell
            set tableCount to tableCount + 1
            tell table tableCount
                select
                set stroke width to 0.0
                set wrap to center
                set name to MSName
            end tell
            --after which it would continue with the next MS and repeat the process until all are done
        end tell
    end tell

  • How to update popup (drop down) cells in Numbers using Applescript

    I understand that the list popups (dropdown lists in cells) cannot be dynamic in Numbers.
    I have the same dropdown list in multiple cells and tables, and this list often needs to be changed. Its not practical to amend one list, then copy/paste it into 200 plus cells that require the dropdown facility (they are not in sequential rows).
    Can Applescript be used to do the copy/paste function, as i could specify the cell ranges. My simple attempt only managed to copy/paste the cell values rather than the dropdown/popup list.
    Any constructive help would be appreciated.
    Thanks.

    Hi Hiroto,
    I have this script running, with one issue.
    set tValues to my doThis(1) -- get values of the selection
    if tValues is not "" then
      activate
              display dialog "Select the cells where you want to create the PopUp." & return & "After that, click on the 'OK' button."
              my doThis(tValues) -- set the cell format of the new selection to "PopUp Menu" and set the values of the each menu item
              tell application "Numbers" to display dialog "Done"
    else
              tell application "Numbers" to display dialog "You must select the cells in a table before running this script."
    end if
    on doThis(n)
              tell application "Numbers"
                        set tTables to (tables of sheets of front document whose its selection range isnot missing value)
                        repeat with t in tTables -- t is a list of tables of a sheet
                                  if contents of t is not {} then -- this list is not empty, it's the selected sheet
                                            set activeTable to (get item 1 of t)
                                            if n = 1 then return value of cells of selection range of activeTable-- return values of the selection
                                            set format of (cells of selection range of activeTable) to pop up menu -- set the format to pop up menu
                                            return my setValuePopUp(n) -- set value of each menu item
                                  end if
                        end repeat
              end tell
              return ""
    end doThis
    on setValuePopUp(L)
              tell application "System Events"
                        tell process "Numbers"
                                  set frontmost to true
                                  delay 0.3
                                  set inspectorWindow to missing value
                                  set tWindows to windows whose subrole is "AXFloatingWindow"
                                  repeat with i in tWindows
                                            if exists radio group 1 of i then
                                                      set inspectorWindow to i
                                                      exit repeat
                                            end if
                                  end repeat
                                  if inspectorWindow is missing value then
      keystroke "i" using {option down, command down} -- Show Inspector
                                  else
      perform action "AXRaise" of inspectorWindow -- raise the Inspector window to the front
                                  end if
                                  delay 0.3
                                  tell window 1
      click radio button 4 of radio group 1 -- the "cell format" tab
                                            delay 0.3
                                            tell group 2 of group 1
                                                      set tTable to table 1 of scroll area 1
                                                      set tc to count rows of tTable
                                                      set lenL to (count L)
                                                      if tc < lenL then -- ** add menu items **
                                                                repeat until (count rows of tTable) = lenL
      click button 1 -- button [+]
                                                                end repeat
      keystroke return -- validate the default name of the last menu item
                                                      else if tc > lenL then -- ** remove menu items **
                                                                repeat while exists row (lenL + 1) of tTable
                                                                          select row (lenL + 1) of tTable
      click button 2 --  button [-]
                                                                end repeat
                                                      end if
                                                      tell tTable to repeat with i from 1 to lenL -- ** change value of each menu item **
                                                                set value of text field 1 of row i to item i of L
                                                      end repeat
                                            end tell
                                  end tell
                        end tell
              end tell
    end setValuePopUp
    ==============================
    When the popup is created, if there is one header row, it adds "1" to the list of popup items, if there are two header rows, it adds "1", "2" to the list of popup items. What should i amend to remove this (i have two header rows in my sheet).
    I would ideally like to add a "-" to the list (to represent nothing selected in the cell) as default i.e. top of the list (i could add the symbol to my source data but that would look untidy). At the moment, after running the script all cell values change to 1.
    Oh, what would the best way to modify the script so it selects a specific cell range? At the moment i have to first select a column, then run the script, then select the source cells, then click ok on the dialog box before it does the magic.
    Someone else will be running the script, and if its easy to change, i would prefer to have an absolute source cell range values so the user can just rund the script without any selection required.
    If you can advise on this, that would be most helpful.

  • How to press a button on a webpage in safari using applescript?

    Hi I am new using the applescript so I am learning about it
    I am right now trying to make one with a webpage
    http://nycserv.nyc.gov/NYCServWeb/NYCSERVMain
    I want to press a button and I can't get to it
    this is what I have until now:
    tell application "Safari"
    activate
              open location "http://nycserv.nyc.gov/NYCServWeb/NYCSERVMain"
              click button "Go"
    end tell
    Please help me with this. At least with the button "GO" then I will figure it out to finish the rest
    thanks

    You might like to experiment with something like this:
    tell application "Safari"
        activate
        set URL of tab 1 of window 1 to "http://nycserv.nyc.gov/NYCServWeb/NYCSERVMain"
        delay 5
        beep 2
        tell application "System Events"
            repeat with CounterA from 1 to 10
                keystroke tab
                delay 0.5
            end repeat
            keystroke return
        end tell
    end tell
    It is a bit rough, but it works on my system (Mac OS X 10.4.11, G5, Safari 4.1.3).
    The intial delay of 5 seconds is to give the page a chance to load - you might need to increase that. The 2 beeps are to give an audible indication of when the rest of the script starts so, if the page hasn't fully loaded, then you know to increase the delay by a few more seconds. (There is a way of somehow checking the page and/or its contents so that the rest of the script will start only once the page has "settled down". I don't know how to do that, but it would make the delay unnecessary and removes the problem of a slow connection taking longer to load the page than normal.)
    The repeat loop sends the tab keystroke 10 times - on my system that's how many presses of the tab key it took to move the "focus" from the URL to the Go button after the "Parking/Red Light..." button. The return keystroke selects that Go button (same as clicking on it), which should then take you to the next page. The 1/2 second delays are there so you can see where things are moving.
    That's as far as I got. Hopefully it will give you a start. You might need to experiment a fair bit to find out if your version of Safari behaves the same way with emulated key-presses using the keystroke command in AppleScript (done from within System Events). When I sent 9 tabs instead of 10 (so that the "Parking/Red Light..." button is highlighted, sending the down arrow keystroke ( keystroke (ASCII character 31) ) made the drop-down menu appear.
    Sorry I can't give more info, but this should get you going. There are probably much better, more reliable and more efficient ways of doing this but sometimes the quick-and-dirty methods fit the bill enough to do the job.

Maybe you are looking for

  • How can i set a path for my deployment files in weblogic server 10.3

    Hi How can i set the path for my WAR ,JAR files while deploying.i am using the wls10.3 version. is there any scripts for this ,please provide me. my Application is ADF 11g application.

  • ORA-06502 when calling from a procedure

    HI, I have a procedure(p1) inside a package that queries a table and send out the result based on the input paramater value. OUT variable is of same type as the table column(using %type), column size is varchar2(4000). This procedure is called from a

  • XSLT construct "for each" not working in transformation

    Hi everyone I am using for each inside a transformation it was working fine until added parameters.After included parameters "for each" is not happening the db is invoked only once even if there are muliple nodes. can anyone help me on this issue. Ho

  • Message about registry setting and burning cds

    Whenever I open itunes on my PC with Windows Vista, I get a messa that says: "The registry settings used by the iTunes drivers for importing and burning CDs and DVDs are missing. .....Please reinstall iTunes." I have reinstall it 4 times and I still

  • Quality of imported LiveType .movs

    Why is imported LiveType low quality when I input into FCE, when it is fine before importing and opening it in quicktime. It goes really grainy once it is placed into my sequence? Have I got the settings wrong. I chose the Apple Int. Codec and  HDV10