Slowing my script

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
alfema
Posts: 32
Joined: 04 Sep 2015, 11:04

Slowing my script

09 Jul 2016, 12:23

Hello:

Depending on the PC and server where my script is run, I need less or more pause, I was thinking about change for a dynamic system, implement an option that breaks up or down depending on the PC and server.

Not if it could be determined, as in games, any evidence that tells me the response speed of the PC and current server and then adjust automatically pause.

While I can think of how to define a varible I thought, with a value of 1 for normal pause, and increase or decrease it in steps of 25 for slower 1.25, 1.50, ... they would like Sleep 250 * wSleepMulti.

But these days the problem is more serious, it seems that the pauses do not work properly for a network problem, the program runs remotely via Citrix, we must slow down the entire script.

I use SendInput, it is the fastest system I found when I started but is failing, I'm thinking of changing everything to Send, and use SetKeyDelay, SetMouseDelay and SetDefaultMouseSpeed, but can not find values appropriate starting or values to increase them.

Anyone who has had the same problem and can give me some clue?

--
Greetings
CHMike
Posts: 8
Joined: 16 Nov 2014, 16:44

Re: Slowing my script

10 Jul 2016, 04:47

one more idea , you can add the parameter to set the waiting time for winwaitactive or winwait and add the errorlevle to judge for the next steps. I think this can reduce the different computer response time.
alfema
Posts: 32
Joined: 04 Sep 2015, 11:04

Re: Slowing my script

10 Jul 2016, 06:53

CHMike In my scripts always I wait a while for a window, if it is not finished the script not to do wrong things, sometimes I put a safe waiting for me time to complete manually what did not work so automatically.

I think the biggest problem is SendInput and mouse movement, I need to slow down two with similar values, eg .: 25% over time.

Thank you for your suggestion.
User avatar
Xtra
Posts: 2750
Joined: 02 Oct 2015, 12:15

Re: Slowing my script

10 Jul 2016, 09:11

Citrix is just an image on the screen not a real program running on your local computer.
Use ImageSearch or PixelGetColor to know when it's ready for input.
alfema
Posts: 32
Joined: 04 Sep 2015, 11:04

Re: Slowing my script

15 Jul 2016, 08:56

Xtra I know, whenever I can use the image search. I am currently conducting tests with variable pauses or slowing the mouse movement and sending text, but it seems that is not the solution.
User avatar
Xtra
Posts: 2750
Joined: 02 Oct 2015, 12:15

Re: Slowing my script

15 Jul 2016, 12:21

It could also be that the program you are running on citrix is part of the problem,
then you would have two problems...

I would start by using send (which is event by default) and then use

Code: Select all

SetKeyDelay, 50, 50
For every bit of navigation use imagesearch in a loop so it will keep trying until successful this is your dynamic wait timing.
If it seems redundant do it anyways it will make it more reliable and that's all the matters.
(tip: use tooltips to debug / see the script navigation)

Example of dynamic wait:

Code: Select all

Loop
{
    ToolTip, looking for imagename %A_Index%
    ImageSearch, posX, posY, 100, 100, 200, 200, imagename.png
    if (ErrorLevel = 0)
    {
        ToolTip, found: imagename  
        break    ; or click the image here if it's a button etc and then break the loop.
    }
    Sleep 100
}
ToolTip
Once you get it working i would then make the imagesearch into a function to simplify the process.

I do this all the time.

HTH
alfema
Posts: 32
Joined: 04 Sep 2015, 11:04

Re: Slowing my script

16 Jul 2016, 07:29

Xtra wrote:It could also be that the program you are running on citrix is part of the problem,
then you would have two problems...
I agree.
Xtra wrote:I would start by using send (which is event by default) and then use

Code: Select all

SetKeyDelay, 50, 50
I've tried different values for the first parameter SetKeyDelay, 25 is semi slow 50 slow, but does not solve the problem, I will try with both parameters.
Xtra wrote:For every bit of navigation use imagesearch in a loop so it will keep trying until successful this is your dynamic wait timing.
If it seems redundant do it anyways it will make it more reliable and that's all the matters.
(tip: use tooltips to debug / see the script navigation)
I already do, an example of my code

Code: Select all

Loop 5														; If I can not find the first
	{
	BuscaImagen("r_estado_siguiente_act.png")				; Look for the Next button but not pressed.
	If !ErrorLevel											; If I find (ErrorLevel = 0) ...
		Break												; ... exit 
		
	Sleep 250*vSpeedx										; SpeedX can be 1, 1.15. 1.50, and so on.
	}
	
If ErrorLevel												; If you finish the loop and does not find the button ...
	{
	TrayTip,,Botón siguiente no encontrado %ErrorLevel%,,3		; ... warns and ...
	Return													; ... exit.
	}

I'm trying to SetMouseDelay because sometimes not the site that should move.

Thanks again.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: peter_ahk and 329 guests