i’ve created this, saved as an application on wich I want to drop shake scriptd
on open this_item
tell application "Terminal"
activate
set shakescript to "shake -exec " & this_item & " -cpus 2 -v -nocache -t "
do script shakescript in window 1
delay 10000
end tell
end open
but it gives me 2 problems
in the terminal the variables this_item appears with : instead of / for the separator this make the script unreachable
i’d like to be able to write the time range before the script runs, hence the delay 10000 but the script run immediately
any clues ?
thanx in advance
Model: dual g5
AppleScript: 1.10.6
Browser: Firefox 2.0
Operating System: Mac OS X (10.4)
with the do shell script command you can run it directly from AppleScript.
I don’t know if this_item works, because you get a list of files, better is item 1 of the list.
For a shell script, paths must coerced to UNIX paths and should be escaped, in case there are space characters in the file name.
But I have no idea about your delay problem
on open these_items
set this_item to quoted form of POSIX path of item 1 of these_items
do shell script "shake -exec " & this_item & " -cpus 2 -v -nocache -t "
delay 10000
end open
the delay problem isn’t too much of a problem
the terminal just says missing argument for variable -t (the time range here like -t 1-100) and the script just stops
but it gets in the upper arrow memory so i just have to press the upper arrow and complete the argument of -t
so i think it will do it
thanx for the posix compliance trick I wouldn’t have found myself
i think i will post your script on www.fxshare.com with your permission it will seriously help the shake users community to render faster
try this, the biggest part of the code is the error handler
on open these_items
set this_item to quoted form of POSIX path of item 1 of these_items
repeat
set theValue to text returned of (display dialog "Enter value (1-100)" default answer "50")
try
set theValue to theValue as integer
if theValue > 1 and theValue < 101 then
exit repeat
else
display dialog "Number is out of range" buttons {"OK"} default button 1 giving up after 2
end if
on error
display dialog "Please enter a number" buttons {"OK"} default button 1 giving up after 2
end try
end repeat
do shell script "shake -exec " & this_item & " -cpus 2 -v -nocache -t " & theValue as string
-- delay 10000
end open
nice one I was also playing with the display dialog but in this case i must enter 1-100 or 1-875 or 1-640
the idea is to calculate frames from frame 1 to frame 100 or frame 1 to frame 875 (1-875) so an integer will not do it
on open these_items
tell application "Terminal"
set range to text returned of (display dialog "Enter time range" default answer "1-100")
set range to range as string
set this_item to quoted form of POSIX path of item 1 of these_items
set shakescript to "shake -exec " & this_item & " -cpus 2 -v -nocache -t " & range
do script shakescript
end tell
end open
if there are only 3 fixed values then everything its much easier:
on open these_items
set this_item to quoted form of POSIX path of item 1 of these_items
set theValue to button returned of (display dialog "Choose Frames" buttons {"100", "640", "875"})
do shell script "shake -exec " & this_item & " -cpus 2 -v -nocache -t 1-" & theValue as string
end open
Our post crossed so as you see i don’t need an integer but a string that looks like 1-62 (meaning I will render 62 frames starting from frame 1 to 62 or like 28-208 from frame 28 to frame 208) you really helped with the way to display a dialog and copy the result to a variable if I need to render 3 integer I can write 1,50,300 because of the syntax of the -t argument of shake -exec
now it work fine when i drop a shake script on the droplet i have a dialog displaying 1-100 and i just have to replace it with the value i need and magic happens
big thank again i’ll post this applescript on fxshare then
I think this one should do it now
the dialog box gives the name of the script for which you to enter the time range
the terminal shell has the name of the script it is rendering
no empty terminal shell opens
I’ll play with applescript studio to create a nice interface for these thing if I have time
on open these_items
tell application "Terminal"
activate
repeat with this_item in these_items
set titre to name of (info for this_item)
set question to "enter desired time range for " & name of (info for this_item)
set range to text returned of (display dialog question default answer "1-100")
set range to range as string
set this_item to quoted form of POSIX path of item 1 of these_items
set shakescript to "shake -exec " & this_item & " -cpus 2 -v -nocache -t " & range
if (count windows) is 0 then do script ""
do script shakescript in window 1
tell window 1
set title displays shell path to false
set title displays window size to false
set title displays file name to false
set title displays device name to false
set title displays custom title to true
set custom title to titre
end tell
end repeat
end tell
end open
okay i’ll remove it then I wasn’t quite sure I needed it or not it fell to me that it was also useless but I wanted to be sure not to carry extra info in the range variable …
to make it “waterproof” and avoid any unexpected behaviour
you can add a handler which make sure that the text has been entered properly
on open these_items
tell application "Terminal"
activate
repeat with this_item in these_items
set titre to name of (info for this_item)
set question to "enter desired time range for " & name of (info for this_item)
set range to my get_range(question)
set this_item to quoted form of POSIX path of item 1 of these_items
set shakescript to "shake -exec " & this_item & " -cpus 2 -v -nocache -t " & range
if (count windows) is 0 then do script ""
do script shakescript in window 1
tell window 1
set title displays shell path to false
set title displays window size to false
set title displays file name to false
set title displays device name to false
set title displays custom title to true
set custom title to titre
end tell
end repeat
end tell
end open
on get_range(questiontext)
repeat
set theRange to text returned of (display dialog questiontext default answer "1-100")
try
if theRange does not contain "-" then error
set theRange to words of theRange
set |from| to item 1 of theRange as integer
set |to| to item 2 of theRange as integer
return (|from| & "-" & |to|) as string
on error
display dialog "Please enter two numbers separated with dash" buttons {"OK"} default button 1 giving up after 2
end try
end repeat
end get_range
It’s very kind of you
you have to see -t as a timeline where image 1 is at the beginning of the movie and image 100 is set 4 seconds
later (assuming you have 25 images per second)
and sometimes some images fail to render so I have to rerender them again
so there is three possibility for the -t flag
-t 5 will render image 5
-t 5,10,124,325 will render images 5, 10, 124 and 325
-t 1-100 will render images from image 1 to image 100
if I use your really interesting script, I will lose the ability to render single or separate images
if (count windows) is 0 then do script ""
do script shakescript in window 1
tell window 1
set title displays shell path to false
set title displays window size to false
set title displays file name to false
set title displays device name to false
set title displays custom title to true
set custom title to titre
end tell
doesn’t allow me to launch another render in a new shell while one busy
I’m looking for a way to create a new shell with the name of the shake script
now when I drop script on the droplet the only thing it does is to change the name of the current shell (wich is logical because of the syntax of the if command interupter
maybe something like this should work
if (count windows) is 0 then do script “”
do script shakescript in window 1
tell window 1
set title displays shell path to false
set title displays window size to false
set title displays file name to false
set title displays device name to false
set title displays custom title to true
set custom title to titre
end tell
else
do script shakescript
tell window shake -------if i don’t specify do script"" in the shell is called shake------------
set title displays shell path to false
set title displays window size to false
set title displays file name to false
set title displays device name to false
set title displays custom title to true
set custom title to titre
end tell
end if
but it ask me to define the variable shake
so basically what I want is to launch multiple shell at once or even if renders are busy
each shell would have the name of the shake file it is rendering