HiteshSharma Posted August 30, 2017 Share Posted August 30, 2017 Hi Guys, I am running my scripts .au3 and when its start, open window, and navigation as per script however if I clicked outside the screen then the script is losing its focus seems and executing somewhere in desktop or browser and start clicking here and there. How can I make sure my script will run properly even though I clicked outside the window. Can somebody help ? Link to comment Share on other sites More sharing options...
careca Posted August 30, 2017 Share Posted August 30, 2017 Depends on what the script needs to do, can you put a reproductible script here? Spoiler Renamer - Rename files and folders, remove portions of text from the filename etc. GPO Tool - Export/Import Group policy settings. MirrorDir - Synchronize/Backup/Mirror Folders BeatsPlayer - Music player. Params Tool - Right click an exe to see it's parameters or execute them. String Trigger - Triggers pasting text or applications or internet links on specific strings. Inconspicuous - Hide files in plain sight, not fully encrypted. Regedit Control - Registry browsing history, quickly jump into any saved key. Time4Shutdown - Write the time for shutdown in minutes. Power Profiles Tool - Set a profile as active, delete, duplicate, export and import. Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes. NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s. IUIAutomation - Topic with framework and examples Au3Record.exe Link to comment Share on other sites More sharing options...
Developers Jos Posted August 30, 2017 Developers Share Posted August 30, 2017 9 minutes ago, HiteshSharma said: I am running my scripts .au3 Show the script and properly define the error you get. Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
HiteshSharma Posted August 30, 2017 Author Share Posted August 30, 2017 Thanks Careca, here we go Run("xyz.exe","") if WinExists($winTitle,"") Then ;Wait for some seconds and navigate Sleep(2000) Send("!f") Sleep(2000) Send("{ENTER}") Sleep(2000) Send("C:\Autoit") Sleep(3000) Send("{ENTER",false) Sleep(2000) Send("^a") Sleep(2000) Send("{BACKSPACE}") Sleep(2000) Send("CiAssignLog_ " & $string3 & ".txt") Sleep(5000) Send("{ENTER}",false) EndIf Once if condition is true then subsequent window will be open and if click anywhere outside the then I want to run my script and focu should come back again. Hope this help Link to comment Share on other sites More sharing options...
Developers Jos Posted August 30, 2017 Developers Share Posted August 30, 2017 Have you tried using ControlXXX() functions? What is the program you are trying to automate? Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
HiteshSharma Posted August 30, 2017 Author Share Posted August 30, 2017 No, i haven't used Control functions. A script will open .exe, navigate to 2nd tab click on the menu bar and opens another window and generate the logs and then click on menu bar again and save as a local desktop. I have used SendKeepActive("window name") and disable after action completed but I don't find this as the proper solution as it's working partially. Can you please share ex for control funtion ? H Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted August 30, 2017 Moderators Share Posted August 30, 2017 Look at Control functions in the help file - ControlClick, ControlSend, etc. The examples in each will give you the best idea how the function works "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
HiteshSharma Posted August 31, 2017 Author Share Posted August 31, 2017 Hi Logan, i tried but its not working as expected Link to comment Share on other sites More sharing options...
Developers Jos Posted August 31, 2017 Developers Share Posted August 31, 2017 Well, when you don't share more information it will be hard to help you. Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
HiteshSharma Posted August 31, 2017 Author Share Posted August 31, 2017 Hi Jos, I have shared the code and scenario above, can you please specify what you need. Happy to share the information wherever required. Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted August 31, 2017 Moderators Share Posted August 31, 2017 What did you try regarding the Control commands, and what is the result? "It's broke" doesn't exactly help us help you. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
HiteshSharma Posted August 31, 2017 Author Share Posted August 31, 2017 I tried with ControlSend and ControlClick both. In both the cases, it clicking on google setting button if I click outside the screen during execution. Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted August 31, 2017 Moderators Share Posted August 31, 2017 Show your code, please. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
HiteshSharma Posted August 31, 2017 Author Share Posted August 31, 2017 #include <Date.au3> ;Opt("WinTitleMatchMode",2) Run("my exe path","") ;WinWaitActive("Untitled - Notepad") ;WinMenuSelectItem("Untitled - Notepad", "", "&File", "Save &As" ) WinWait("Database Options") WinSetState("Database Options","") ;WinWait("Database Options") ConsoleWrite("Test" & @CRLF) ControlClick("Database Options","","[NAME:btnCancel]") ConsoleWrite("Test2" & @CRLF) ControlSend("CiAssign - No ABCS Connection","","","!f") ;Send("!f") ConsoleWrite("Test3" & @CRLF) ControlSend("CiAssign - No ABCS Connection","","","{ENTER}") WinSetState("Save As","",@SW_HIDE) ;ControlClick("CiAssign - No ABCS Connection","","{ENTER}") ConsoleWrite("Test4" & @CRLF) ;WinWait("Save As") ControlSend("Save As","","Logssssssssssssss.txt","") ConsoleWrite("Test6" & @CRLF) ;ControlClick("Save As","","{ENTER}") ControlSend("Save As","","","{ENTER}") ConsoleWrite("Test7" & @CRLF) Link to comment Share on other sites More sharing options...
Developers Jos Posted August 31, 2017 Developers Share Posted August 31, 2017 (edited) There is still not enough information to go on. Show us the information as shown by au3info for the windows/controls you are trying to do the ControlSend() for. One thing that is for sure missing is the waiting for the correct window to appear. You will require spme WinWait() statements in there. Jos Edited August 31, 2017 by Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
HiteshSharma Posted August 31, 2017 Author Share Posted August 31, 2017 Okay Jos, thanks let me work out more into this and keep you posted. Can you please check my other query too. Is there any way we can run the script in the background before launch or immediately after launch? I tried this Run("path to.exe","","@SW_HIDE) but its hide rest of the window ? Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted August 31, 2017 Moderators Share Posted August 31, 2017 One problem at a time: if you get the Control commands working, it will be easier to run the whole thing in the background. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
HiteshSharma Posted August 31, 2017 Author Share Posted August 31, 2017 Thank you Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now