• 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: Robert Poland <email@hidden>
  • Date: Mon, 23 Nov 2015 09:16:46 -0700
  • Z-usanet-msgid: XID573TkwqqU1120X31

Thomas,

I had to add;
if myName does not contain “ƒ" then set the name of myFile to myName & "~ƒ" # don't add "ƒ" if it's already there

But, so far, I haven”t found a way to deal with an alias of a folder.

> On Nov 23, 2015, at 3:57:AM, Thomas Fischer <email@hidden> wrote:
>
> Hello Robert,
>
> I just looked at it again.
> My suggestion
>>> 	set myFile to the selection as alias
> is a rather crude way to get at the file. The problem is that the Finder's selection always is a list, and one should take its items to work on and not try to force it into an alias, which only works if there is only one element anyway.
>
> So you might be better of with this approach:
>
> tell application "Finder"
> 	set myList to the selection
> 	if the length of myList ≠ 0 then
> 		repeat with myFile in myList
> 			if the class of myFile is folder then
> 				set myName to the name of myFile
> 				set the name of myFile to myName & " ƒ"
> 			end if
> 		end repeat
> 	else
> 		# …
> 	end if
> end tell
>
>
> Best regards
> Thomas
>
>
>
> Am 22.11.2015 um 19:36 schrieb Robert Poland <email@hidden>:
>
>> Thanks Thomas,
>>
>> That gets me on a working path.
>>
>>> On Nov 22, 2015, at 11:03:AM, Thomas Fischer <email@hidden> wrote:
>>>
>>> Hello Robert,
>>>
>>> would something like
>>>
>>> tell application "Finder"
>>> 	activate
>>> 	set myFile to the selection as alias
>>> 	set myName to the name of myFile
>>> 	if length of myName ≠ 0 then set the name of myFile to myName & "ƒ"
>>> end tell
>>>
>>> achieve what you're looking for?
>>>
>>> Best regards
>>> Thomas
>>>
>>>
>>>
>>> Am 22.11.2015 um 18:38 schrieb Robert Poland <email@hidden>:
>>>
>>>>
>>>>> On Nov 22, 2015, at 10:10:AM, Yvan KOENIG <email@hidden> wrote:
>>>>>
>>>>>
>>>>>> Le 2015/11/22 à 18:05, Robert Poland <email@hidden> a écrit :
>>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> The line;
>>>>>> tell application “System Events” to keystroke “f” using {option down}
>>>>>>
>>>>>> gets me the Application ‘Searching “This Mac”’ rather than typing a Option f.
>>>>>>
>>>>>> What I’m trying to do is add an Option F to the name of a folder in a Finder window whose name is selected with the entry point set to the end of the name
>>>>>>
>>>>>> TIA.
>>>>>
>>>>> As you failed to tell it which process must be targeted, System Events send the keystroke to the frontmost one which appear to be the Finder.
>>>>>
>>>>> Use :
>>>>> tell application “System Events” to tell process "theProcessSupposedToTreatTheKeystroke"
>>>>> set frontmost to true
>>>>> keystroke “f” using {option down}
>>>>> end
>>>>>
>>>>>
>>>>> Yvan KOENIG (VALLAURIS, France) dimanche 22 novembre 2015 18:10:50
>>>>
>>>> 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
>>>>
>>>>
>>>> Robert Poland
>>>> Fort Collins, CO
>>>>
>>>>
>>>> _______________________________________________
>>>> 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
>>>
>>> _______________________________________________
>>> 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
>>
>> Robert Poland
>> Fort Collins, CO
>>
>
> _______________________________________________
> 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

Robert Poland
Fort Collins, CO


 _______________________________________________
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>)
 >Re: Keystroke question (From: Robert Poland <email@hidden>)

  • Prev by Date: Re: AppleEvents: Send port for process has no send right, port=( port:37207/0x9157 rcv:1,send:0,d:0 limit:5) (findOrCreate()/AEMachUtils.cp #526)
  • Next by Date: Re: Keystroke question
  • Previous by thread: Re: Keystroke question
  • Next by thread: Re: Keystroke question
  • Index(es):
    • Date
    • Thread