Author Topic: Problem with _SCREENCLICK and question on _SCREENPRINT  (Read 2864 times)

0 Members and 1 Guest are viewing this topic.

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Problem with _SCREENCLICK and question on _SCREENPRINT
« on: January 11, 2019, 01:40:24 pm »
I have a program I'm trying to control with _SCREENCLICK. The problem, one _SCREENCLICK seems to act like two. The window has 4 screens, with Next buttons in the same place on each, but get this... When it performs one _SCREENCLICK on the button, it moves from the first screen through the second, and stops on the third. That's performing two clicks, not one.

So I tried to use alt + "N" with _SCREENPRINT, which should be coded as...

_SCREENPRINT CHR$(0) + CHR$(49)

That should be correct, as per the WIKI, but it does nothing. Yes, I definitely have the window in focus when these statements are called and if I hold down the alt key and press "N" it does go to the second screen.

So anyone know what's up? (And dammit Mark, if you post back CHR$(0) + "H", I'll kick you in the scrollballs!)

Pete
Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/

FellippeHeitor

  • Guest
Re: Problem with _SCREENCLICK and question on _SCREENPRINT
« Reply #1 on: January 11, 2019, 02:00:49 pm »
Please don't get me wrong (I feel this comment may sound harsh but it's not intended). It just feels QB64 isn't the best tool for what you're seeking to do, especially with all the guessing that's involved in using _SCREENCLICK and _SCREENPRINT (both of which make me shiver):

Ever heard of AutoHotKey (https://www.autohotkey.com)? It's an extremely effective scripting tool specifically designed for the type of automation you seem to be after.

They even have a macro recorder: https://autohotkey.com/board/topic/79763-macro-creator-v412-automation-tool-recorder-writer/
« Last Edit: January 11, 2019, 02:33:25 pm by FellippeHeitor »

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: Problem with _SCREENCLICK and question on _SCREENPRINT
« Reply #2 on: January 11, 2019, 02:44:36 pm »
Please don't get me wrong (I feel this comment may sound harsh but it's not intended). It just feels QB64 isn't the best tool for what you're seeking to do, especially with all the guessing that's involved in using _SCREENCLICK and _SCREENPRINT (both of which make me shiver):

Ever heard of AutoHotKey (https://www.autohotkey.com)? It's an extremely effective scripting tool specifically designed for the type of automation you seem to be after.

They even have a macro recorder: https://autohotkey.com/board/topic/79763-macro-creator-v412-automation-tool-recorder-writer/

I’ll testify to the usefulness of AutoHotKey.  It’s a lovely scripting tool.
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: Problem with _SCREENCLICK and question on _SCREENPRINT
« Reply #3 on: January 11, 2019, 02:50:35 pm »
I'm just wondering if _SCEENCLIK is buggy, actually does not perform just a single click and release, and why _SCREENPRINT cannot emulate an ALT + N press, unless I somehow coded it wrong. What do you guys think?

BTW: I get the shivers part, but I have four other routines that run flawlessly with these two statements, of course none of those require ALT + Anything.

And thanks for the link and recommendation. I'll look into it, too.

Pete

Edit: Well it looks likely that _SCREENPRINT was not setup to work with ALT, just CTRL. That's a shame as both are used frequently in various programs to control menu choices.
« Last Edit: January 11, 2019, 09:53:58 pm by Pete »
Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/

Offline Cobalt

  • QB64 Developer
  • Forum Resident
  • Posts: 878
  • At 60 I become highly radioactive!
    • View Profile
Re: Problem with _SCREENCLICK and question on _SCREENPRINT
« Reply #4 on: January 12, 2019, 12:31:11 am »
I think, if failing memory serves, to use CTRL you need to send the first 31 characters to screen print, not 0 and then letter, but I may be mistaken there. so you would need to figure out where N comes in the alphabet(14 I think) and try sending CHR$(14) to get a CTRL + N combo. but don't hold me to that.

as for _SCREENCLICK, that can depend on the speed of your machine, and the speed of the program your using it on and YOUR program using it. I have a few successful automation routines for games using it, but they are all older and run a weee slow on today's machines. I have managed single 'click and release' cycles up to .002 second intervals, at around .001 it starts to not catch the release and sees a single mouse down("click and hold" however trying to _mousemove will cause a release so no click and drag) , for left click anyway(if I have nothing else running I can sometimes manage the .001 delay with a click and release but not always). I have never successfully gotten a Right click and hold to work even with 0 delay. 

Having used _SCREENCLICK a while, with good results(usually), I could look at your code if you like make sure there isn't a hidden reason for the behavior.
Granted after becoming radioactive I only have a half-life!