I try and try ever and ever but for me AppleScript and somehow Automator are like Chines Language for me.
To have a workaround for the lack of iMove not exporting a Project to Firewire, I need to make either a folder script or automator script to do the following workflow.
As iMovie is NOT scriptable the workflow should start after a *.dv file is exported into a specific folder.
Workflow:
1.) iMovie does export a project as *.dv file into a specific folder “Export to DV-Cam”. (Started manually in iMovie)
2.) After iMovie is finished, the *.dv file will be passed over to the application “SimpleVideoOut X”.
3.) “SimpleVideoOut X” will open the file passed over from the finder and will do its work.
4.) After “SimpleVideoOut X” has finished its work (Application closed), the previously handled *.dv file will be moved into a folder “Exported Files” inside the folder “Export to DV-Cam”.
I understand that I have to rewrite the existing folder action script “add - new item alert” but the problems start with the point to get the name/path of the new *.dv file and the pass it over to “SimpleVideoOut X”. The next thing is how to get the message that “SimpleVideoOut X” has been closed and that the previously handled *.dv file can be moved into a new location.
I’m thankful for everyones response with Tips/Notes/Informations/Links/…
I don’t use SimpleVideoOut X, so I couldn’t test this,
hope it helps
property exportFolder : "disk:path:to:Export to DV-Cam:Exported Files:"
on adding folder items to this_folder after receiving these_items
set theMovie to item 1 of these_items
checkStableSize(theMovie) -- wait until the file has been saved completely
tell application "Finder" to open theMovie using application "SimpleVideoOut X"
delay 5
tell application "System Events"
repeat while exists process "SimpleVideoOut X"
delay 2
end repeat
end tell
tell application "Finder" to move theMovie to folder exportFolder
end adding folder items to
on checkStableSize(myFile)
set F to quoted form of POSIX path of myFile
set sizeThen to first word of (do shell script "du -d 0 " & F)
delay 10 -- seconds (set to longer if needed)
set sizeNow to first word of (do shell script "du -d 0 " & F) as integer --coercing to integer fixes the quote problem
return (sizeNow - sizeThen = 0)
end checkStableSize
Danke für Deine Rückmeldung und die Grüsse.
Damit andere auch weiterlesen können, alles weitere in Englisch.
Dear Stefan
Thank you fro your replay.
I had to change the part where the program gets startet from tell application “Finder”
to open theMovie using application “SimpleVideoOut X”) to (using application file “SimpleVideoOut X.app” of folder “Utilities” of folder “Applications” of startup disk
Only that way, the tool gets started with the file of the variable theMovie.
In the original version, the tool opens but does ask for the file to open.
There are only some obstacles.
1.) If a file with the same name already exists in the destination folder, where it should be placed in, it won’t be moved.
2.) If, because of the problem above, a file with the same name exists in the controlled folder, the folder action won’t see that a new file is added to the watched folder.
So I need a workaround to move the file to the destination folder even there is already a file with the same name.
It would be nice, if this workaround would add date&time to the filename after it did move it.
That way this problem wouldn’t occur anymore.
Do you or anyone else have a solution for this?
Also it would be nice (to make it easy handling) if the script would ask, the first time it starts, where the destination folder for moving the file should be and with that, someone has the ability to choose and/or create the destination folder through finder elements and doesn’t have to write/change the script by himself.
The easiest way to move a file and change its file name at the same time is using the shell
property exportFolder : missing value
on adding folder items to this_folder after receiving these_items
if exportFolder is missing value then set exportFolder to choose folder with prompt "Choose destination folder"
set theMovie to item 1 of these_items
checkStableSize(theMovie) -- wait until the file has been saved completely
tell application "Finder"
open theMovie using application file "SimpleVideoOut X.app" of folder "Utilities" of folder "Applications" of startup disk
end tell
delay 5
tell application "System Events"
repeat while exists process "SimpleVideoOut X"
delay 2
end repeat
end tell
set destinationFile to quoted form of (POSIX path of exportFolder & createNewName(theMovie))
do shell script "mv " & quoted form of POSIX path of theMovie & space & destinationFile
end adding folder items to
on checkStableSize(myFile)
set F to quoted form of POSIX path of myFile
set sizeThen to first word of (do shell script "du -d 0 " & F)
delay 10 -- seconds (set to longer if needed)
set sizeNow to first word of (do shell script "du -d 0 " & F) as integer --coercing to integer fixes the quote problem
return (sizeNow - sizeThen = 0)
end checkStableSize
on createNewName(M)
set TimeStamp to do shell script "date -n +%Y%m%d_%H%M%S"
set {name:Nm, name extension:Ex} to info for M
if Ex is missing value then set Ex to ""
if Ex is not "" then set Nm to text 1 thru ((count Nm) - (count Ex) - 1) of Nm
return Nm & "_" & TimeStamp & "." & Ex
end createNewName
Note: if the value of the property doesn’t persist (that could be with the folder action) tell me, there are other ways to keep the data