Re: I've changed the name of a file...
Re: I've changed the name of a file...
- Subject: Re: I've changed the name of a file...
- From: Paul Berkowitz <email@hidden>
- Date: Fri, 03 Nov 2000 15:23:32 -0800
On 11/3/00 2:48 PM, "Richard 23" <email@hidden> wrote:
>
> In Smile, all I have to do is press the F5 key, which I've set to type
>
>
>
> set AppleScript's text item delimiters to
>
>
Now that's a good idea. I've noticed that (in MacOS 9) you can assign
>
to the function keys. (How could I not? Every time I accidentally hit
>
one, it would open the Keyboard control panel.) But it looks like you
>
assign applications or documents, not keystrokes or strings but I may
>
be able to hack something together to use them in Script Editor like
>
you do in Smile.
I do it differently. In Smile I write a script which (implicitly, actually)
tells Smile, as you would in any text editor:
set selection of window 1 to "set AppleScript's text item delimiters to
"
(That's the whole script, no tell block needed). Then I assign a keyboard
shortcut to it by adding '/5' to the saved compiled script's name, and
putting it in Smile's "User Scripts" folder (internal script menu folder).
That sets the keyboard shortcut to command-5. But Smile has an added feature
that keyboard shortcuts consisting of numbers can also be called with a
single F-key of the same number. Hence, F5.
My favorite of my own Smile scripts is one where I can select a file,
folder or whole set of files in the Finder, go back to my Smile script,
press F6, and the pathname to the single file/folder, or a list of all of
them, just appears in the script. The only thing I haven't been able to
avoid using the Finder for, so far, is 'selection', so there it is.
tell application "Finder"
set theSelection to the selection
set ls to {}
repeat with i from 1 to (count theSelection)
set theFile to item i of theSelection
set end of ls to theFile as alias as string
end repeat
end tell
set {ods, AppleScript's text item delimiters} to {AppleScript's text item
delimiters, {"\", \""}}
tell window 1
if (count of ls) = 1 then
set the selection to "\"" & ls & "\""
else
set the selection to "{\"" & ls & "\"}"
end if
end tell
set AppleScript's text item delimiters to ods
--
Paul Berkowitz