Help with shell script to invoke screen capture

Discussion in 'macOS' started by jammin0, Sep 27, 2010.

  1. jammin0 macrumors newbie

    Joined:
    Sep 27, 2010
    #1
    Basically I need a one click solution to the screen capture program built into OS X. I want something that I can pin to the dock and when I click it it performs the command+shift+3 that copies the whole screen and saves a png to the desktop.

    I have found some commands to call up key codes for the letter keys but I need to know how to call up the other keys. Would it be easier to just make a script in the script editor.

    I'm not a mac / unix guy and I realize that this is really simple I'm just new at it. Anyway help would be awesome.
     
  2. talmy macrumors 601

    talmy

    Joined:
    Oct 26, 2009
    Location:
    Oregon
    #2
    You can use Automator to create an application (which you can put in the dock) that will do the "Take Screenshot" action and then save the file to the desktop.
     
  3. Flash SWT macrumors 6502

    Flash SWT

    Joined:
    Mar 14, 2009
    Location:
    Houston, TX
    #3
    Good suggestion talmy. It only took me a couple minutes to whip up an example that does exactly what the OP wants using Automator. The only issue I can see is that it over writes the previous screenshot each time it is executed. Is there a way to enter a variable into the filename to avoid duplicates?

    .
     
  4. talmy macrumors 601

    talmy

    Joined:
    Oct 26, 2009
    Location:
    Oregon
    #4
    Add an action to import into iPhoto and it will create a new file with each capture.
     
  5. jammin0 thread starter macrumors newbie

    Joined:
    Sep 27, 2010
    #5
    I new it was that easy. Thanks for the help. I actually added a Change Finder name so that it saves it to the desktop and then adds the current time to the filename so that a unique file is created each time. I tried to get it to name them sequentially 1,2,3,4 much like the hotkey shortcut but I wasn't having much luck with that. The automator preview run wouldn't do it past 2 filenames but maybe I just needed to compile the program to get it to work.

    Anyway, awesome advice, go figure I didn't even know about automator and I was trying to write a script for it.
     

Share This Page