Sign in to follow this  
Followers 0
Ulysse31

Sending controls, clicks and sleeps on a sub window

4 posts in this topic

#1 ·  Posted (edited)

Hi, 

First of all Happy New Year :sorcerer:  :sorcerer:

I started autoit recently for something which I shouldn't have but I didn't know at the time because well I am one of those who don't really check the rules (I know.... but so many lines and so few matter..) so for this I apologize.. and I read them now.

This on the other hand is a legit thread :

I am a pharmacist in France and we use like every drugstore a software (ours is Caduciel), I think it's pretty poor and bad designed (but the choice wasn't mine) which results in doing every night before we close a painfull process of saves which require someone's attention for 40 mins (whole process duration) to click ok, yes and launchs every ~2 mins.

We have a limited amount of well performing computers and unfortunately the saving computer actually needs to be used most of the time, even during that saving process, which is why I am here.

I would like to code a script which would launch and validate this process [mostly would be MouseClick(), sleep(), send()] however this will really prove itself usefull (it would be so great) If there is a way that every command in the script is directed to the saving software even though a user would be doing other stuff on another window.

In short, the question is this : say I have a script that's a lot like this 

#requireadmin
#include <ImageSearch.au3>
$x1 = 0
xy1 = 0
Func 1stprocess ()
winactivate("Caduciel")
send("{d}")
sleep(300)
send("{1}")
sleep(300)
send("F2")
sleep(120000)
MouseClick( "left", 939, 564, 1)
sleep(300)
send("{b}")
sleep(300)
send("{F2}")
sleep(120000)
testiffirstprocessisfinished ()
Endfunc

Func testiffirstprocessisfinished ()
   $Search = _ImageSearchArea('OKdetection.png', 1, 900, 50, 1100, 90, $x1, $y1, 55)
   If $Search = 1 Then
      MouseClick( "left", 939, 564, 1)
Else
   sleep(1000)
testiffirstprocessisfinished ()
   EndIf
EndFunc

1stprocess ()

then process2, test 2 etc... untill process 5.

 

What this supposedly do is start a process of sending prescriptions then launchs a test fonction which detects the success of the sending and goes forward or detects a failure and loops on the test fonction over again.

Is there anyway that once the script compiled and the executable launched, it does all this on Caduciel and not on the window that another user would be on?

I searched through the net and help file (help file mostly) and I found Controlsend ControlClick which I believe would do the trick (considering they are as accurate as their homologues on the main window)

However I plan to use ImageSearch/ImageSearchArea in order to press "Ok" once the message pops on the screen so that the process is sped up.

Since there is no ControlImageSearch I would like to ask if there is anyway I just write the script as if it's aimed at the main window and then use a fonction which aims to whole content to a specified software (Caduciel) even though another user is for instance browsing google chrome (actually happens a lot to order products)

Thanks !

Edited by Ulysse31

Share this post


Link to post
Share on other sites



Have you ever used the AutoIt info tool? It comes with the installation of AutoIt and is found in your program files folder, this can be used to get class/title information on windows, controls, and buttons that you need to click and use.

I don't think imagesearch is going to a great way of doing it, but hey it's your program! ;)

Also, if the computer changes you'll probably want to use the Control functions like ControlSend, ControlClick, etc. Just in case the monitors are different or at a different resolution.

^_^


Snips & Scripts


My Snips: graphCPUTemp ~ getENVvars
My Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4

Feel free to use any of my code for your own use.                                                                                                                                                           Forum FAQ

 

Share this post


Link to post
Share on other sites

Thanks for your answer,

I have tried AutoIt info tool, it was great to retrieve titles, mouseclick coordinates and pixel colors because I w anted to use PixelSearch before imagesearch.

However the button that pops up so that we press okay are white/black like most of the screen therefore pixel search didn't seem like the best idea so after searching I found imagesearch and made it work.

Image search detects the "Ok" pop up perfectly. It is very accurate, I love it. However to my knowledge and after searching there is no controlsleep and controlImageSearch therefore .. this thread.

But i just thought of something, since my code is just many functions being defined (processe' and tests) and the whole thing is then only launched by writing the first fonction (which triggers all others) as follow :

1stprocess ()

So maybe with something close to controlsend the fonction to Caduciel or ControlFocus it (not sure, trying to get both to work atm) it might just throw everything to Caduciel even the ImageSearch ?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0