Replace chars in a save dialog?

Replace chars in a save dialog?

Postby bobqk2013 » Sun May 12, 2013 11:04 am

I'd like to be able to replace spaces with underscores in save dialogs (in any app). I'm not aware of any programmatic way to do this -- the only thing I can think of is possibly to create an AppleScript that is triggered by QK, but even then, I don't know if AS could cut it. I already have a Finder renamer app, so I can do the mods after the fact, but it would be useful to do the renaming up front. thanks
bobqk2013
 
Posts: 6
Joined: Sun May 12, 2013 10:58 am

Re: Replace chars in a save dialog?

Postby gb2 » Mon May 13, 2013 10:55 am

this should do what you want:

steps:
1) Type Text of command-c to copy file name that is selected
2) an AppleScript Script Text with this copied into it:
Code: Select all
set theText to the clipboard
set {tid, AppleScript's text item delimiters} to {AppleScript's text item delimiters, " "}
set {temp, AppleScript's text item delimiters} to {text items of theText, "_"}
set {theText, AppleScript's text item delimiters} to {temp as text, tid}
set the clipboard to theText

3) Type Text of command-v to paste in the converted text over the previous file name

you will of course have to make sure you have the file name selected before this shortcut is executed.
User avatar
gb2
Site Admin
 
Posts: 2875
Joined: Mon Feb 06, 2006 6:22 pm

Re: Replace chars in a save dialog?

Postby Mark Cowan » Mon May 13, 2013 1:41 pm

gb2, that’s pretty neat. Maybe even add (in QuicKeys) before your step 1:

Type Text of Command-A

to make sure that all of the filename is selected before the rest of it starts. :o
User avatar
Mark Cowan
 
Posts: 2
Joined: Fri Dec 09, 2011 2:21 pm


Return to QKM General Discussion

Who is online

Users browsing this forum: No registered users and 5 guests

cron