This App is No Longer Maintained. Visit the Replacement at StrokesPlus.net

StrokesPlus Forum
                       
StrokesPlus Forum
Home | Profile | Active Topics
Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General Discussion
 General Discussion
 Position the mouse and send a value
 Forum Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

Didier3L

2 Posts

Posted - 07/07/2017 :  08:49:26  Show Profile
Hello
I use a gesture that triggers an AHK (AutoHotKey) script that allows you to enter certain values in a form depending on the position of the mouse.

Is it possible to do the same thing directly with a StrokesPlus script

MouseGetPos, xpos, ypos 
; Msgbox, Position de la souris : x = %xpos% et y = %ypos%. 

If (ypos > 490 and ypos < 510) ; Y = 500
send, DURAND
 
If (ypos > 455 and ypos < 475) ; Y = 465
 Send, `%
 
If (ypos > 630 and ypos < 650) ; Y = 640
FormatTime, Date , ddMMyyyy, dd/MM/yyyy
send, %Date%
 
Return

Rob

USA
2615 Posts

Posted - 07/07/2017 :  09:18:08  Show Profile  Visit Rob's Homepage
Sure, every action has these values passed in: http://www.strokesplus.com/help/#Variables

This code should probably work as is, though I haven't tested it extensively:
if gsy > 490 and gsy < 510 then
	acSendKeys("{DELAY=10}DURAND")
elseif gsy > 455 and gsy < 475 then
	acSendKeys("`{PERCENT}") --assuming you're trying to send an actual %
				 --% in acSendKeys() is a prefix for the ALT key
elseif gsy > 630 and gsy < 650 then
	acSendKeys("{DELAY=10}"..os.date("%d/%m/%Y")) --two dots is used to join strings
end
In this code I'm using gsy which is the mouse Y position where the gesture started.

You can check this link for the various Lua date/time functions and variables:
https://www.lua.org/pil/22.1.html

And this for the acSendKeys specifics for characters:
http://www.strokesplus.com/help/#acSendKeysUsage

The "{DELAY=10}" prefix just speeds up the time between each key sent (in milliseconds), you can increase if you're experiencing any timing issue; the default value is 50.

Go to Top of Page

Didier3L

2 Posts

Posted - 07/10/2017 :  03:28:00  Show Profile
thank you very much
It works perfectly
Go to Top of Page
  Previous Topic Topic Next Topic  
 Forum Locked
 Printer Friendly
Jump To:
StrokesPlus Forum © 2011-2018 Rob Yapchanyk Go To Top Of Page
Snitz Forums 2000