Hi All–
I can’t seem to figure out what I think should be simple:
I need to have a filename that looks like this:
-73209_-106557_some_interesting_text.hr._-001.jpg
However when I use this code:
export front movie to (exportFolder & exportPrefix & “some_interesting_text.hr" & “…” & "-0”) as image sequence using settings alias “Export-JPG-15fps.settings”
I get this:
-73209_-106557_some_interesting_text.hr.01.jpg
And not this:
-73209_-106557_some_interesting_text.hr._-001.jpg
likely 31 charactor name limit. Its a UNIX thing not a finder thing. Put extra info in the comment field, still can be searched by spotlight. Calculate the name first, check the length, if over do something about it.
Get in image sequence first (if you can), pad the zeros yourself. Drop of … and _ is strange. Your example does get up around the 31 limit, have you tried shorting to see?
Worst just use the standard name like “image1.jpg”, “image2.jpg” and rename them in the Finder after they are created. Wouldn’t slow the script to much. I could show you a quick way to do that. You would get the result you want and that the goal.
Post a more fuller, working example if you like some help. Best to solve the problem than have a work around.
I can’t change the file name or remove _ or - they have meaning.
I also can’t really use the finder to rename the files before or after export because I have more then a million files to process and the finder gives up!
The way the code is now it produces this name:
-73209_-106557.hr.01.jpg
and I want this:
-73209_-106557.hr._-001.jpg
Thanks, again.
on open droppedItems
tell application "QuickTime Player"
activate
close every window
end tell
set ASTID to AppleScript's text item delimiters
repeat with thisItem in droppedItems
set AppleScript's text item delimiters to "_"
get name of (info for thisItem without size)
try
set exportPrefix to (text items 2 thru -1 of result) as text
on error
set exportPrefix to result
end try
--set AppleScript's text item delimiters to {""}
tell application "Finder"
try
--This is the location of the exported files, "VolumeName(mydisk):Folder(Users):Folder(robertl):Folder(Desktop):Folder(Exports):"
make new folder at alias "mydisk:Users:robertl:Desktop:Exports:" with properties {name:(exportPrefix)}
set exportFolder to result as Unicode text
on error errorMsg number errorNum
display dialog "Error (" & errorNum & "):" & return & return & errorMsg buttons "Cancel" default button 1 with icon caution
end try
end tell
tell application "QuickTime Player"
open thisItem
-- Code for figuring out the frame rate of the move
tell movie 1
set totalduration to duration
set NumberOfFrames to (count frames of track 1)
set timeScaleOfMovie to the time scale
end tell
set FPS to round NumberOfFrames / (totalduration / timeScaleOfMovie)
if (can export front movie as image sequence) then
try
--This scales the movie in half, 50%. We can do many things....we should be able to test the framerate and then switch export setting....
--resize front movie by 50
--This is the location of the settings files, "VolumeName(mydisk):Folder(Users):Folder(robertl):Folder(Desktop):Export-JPG-15fps.settings" Settings files are made with another script called "save_settings.scpt" and should have meaningful names
if FPS > 10 then
export front movie to (exportFolder & exportPrefix & ".hr.._-0") as image sequence using settings alias "mydisk:Users:robertl:Desktop:Downloads:Export-JPG-15fps.settings"
else
export front movie to (exportFolder & exportPrefix & ".hr.._-0") as image sequence using settings alias "mydisk:Users:robertl:Desktop:Downloads:Export-JPG-15fps.settings"
end if
on error errorMsg number errorNum
display dialog "Error (" & errorNum & "):" & return & return & errorMsg buttons "OK" default button 1 with icon caution
end try
else
display dialog "QuickTime Player can't export "" & (thisFile as Unicode text) & "" as an image squence." buttons "OK" default button 1 with icon caution
end if
close front movie
end tell
end repeat
set AppleScript's text item delimiters to ASTID
quit application "QuickTime Player"
end open
Still think renaming the answer, use unix may help then it not deal with all the finder issues. I’ve got a folder with 10,000+ folder (website requirement) and using the finder to create new folder take 5 minutes (on a remote server), and with UNIX a second.
Since you can’t control the image sequence number. You would have to export in parts (selected range), select frame 1-9 and use 00# then 10-99 and use 0## and so on.
The missing underscore a mystery, maybe it samething like the period. Try puting a underscore on end too.
Your script if FPS > 10 does the same thing either way, likely just a typo for our example.