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.

Similar Messages

  • How do I use AppleScript keystroke command as a speakable item?

    I am attempting to do what I thought was a rather simple task, but have not had success.
    I would like to use the following script as a voice command to speak selected text in a file, opened for example by Preview, when the key is pressed.
    tell application "System Events" to keystroke "." using control down
    I have placed the script application in the System Preferences, Speech, Speakable Items Folder.  The item is being recognized; however, it appears that it is not functioning in the correct window context.  I would like this to work regardless of the application text (hence the Text to Speech option).  How do I set this up before the keystroke command in the script?
    As an aside, is there a way to convert a script file to a SpeakableItems.app document file?

    I am not sure if this is what you are looking for.
    But have you saved the below workflow as a Service and use a keyboad shortcut?
    I have this as a Service and my keyboard short cut is Command-Shift T.
    Once I select a paragraph in Preview and press the short cut it speaks the text for me.
    Maybe you already thought of this. But here you go.

  • How do i eject  a disc  thru  keystroke command

    hi..  could  you tell me   how do i eject  a disc  thru  keystroke command ?     thanks  jackie

    Press the Eject key, or open the Finder, select it, and press the Command and E keys.
    (114928)

  • Does anyone know the apple script or unix command in ARD that allows me to send keystroke commands to computers on my ARD network ? thanks !

    I am trying to cue computers through keystroke commands using ARD
    I want to know a unix shell or script command to hit keystrokes on my ARD machines.
    EXAMPLE... I want machine X  to press the letter K.
    I am also wondering if you can send multiple commands doing this , multiple keystrokes with built in delays
    Thank you

    Welcome,
    I use the "System Events" handler, e.g.:
              tell application "System Events" to delay 5.5
              tell application "System Events" to keystroke "K"
              tell application "System Events" to delay 0.5
              tell application "System Events" to keystroke return
    Regards,
    Shawn

  • How to start iSQL*Plus configuration Assistant on Command Line?

    I have almost successfully installed oralce 10gR2 in opensolaris 5.11, In the final stage, Among the three Configuration Assistants:
    the Net Configuration Assistant and Database Configuration Assistant have completed successfully, but OUI hang in the iSQL*Plus Configuration Assistant.
    No response after a very long time.
    Could anybody tell me how to manually start iSQL*Plus configuration Assistant on Command Line?
    Thanks a lot !
    Edited by: user11970554 on 2009-10-5 上午9:21

    Thanks.
    Anyhow, I found an easier way to do this:
    1)Just run installer again to start the OUI:
    #./runInstaller
    2)Choose "Custom" installation option
    3)check the box at "iSQL*Plus" for reinstall
    4)The OUI will first deinstall iSQL*Plus, and then reinstall it, and will automatically start "iSQL*Plus configuration Assistant".
    This procedure applies to any component of oracle which failed at first time installation.

  • Keystroke command for e-mail address

    Is there a way to create a keystroke command (macro) that would insert my e-mail address in a window requesting an e-mail address?

    >System Preferences>Keyboard>Keyboard Shortcuts  is the extent of customization on the Mac.
    however you have limited options here.
    Try something like TextExpander
    http://smilesoftware.com/TextExpander/index.html

  • Compaq sr1320nx /win xp after keystroke/command, the system is very slow 10-15 secs. before response

    after keystroke/command, the system is very slow 10-15 secs. before response

    What I've done is that I reinstalled 10.8.1 and each time, I ran disk utilitiy.  It has helped but fter a while, especially when waking up from sleep, EVERY app can take a lot of time to come up, including those already activated.  Every click would take at least 5secs to respond... and then the spinning ball comes up.
    It's only after the same app was used, then it would be smooth.  For example, I run my cursor down to the bottom of the screen where my dock is hidden.  It would take a few times of running down before the dock shows up.  From that point on, it would would work nicely unless I click on any of those apps in the dock.  Then, it would take another 5secs or more before something shows on the screen such as clicking on Mail.  It takes more than 5secs before mail pops up.  Then, when I click on any mailbox, it would take another 5secs or the spinning ball comes up.  From that point on, clicking on Mail is smooth and cicking on the same mailbox is smooth unless I click on a different mailbox or go to preferences, for example.
    So, I keep running disk utility almost everyday and now, it works 99% of the time.  If it slows again, I run the disk utility.  I guess that's the way to go until they come up with a proper fix.
    All this housekeeping work reminds me of Windows and the endless defragging and optimising.  That was one of the few reasons why I switched to Apple and now...
    Dear Mr Steve Jobs, please send some enlightenment to your Apple teams!

  • Keystroke command to close all apps (without restart or shutdown):

    Hate to ask what is probably a simple issue, but I can't find a keystroke command that will close all open apps without restart or shutdown... just close everything that is open and let me continue or shut the lid to sleep ...
    Anyone know one? or a way to do a command in iKey?
    thanks,
    tom

    Tom Oconnell wrote:
    Hate to ask what is probably a simple issue, but I can't find a keystroke command that will close all open apps without restart or shutdown... just close everything that is open and let me continue or shut the lid to sleep ...
    Anyone know one? or a way to do a command in iKey?
    thanks,
    tom
    logout will do this. Of course you have to log in again afterwards, but it will kill all user-related processes.

  • 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

  • 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

  • Instrument I/O Assistant (sending command from labview to arduino)

    Hi,
    I am a beginner in Labview. I would like to control the intensity of AC loads using labview. In this case, i would prefer to use instrument I/O assistant. The instrument I/O assistant in labview will have to send a command to Arduino. The intensity will be controlling by using slider in labview. How to write the vi for this example? Please advice.

    feliciacpw92 wrote:
    Hi,
    I am a beginner in Labview. I would like to control the intensity of AC loads using labview. In this case, i would prefer to use instrument I/O assistant. The instrument I/O assistant in labview will have to send a command to Arduino. The intensity will be controlling by using slider in labview. How to write the vi for this example? Please advice.
    In the thread for your other post, you were told that LabVIEW installs by default example programs on how to use LabVIEW with serial port.
    Have you bothered looking at that?
    You need to do some work on your own.

  • Applescript "go to" command or pull variables from script?

    Is there a "go to line" command in Applescript?  I want to be able to create a dialog box to jump back to the previous box if a mistake was made.  I don't want to do a repeat because that will cause multipule chained repeats and it won't work.  I tried creating seperate scripts and that works fine for jumping around within the program.  But the variables get lost when a new script is ran.  is there a way to bring variables from other scripts into one script?

    This is what I have right now.  as you can see there are 3 variables that carry the needed info.  U
    ltimatley I'd like to have about 8 variables, all with different info. 
    I can do a repeat for each one until something is entered, but I cant do a back command for each entry. 
    That's the purpose for the "run 'script'" line in each section.  I'd have to do a repeat inside of a repeat and then overlapping repeats. 
    It won't let me do overlapping repeats.  what's the solution?
    run script fn
    script fn
              set first_name to ""
              set fName to display dialog "first name" default answer "" buttons {"cancel", "next"} default button "next"
              set first_name to text returned of fName
              if first_name = "" then
      run fn
              end if
    end script
    -- Last Name
    run script ln
    script ln
              set last_name to ""
              set lName to display dialog "last name" default answer "" buttons {"back", "cancel", "next"} default button "next"
              if button returned of lName = "next" then
                        set last_name to text returned of lName
              else if button returned of lName = "back" then
      run fn
              end if
              if last_name = "" then
                        run ln
              end if
    end script
    -- street number
    run script sn
    script sn
              set s_num to ""
              set sNum to display dialog "street number" default answer "" buttons {"back", "cancel", "next"} default button "next"
              if button returned of sNum = "next" then
                        set s_num to text returned of sNum
              else if button returned of sNum = "back" then
                        run ln
              end if
              if s_num = "" then
                        run sn
              end if
    end script
    -- ready steady write!
    display dialog first_name & last_name & s_num

  • How to run an applescript using unix command

    Hi All,
    Can any one help me in giving me the command for running an apple script thru postupgrade shell file in other words i wana run an apple script while running my new installer that will upgrade the old version of application but while installing i want to run an applescript so as i know ill have to give that applescript path in the postupgrade script but how to run it while installation and where to keep it (is it postupgrade). May be in short how can i run apple script thru unix command.

    Use the osascript command.
    In my installer, I use the DropDMG program to build my DMG disk image. It doesn't quit automatically, so I have to do the following:
    osascript -e "tell application \"DropDMG\" to quit"
    Type "man osascript" for more information.

  • HT4818 Is there a keystroke command to print a window in Windows 7 running on Boot Camp?

    Is there a print window keystroke or key command similar to the fn/shift/f11 print screen keystroke that works in Windows 7 running on Boot Camp 4.0? Thank you.

    Hi,
    You may print using the CTRL + P key combination on any Windows based PC.
    Shlomi

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

Maybe you are looking for

  • Cannot capture dv footage from canon ax h1 on final cut pro

    hi there, i shot a wedding over the summer on a canon ax h1, which belonged to the bride and i didn't have much experience with it. i shot the whole wedding, and now when i went to capture the footage the audio and video are not showing up. there is

  • 7.0.5 sdk insert pages always fails

    I've tried a few different variations, but I can't figure out what I'm doing wrong. Below is some C# code I have written to parse through a series of controls that represent one page of a previously opened PDDoc (pdDoc). I know that pdDoc loads corre

  • Inet4AddressImpl.lookupAllHostAddr(String) hangs/blocks

    I'm experiencing a hang when attempting to establish a socket connection. Debugging indicates the VM is blocked here: Inet4AddressImpl.lookupAllHostAddr(String) line: not available [native method] I'm experiencing this problem during an ANT build. In

  • HT6400 10.9.5 update defected my MacBookPro8,1 SATA controller

    Dear all, I have a MacBookPro8,1 with an Sandisk 256G Ultra SSD instead the HDD (the HDD is moved to the DVD bay). It worked nice for a half a year, but after this update on friday I could not access the SSD. DiskUtility sees only the HDD. SSD via ex

  • Looking for Solution manager SMI310_04 material

    Can anyone please send me the solution manager material SMI310_04. I really appreaciate your help on this. I have an assignment at my work place to configure the SM.