From: Tom Stiller on
In article <i2tdbq$ksi$1(a)news.eternal-september.org>,
Wes Groleau <Groleau+news(a)FreeShell.org> wrote:

> On 07-29-2010 20:57, aRKay wrote:
> > Jim Gibson<jimsgibson(a)gmail.com> wrote:
> >> [snip]
> >>
> >> Script follows:
> >>
> >> #!/usr/bin/perl
> >> #
> >> # rename
> >> #
> >> # perl script to rename files
> >> #
> >> # Usage:
> >> #
> >> # rename perlexpr [files]
> >> #
> >>
> >> ($op = shift) ||
> >> die
> >> "Usage: rename perlexpr [filenames]
> >> where perlexpr is any perl expression that modifies \$\_:
> >> 's/old/new/'
> >> '\$\_ .= \".ext\"'
> >> 'tr[A-Z][a-z]'\n";
> >>
> >> if( !@ARGV ) {
> >> @ARGV =<STDIN>;
> >> chop( @ARGV );
> >> }
> >> for( @ARGV ) {
> >> $was = $_;
> >> eval $op;
> >> die $@ if $@;
> >> rename($was,$_) unless $was eq $_;
> >> }
> >
> > You guys are both over my head. I was hoping there was on OS X hack
> > that would replace the saved Screen shots with _ rather than a space.
>
> Use TextEdit or something similar to create a file.
> Make the _first_ line the
>
> #!/usr/bin/perl
>
> from Jim's script (right after "Script follows")
>
> continue copying to the very last
>
> }
>
> in Jim's post.
>
> Save as whatever name makes sense to you in the directory with the
> screen shots. I would use
>
> Rename_Screen_Shots
>
> In Terminal, figure out how to get into the directory with the screen
> shots and the new file, then make the file executable with
>
> chmod a+x Rename_Screen_Shots
>
> Then run the file with this command:
>
> ls Screen* | Rename_Screen_Shots

Or you can attach the script to the folder as a "Folder Action" to have
it automatically executed whenever an item is placed in the folder.

Right (or Option) click on the folder and select "Folder Actions Setup…"
from the "Services" item and then select the appropriate script to add.

--
Tom Stiller

PGP fingerprint = 5108 DDB2 9761 EDE5 E7E3 7BDA 71ED 6496 99C0 C7CF
From: David Empson on
aRKay <arkay(a)nospam.qsl.net> wrote:

> I exchange email with a number of unix users and my Mac
> OS X Screen shot file names are causing them extra work
>
> How can I hack 10.6 so it sends something like
> this
>
> Screen_shot_2010-07-29_at_3.26.13_PM
>
> rather than this
>
> Screen shot 2010-07-29 at 3.26.13 PM
>
> How can I ditch the spaces

One manual option (more Mac-friendly than Perl) would be to use
Automator to set up an application which renames files dropped onto it.

1. Run Automator (in /Applications).

2. Choose to create an application.

3. In the list of actions on the left, select the "Files & Folders"
category.

4. In the list of file/folder actions (second column), double-click
"Rename Finder Items". It will ask if you want to add a "Copy" action.
Choose "Don't Add".

5. You will now have a rename action in the workflow on the right side,
initially showing "Add Date or Time". Click on that popup menu and
choose "Replace Text".

6. In the Find field, enter a single space. In the Replace field, enter
an underline.

7. Use the Save command to save it on the desktop, call it something
like "Rename screen shots".

You can now drag and drop any screen shots onto the application and they
will be renamed with all spaces in the name changed to underlines.


Here is a variant which might be better:

- You can use TinkerTool to change the folder used to save screen shots.

- You can use Automator to create a folder action to a specific folder
when files are added to that folder. You could set up the same action as
above on the folder into which screen shots are saved, resulting in them
being renamed automatically.

--
David Empson
dempson(a)actrix.gen.nz
From: Jolly Roger on
In article <arkay-284617.15303129072010(a)news.eternal-september.org>,
aRKay <arkay(a)nospam.qsl.net> wrote:

> I exchange email with a number of unix users and my Mac
> OS X Screen shot file names are causing them extra work
>
> How can I hack 10.6 so it sends something like
> this
>
> Screen_shot_2010-07-29_at_3.26.13_PM
>
> rather than this
>
> Screen shot 2010-07-29 at 3.26.13 PM
>
> How can I ditch the spaces

Mac OS X stores this as a localizable string that you can change. You'll
need to edit this file as root (use sudo):

/System/Library/CoreServices/SystemUIServer.app/Contents/Resources/Englis
h.lproj/Localizable.strings

Look for an entry like this:

/* Format screencapture file names */
"%@ %@ at %@" = "%1$@ %2$@ at %3$@";

Chang it to:

/* Format screencapture file names */
/* "%@ %@ at %@" = "%1$@ %2$@ at %3$@"; */
"%@ %@ at %@" = "Screen_shot_%2$@_at_%3$@";

Note: The system will automatically append " n" (where n is a number
starting with 1) to the file name if a file of the exact same name
already exists. You can't change that space into an underscore AFAIK.

--
Send responses to the relevant news group rather than email to me.
E-mail sent to this address may be devoured by my very hungry SPAM
filter. Due to Google's refusal to prevent spammers from posting
messages through their servers, I often ignore posts from Google
Groups. Use a real news client if you want me to see your posts.

JR
From: Jolly Roger on
In article <jollyroger-4C8FD2.09484331072010(a)news.individual.net>,
Jolly Roger <jollyroger(a)pobox.com> wrote:

> In article <arkay-284617.15303129072010(a)news.eternal-september.org>,
> aRKay <arkay(a)nospam.qsl.net> wrote:
>
> > I exchange email with a number of unix users and my Mac
> > OS X Screen shot file names are causing them extra work
> >
> > How can I hack 10.6 so it sends something like
> > this
> >
> > Screen_shot_2010-07-29_at_3.26.13_PM
> >
> > rather than this
> >
> > Screen shot 2010-07-29 at 3.26.13 PM
> >
> > How can I ditch the spaces
>
> Mac OS X stores this as a localizable string that you can change. You'll
> need to edit this file as root (use sudo):
>
> /System/Library/CoreServices/SystemUIServer.app/Contents/Resources/Englis
> h.lproj/Localizable.strings
>
> Look for an entry like this:
>
> /* Format screencapture file names */
> "%@ %@ at %@" = "%1$@ %2$@ at %3$@";
>
> Chang it to:
>
> /* Format screencapture file names */
> /* "%@ %@ at %@" = "%1$@ %2$@ at %3$@"; */
> "%@ %@ at %@" = "Screen_shot_%2$@_at_%3$@";
>
> Note: The system will automatically append " n" (where n is a number
> starting with 1) to the file name if a file of the exact same name
> already exists. You can't change that space into an underscore AFAIK.

Also, you can issue these commands to change other aspects of screen
captures:

defaults write com.apple.screencapture name "New Name"
killall SystemUIServer

defaults write com.apple.screencapture location "~/Path/To/New/Location/"
killall SystemUIServer

defaults write com.apple.screencapture type [new format]
killall SystemUIServer

If you use the first one, then you would probably want to change the
localizable strings setting to something like:

/* Format screencapture file names */
/* "%@ %@ at %@" = "%1$@ %2$@ at %3$@"; */
"%@ %@ at %@" = "%1$@_%2$@_at_%3$@";

--
Send responses to the relevant news group rather than email to me.
E-mail sent to this address may be devoured by my very hungry SPAM
filter. Due to Google's refusal to prevent spammers from posting
messages through their servers, I often ignore posts from Google
Groups. Use a real news client if you want me to see your posts.

JR
From: Jolly Roger on
In article <jollyroger-4C8FD2.09484331072010(a)news.individual.net>,
Jolly Roger <jollyroger(a)pobox.com> wrote:

> In article <arkay-284617.15303129072010(a)news.eternal-september.org>,
> aRKay <arkay(a)nospam.qsl.net> wrote:
>
> > I exchange email with a number of unix users and my Mac
> > OS X Screen shot file names are causing them extra work
> >
> > How can I hack 10.6 so it sends something like
> > this
> >
> > Screen_shot_2010-07-29_at_3.26.13_PM
> >
> > rather than this
> >
> > Screen shot 2010-07-29 at 3.26.13 PM
> >
> > How can I ditch the spaces
>
> Mac OS X stores this as a localizable string that you can change. You'll
> need to edit this file as root (use sudo):
>
> /System/Library/CoreServices/SystemUIServer.app/Contents/Resources/Englis
> h.lproj/Localizable.strings
>
> Look for an entry like this:
>
> /* Format screencapture file names */
> "%@ %@ at %@" = "%1$@ %2$@ at %3$@";
>
> Chang it to:
>
> /* Format screencapture file names */
> /* "%@ %@ at %@" = "%1$@ %2$@ at %3$@"; */
> "%@ %@ at %@" = "Screen_shot_%2$@_at_%3$@";
>
> Note: The system will automatically append " n" (where n is a number
> starting with 1) to the file name if a file of the exact same name
> already exists. You can't change that space into an underscore AFAIK.

Note that because this is a protected system file, future system updates
may change this value!

--
Send responses to the relevant news group rather than email to me.
E-mail sent to this address may be devoured by my very hungry SPAM
filter. Due to Google's refusal to prevent spammers from posting
messages through their servers, I often ignore posts from Google
Groups. Use a real news client if you want me to see your posts.

JR