Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Screenshots in Mac OS X

Hey guys,


Good Morning!

How are you doing?


I am in need of your help.


I am stuck in a problem.


I am new to PyObjC, and I want to write my own Screenshot Taking program in PyObjC for Mac OS X.


The logic which I could think of is, we can something use like "switch" statements as in C++ and Java, for considering the KEYS PRESSED, and the associated action which is to be taken, but don't know how to code it in PyObjC. As well, whenever the program is executed, it should be running at the background as well, so that I can switch the application and take the screenshot of any window of my choice, and it should override Mac's built-in functionality with this program, until the program is running.


I have googled about it as well as searched about it on Stackoveflow and StackExchange, but I couldn't find any relevant info. All I found is taking screenshots using command-line, but that is not what I am looking for.


Example : Whenever Command + Shift + 3 is pressed ==> whatever is there on the screen, should be grabbed / captured, and should be stored on my local with my own desired path, and name should automatically given as SnapshotX.. as in Snapshot1, Snapshot2, etc...


The same goes with Command + Shift + 4 ==> the only difference is that, it allows you to select a particular area to be captured / grabbed.


Command + Shift + 5 ==> This one is a little bit tricky which I am looking for. This shortcut doesn't exist. I want to create one of my own, where it would grab the entire webpage's screenshot which I am currently working on, and store the name as the webpage's url / link.




The code which I have written in Python :


import os

import datetime


datetime = datetime.datetime.now().strftime("%a %Y-%m-%d %I.%M.%S.%f %p")


format = ".png"

check_snapshot = "/Users/Apple/Desktop/'ScreenshotsTest %s%s'" % (datetime, format)


os.system("screencapture -s %s" % check_snapshot)




I want to add Cocoa Key event listeners of the above mentioned shortcuts to work.

This works very well when I run using Terminal. I want that as soon as any of the above shortcuts combination is pressed, the event should be triggered if the program is running at the backend, regardless of the Terminal being as an active window.




Thanks in advance for your kind help and time.

Posted on Oct 28, 2013 1:44 AM

Reply
2 replies

Screenshots in Mac OS X

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.