Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the '10.6: Rename screenshots with Automator and AppleScript' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.6: Rename screenshots with Automator and AppleScript
Authored by: homeshire on Dec 10, '09 03:02:07AM

mh --

I am running no additions that I am aware of. I have no tidy up apps that move things automatically.

When I run your latest version of the script, the event log shows the following:

tell current application
choose folder
alias "Das Urall:Users:hmshr:Desktop:"
display dialog "/Users/hmshr/Desktop/" default answer ".png" buttons {"Cancel", "OK "} default button 2
{text returned:"thisisit", button returned:"OK "}
display dialog "set Delay" default answer 2 buttons {"Cancel", "OK "} default button 2
{text returned:"0", button returned:"OK "}
do shell script "screencapture -tpng '/Users/hmshr/Desktop/thisisit'"
""
(*screencapture -tpng '/Users/hmshr/Desktop/thisisit'*)
end tell

indeed, the file is still on the desktop. it is not a png or jpg or any kind of picture file. it has no extention whatever. I can manually apply an extension and it magically transforms into a picture file of exactly what it should be. but does not default to it.

if I do not change the title and leave the default .png in the dialog box of the script, it still goes poof after appearing momentarily on the desktop with the title .png followed by gibberish as some sort of data-like extension.

I'm flummoxed.

this is the event log after leaving the default title of .png in the dialog box:

tell current application
choose folder
alias "Das Urall:Users:hmshr:Desktop:"
display dialog "/Users/hmshr/Desktop/" default answer ".png" buttons {"Cancel", "OK "} default button 2
{text returned:".png", button returned:"OK "}
display dialog "set Delay" default answer 2 buttons {"Cancel", "OK "} default button 2
{text returned:"0", button returned:"OK "}
do shell script "screencapture -tpng '/Users/hmshr/Desktop/.png'"
""
(*screencapture -tpng '/Users/hmshr/Desktop/.png'*)
end tell

I wonder what's going on?


p.s. mh --

look at the following script as I have modified:

tell me to set thePath to (choose folder)
set thePath to (POSIX path of thePath)
set captureformat to "png"
set defAns to text returned of (display dialog "Title ...?" default answer "") & "." & captureformat as string
tell me to display dialog thePath default answer defAns buttons {"Cancel", "OK "} default button 2
copy the result as list to {text_returned, button_pressed}
tell me to (display dialog "set Delay" default answer 2 buttons {"Cancel", "OK "} default button 2)
copy the result as list to {text_returned2, button_pressed2}
set Delay_ to text_returned2 as number
delay Delay_
set apath to (POSIX path of thePath) & text_returned as string
set doit to do shell script ("screencapture -t" & captureformat & space & quoted form of apath as string)
log ("screencapture -t" & captureformat & space & quoted form of apath as string)

specifically I altered the definition of the variable defAns. this script works as it should. I get the pic file I want on the desktop.

your opinion?




Edited on Dec 10, '09 03:08:24AM by homeshire



[ Reply to This | # ]