I’m trying to do the screenshot shell script:
“nohup -c “sleep 60; screenshot ~/Desktop/Picture.png””
I’m trying to script it, but I keep getting “found identifier” on the “sleep”…
If AppleScript needs quotes around shell scripts then what about the quotes IN the shell script?
Escape them:
do shell script "nohup -c \"sleep 60; screenshot ~/Desktop/Picture.png\""
Hmmm… maybe you can help me out with this script:
property iTake : ""
repeat while iTake is ""
display dialog "How many seconds until screenshot?" default answer iTake
set iTake to number of result
end repeat
try
do shell script "nohup bash -c \"sleep & quoted form of iTake &; screencapture ~/Desktop/Screenshot.png\"
end try
User inputs the “sleep time” on the shell script…
While Jacques reply should suffice for you, it should be noted that very large or small numbers are represented in scientific notation (or something like that).
Seeing how dialog and shell scripts use text, you don’t need to set iTake to a number.
property iTake : ""
repeat while iTake is ""
display dialog "How many seconds until screenshot?" default answer iTake
set iTake to (text returned of result)
try
get iTake as number
on error
set iTake to ""
end try
end repeat
try
do shell script "nohup bash -c \" sleep " & iTake & "; screencapture ~/Desktop/Screenshot.png\""
on error errorMsg number errorNum
display dialog "Error (" & errorNum & "):" & return & return & errorMsg buttons "Cancel" default button 1 with icon caution
end try