2.p. comes after 2.1. because 1 is ASCII 49 and p is ASCII 112
if you hide the extension then 2.13 comes after 2.1
I haven’t heard about a way to rename the screenshots on-the-fly unless you use directly the shell (there you have to type the filename ;))
But probably you can work around using a folder action or a droplet
Renaming a screencapture to yyymmdd only would only give you one screencapture name per day. I have a shell script that i use that uses the time also. This script was on MacScripter some time ago. I put the script on my dock and it is there just a click away.
I hope this is what you are looking for.
PolishPrince
do shell script "DATE=`date '+%Y-%h-%d-%H-%M-%S'`;
FILE=~/Desktop/${DATE}.png;
screencapture -i $FILE"
ty Stefan i realized a folder action would be the easiest…
and ty PolishPrince u are right it has to include the hhmmss…
on adding folder items to this_folder after receiving these_items
repeat with an_item in these_items
tell application "Finder"
set file_name to name of an_item
set file_ext to name extension of an_item
if file_name starts with "Picture" and file_ext is "png" then
set png_path to my getSafeName()
tell me to renameToDate(an_item, png_path)
end if
end tell
end repeat
end adding folder items to
on getSafeName()
set desk_path to (path to desktop as Unicode text)
set base_name to my formatDate(get current date)
try
alias (desk_path & base_name & ".png")
set i to 0
repeat
set i to i + 1
set path_to_check to (desk_path & base_name & "-" & i & ".png")
try
alias path_to_check
on error
set png_path to path_to_check
exit repeat
end try
end repeat
on error
set png_path to (desk_path & base_name & ".png")
end try
return png_path
end getSafeName
on renameToDate(png_file, png_path)
tell application "Image Events"
launch
set image_ref to open png_file
save image_ref in png_path as PNG with icon
close image_ref
delete png_file
end tell
end renameToDate
on formatDate(date_obj)
set c_year to year of date_obj as integer
set c_month to month of date_obj as integer
set c_day to day of date_obj as integer
set c_hour to (time of date_obj) div 3600
set c_min to ((time of date_obj) mod 3600) div 60
set c_min to text -2 through -1 of ("0" & c_min) as string
set c_sec to ((time of date_obj) mod 3600) mod 60
set c_sec to text -2 through -1 of ("0" & c_sec) as string
set am_or_pm to the last word of (date_obj as string)
set c_date to (c_year & "-" & c_month & "-" & c_day & " " & c_hour & "." & c_min & "." & c_sec & " " & am_or_pm) as string
return c_date
end formatDate
So i just attached this to the desktop, and when u sceencap it renames it in realtime (or at least once a second). It would be even cooler if it were set to 24hr time but i’m not sure i want to take the time to figure that out. :lol:
.
set base_name to my formatDate(get current date)
.
on formatDate(date_obj)
set c_year to year of date_obj as integer
set c_month to month of date_obj as integer
set c_day to day of date_obj as integer
set c_hour to (time of date_obj) div 3600
set c_min to ((time of date_obj) mod 3600) div 60
set c_min to text -2 through -1 of ("0" & c_min) as string
set c_sec to ((time of date_obj) mod 3600) mod 60
set c_sec to text -2 through -1 of ("0" & c_sec) as string
set am_or_pm to the last word of (date_obj as string)
set c_date to (c_year & "-" & c_month & "-" & c_day & " " & c_hour & "." & c_min & "." & c_sec & " " & am_or_pm) as string
return c_date
end formatDate
with
set base_name to do shell script "date -n +%Y-%m-%d\\ %H.%M.%S"
Cindysenyurt
Sorry, i just noticed that my script would do the month with a name instead of a number. I am resending it with correction and in 24 hour format. This script is the same as if you would press Command-Shift-4. Your cursor will change to the crosshair and ready to capture your screencapture. Your screencapture will then be put on the desktop.
Again , hope this is what you were looking for.
Polishprince
do shell script "DATE=`date '+%Y-%m-%d-%H-%M-%S'`;
FILE=~/Desktop/${DATE}.png;
screencapture -i $FILE"