Skip navigation

applescript assistance keystroke command

1162 Views 5 Replies Latest reply: Nov 28, 2012 3:31 PM by kap_australia RSS
kap_australia Level 1 Level 1 (0 points)
Currently Being Moderated
Nov 27, 2012 11:31 PM

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


iMac, Mac OS X (10.7.4)
  • Jiri Krecek Level 4 Level 4 (1,080 points)
    Currently Being Moderated
    Nov 27, 2012 11:36 PM (in response to kap_australia)

    Hmm,

    do I understand it correctly that you want to close the EyeTV window, but not close the app by using the COMMAND_W?

     

    In the script, you are setting the command in the block where you are launching EyeTV, shouldn't it be in the block below where you tell FInder to hide EyeTV?

     

    I'm confused.

  • twtwtw Level 5 Level 5 (4,580 points)
    Currently Being Moderated
    Nov 28, 2012 3:51 AM (in response to kap_australia)

    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.

  • Jacques Rioux Level 4 Level 4 (1,925 points)
    Currently Being Moderated
    Nov 28, 2012 6:57 AM (in response to kap_australia)

    Hi,

     

    kap_australia wrote:

     

    Hi guys,

     

    I have written this script but for some reason the like keystroke command w does not work

     

    This does not work because the "W" is a uppercase character, you must use a lowercase character

     

     

    This will work:

     

     keystroke "w" using command down
    

Actions

More Like This

  • Retrieving data ...

Bookmarked By (0)

Legend

  • This solved my question - 10 points
  • This helped me - 5 points
This site contains user submitted content, comments and opinions and is for informational purposes only. Apple disclaims any and all liability for the acts, omissions and conduct of any third parties in connection with or related to your use of the site. All postings and use of the content on this site are subject to the Apple Support Communities Terms of Use.