Suggestions on way to approach this application - Detecting external mouse clicks

Joined
Jul 12, 2017
Messages
1
Reaction score
0
Points
1
OK so I am absolutely brand new to programming any Mac related language. The extent of my programming knowledge dates back to 15+ years ago in Visual Basic on Windows.

Yet, somehow, I have been able to (in Xcode in AppleScriptObjC) write a pretty nice application (albeit very basic) that does what I need it to do.

Background:
I trade stocks, and was switching to a new trading platform and stock symbol, and wanted to be able to Demo-Trade without real money for a period of time longer than the 30 days that the broker gives me on their Demo system. So rather than risking my capital, I wrote a "Buy/Sell" window application that basically screen shotted the stock chart on a button click. A Buy click would create a screen shot with a time stamp and a filename indicating that the stock was Bought. Ditto for the Sell button. Then I can look at the market stock price at the exact moment the screen shot was taken to determine in an excel spreadsheet what my profit/loss on each trade would be, without having to execute a live order with my actual capital at risk while familiarizing myself with the new stock symbol I was trading.

My Dilemma:
So, now that I've had a few months of screen shots saved showing me all the trades I made, I have found that I quite like being able to look back at what the stock chart looked like when I made each decision. It allows me to look back and say "Wow, that was stupid," or "OK, it looked reasonable to make that trade even though it ended up not working out in my favor."

However, next month when I put my real capital into my account and start trading on the trading platform, I lose the screen shots of all my trades, as obviously the trading platform doesn't take screen shots of everything you do :) Since trading is such a split-second time sensitive thing, there is no time to get an accurate picture of what you're doing by manually screen shotting the trade execution after making the live trade. Probably half the time I'd even forget to do the screen capture.

My Goal:
I'd like to create an app that detects when a trade is being executed on the trading platform (which runs in Flash within a Google Chrome browser app), and take the screen shot for me the way my own app already does.

There's 2 ways I've thought that this may be possible, and I have no idea how to do either of them, or if it's even possible.

1. Have the app detect when a mouse click is detected within a range of screen coordinates - as the Buy/Sell buttons are always in the same location on the screen, and then upon detecting a click within that range of coordinates, execute the code to take the screen shot.

2. Have an app with a Translucent window hover over top of the trading platforms Flash window, and "pass through" the click. So I would click on a button on my application, and it would execute the screen capture code plus also send a "click" to whatever window is behind the apps window.

I feel like #1 is the more realistic approach. But like I said, no idea if it's even possible, or how to go about coding that.

AppleScriptObjC seems to be relatively OK for me to piece together code and I seem to be able to work with it somewhat reasonably even without any experience with Objective C or coding on a Mac altogether. I'm quite proud of myself that I figured out as much as I did in the span of an afternoon lol.

Thanks!
 
Joined
Aug 13, 2011
Messages
200
Reaction score
7
Points
18
Location
West Sussex
Why dont you just use the Grab app available in Mac OS ?

or write a script that uses the screencapture command line utility ?
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top