Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like to make this code to automatically create preview and icon so it looks nice in Finder and so i don't have to wait my graphics app to create these things when i first time open in browse view. Thanks

do shell script "screencapture -Wimxo " & quoted form of ("/Users/Maccie/Desktop/shot.png")
share|improve this question

closed as not a real question by patrix Apr 20 '13 at 19:23

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

It's not clear what you're asking here. To avoid getting answers that don't really solve your problem, the question will be closed FOR NOW until it can be improved. Please edit your question to make it clearer so we can reopen it. Read How to Ask for more ideas to improve the question. Confusing questions are closed so they don't attract a scattering of answers before they're in a form that is likely to get a clear answer; your question can be reopened at any time if you or someone on your behalf suitably amends it. – patrix Apr 20 '13 at 19:22
Especially: What graphics are you using? Which browse view are you talking about, the one in Finder or the one in your graphics app? – patrix Apr 20 '13 at 19:23

This seems to work.

It uses your code to capture the image, although I have made it so any user can use it.

It then uses an edited version of a script I found on macosxautomation website for image events

set homeFolder to path to home folder
    set imageName to "shot.png"
    set saveFolderPath to homeFolder & "Desktop:" & imageName as string
    do shell script "screencapture -Wimxo " & quoted form of POSIX path of saveFolderPath
    --set the target_path to the saveFolderPath as Unicode text
    delay 1
        tell application "Image Events"

            -- start the Image Events application
            -- open the image file
            set this_image to open saveFolderPath
            set type_ to file type of this_image
            -- save in same  file with icon
            save this_image as type_ in saveFolderPath with icon
            -- purge the open image data
            close this_image

        end tell
    on error error_message
        display dialog error_message buttons {"Cancel"} default button 1
    end try
share|improve this answer
Thanks this works, but... I take many times screenshots in very fast pace and i think using Image Events might be too slow especially because in my own old code there is additional code which is run between each shots so IE might slow it too much. Is there any way to change quality level of preview and icon? Does this additional save by Image Events affect to picture quality? – user47803 Apr 20 '13 at 17:05
Hi, there most probably is. The only other way maybe using third party CLI like imagmagik or exiftool if I had sometime I probably could look at writing something native but I think it would not be soon – markhunte Apr 20 '13 at 17:39

Not the answer you're looking for? Browse other questions tagged or ask your own question.