QB64.org Forum
Active Forums => QB64 Discussion => Topic started by: Pete on December 01, 2018, 04:25:10 pm
-
Say I want to open Firefox and run it full screen. If I want to find out where click spots are located, I thought the following would help, but maybe someone has a better approach. I did not include this in the program section, as it is very rudimentary. Basically all it does is ask you to put whatever you want to be displayed and mapped up, press your PrtScr button to d a screen shot, and then it will copy that image and show the mouse coordinates. Move the mouse to what you wanted _SCREENCLICK to activate, and click the left mouse button. The muse cursor will move to position 0, 0 and in about a second, the mouse cursor will appear where it was, only this time that's a _SCREENCLICK but no worries, nothing will happen because this is only a copied image running in this program.
Oh, I had to update to version 1.2 for the _CLIPBOARDIMAGE keyword.
So, any easier ways to do this?
Pete
_SCREENMOVE 0, -25 ' Hides title bar above computer top screen margin. oldx% = -1: w = 0: v = 0
mb% = 0
PRINT "Confirmed: Row ="; y%;
" Column ="; x%
, dispon% = -1
PRINT "Put program to be mapped on screen and do a screen shot..." dispon% = -1
LOCATE 20, 10:
PRINT "Row ="; y%;
" ";
"Column ="; x%;
" ";
oldx% = x%: oldy% = y%
-
This is not an answer to "any easier ways to do this?", but an important warning: Don't call _CLIPBOARDIMAGE like that as every time you do so a new image is created in memory and you'll quickly run out it. Check out the example from the wiki page to see how every time before attempting to fetch a new image from the clipboard I tried to free any previous existing image:
PRINT "Monitoring clipboard..."
-
I forgot to take out a line when experimenting... I went back and edited out the line: dispon% = 0
So the image isn't freed now, because it is only placed in memory one time. In other words, when dispon% = -1, the _CLIPBOARD statement is no longer polled.
So with that modification, is there any need to perform a free image?
Pete
-
As said, each time the function is called a new image is created in memory (provided there is one in clipboard). I see it even in a loop condition there, so if you'll poll the clipboard more than once, make sure to always store the handle in a variable and then free it before you poll again.
-
Well after the edit, it only gets polled once, but once it is up on the screen, it no longer needs to be hogging memory. I used freeimage in this next example...
I get tired of FireFox session managers going defunct, so I thought some day, I'd make my own. This is a rudimentary program that returns the URLS you choose to save as a session.
WARNING: If you try this code, be aware it will use _SCREENCLICK wherever you left click, so when you make a right click to start the _SCREENCLICK process, it will make a _SCREENCLICK on each of the tabs or whatever it was you left clicked with the mouse.
_CLIPBOARD$ = "" ' Clear any images from clipboard memory. oldx% = -1: w = 0: v = 0
PRINT "Press any key when ready and follow these 3 steps..." PRINT "1) Make FireFox full screen." PRINT "2) Press PrtScr to make a screen shot." PRINT "3) Left click the tabs you want remembered and right click when done." LOCATE 20, 10:
PRINT "Row ="; y%;
" ";
"Column ="; x%;
" ";
oldx% = x%: oldy% = y%
mb% = 0
PRINT "Confirmed: Row ="; y%;
" Column ="; x%
, num = num + 1
tabx(num) = x%
taby(num) = y%
putimage:
_SCREENMOVE 0, -25 ' Hides title bar above computer top screen margin. dispon% = -1
Pete