• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Keystroke question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Keystroke question


  • Subject: Re: Keystroke question
  • From: Steve Mills <email@hidden>
  • Date: Sun, 22 Nov 2015 12:10:22 -0600

> On Nov 22, 2015, at 11:38, Robert Poland <email@hidden> wrote:
>
> Here’s the entire script. It still gets ‘Searching “This Mac”.
>
>
> (* test, with Finder item selected and ready for editing name. *)
> tell application “Finder”
>    activate
>    set x to selection
>    if length of x ≠ 0 then
>        tell application "System Events" to tell process "Finder"
>            set frontmost to true
>            keystroke "f" using {option down}
>        end tell
>    else
>        tell application "Mail" to activate
>        delay 1
>        repeat 1 times
>            tell application "System Events"
>                keystroke "f" using {option down}
>            end tell
>        end repeat
>    end if
> end tell

So you're trying to insert an option-f into a file name? If the insertion location is always at a certain location—e.g. the end of the name—then this seems like a really hacks approach. It would be more clear cut if you changed the value of the property you're trying to change, such as:

tell app "Finder"
    set n to name of item 1 of selection
    set AppleScript's text item delimiters to {"."}
    set parts to every text item of n
    set item 1 of parts to (item 1 of parts) & "f"
    set name of item 1 of selection to (parts as text)
end tell

Not tested, just typed on my iPad. And Apple neglected to allow users to easily type option-f in iOS, so it's just a regular f in this sample.

Steve via iPad


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden


References: 
 >Keystroke question (From: Robert Poland <email@hidden>)
 >Re: Keystroke question (From: Yvan KOENIG <email@hidden>)
 >Re: Keystroke question (From: Robert Poland <email@hidden>)

  • Prev by Date: Re: Keystroke question
  • Next by Date: Re: Keystroke question
  • Previous by thread: Re: Keystroke question
  • Next by thread: Re: Keystroke question
  • Index(es):
    • Date
    • Thread