boat_58 Posted July 6, 2019 Share Posted July 6, 2019 (edited) Hello, i am new to this and learning. Can someone help me with the code below? I am trying to get the function to run an autoit file when the function is called but i can't seem to get it right. The file is currently saved on my desktop at this location: I:\External Drive\Backup\AutoIt\AutoIt\Testing HotKeySet('{ESC}', 'Stop') Example() Func Example() Run('Test13.au3') EndFunc ;==>Example ;Stop Function Func Stop() Exit EndFunc ; Stop Edited July 6, 2019 by boat_58 Link to comment Share on other sites More sharing options...
kaisies Posted July 6, 2019 Share Posted July 6, 2019 What game is the bot for? Link to comment Share on other sites More sharing options...
boat_58 Posted July 6, 2019 Author Share Posted July 6, 2019 (edited) Its not a bot for any game, its a bot that i want to automate some items on my computer. I am trying to figure out how to effectively make button and link them to different files in autoit. But each time i link it, it doesn't open. Edited July 6, 2019 by boat_58 Link to comment Share on other sites More sharing options...
Network_Guy Posted July 6, 2019 Share Posted July 6, 2019 u cant run script as au3 directly , u have two options :- option 1:- $FilePath="I:\External Drive\Backup\AutoIt\AutoIt\Testing\Test13.au3" Run(@AutoItExe & " /ErrorStdOut "&$FilePath) option 2:- compile au3 to exe and run it normaly Link to comment Share on other sites More sharing options...
Developers Jos Posted July 6, 2019 Developers Share Posted July 6, 2019 Why not simply use #include or does it need to be a separate process? 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...
boat_58 Posted July 6, 2019 Author Share Posted July 6, 2019 It needs to be a separate process. When the button is clicked on, then that process will activate. I think Network Guy's option 2 is working Link to comment Share on other sites More sharing options...
Network_Guy Posted July 6, 2019 Share Posted July 6, 2019 sry i missed quotes :- 7 hours ago, Network_Guy said: option 1:- $FilePath="I:\External Drive\Backup\AutoIt\AutoIt\Testing\Test13.au3" Run(@AutoItExe & " /ErrorStdOut "&$FilePath) try this code:- $FilePath="I:\External Drive\Backup\AutoIt\AutoIt\Testing\Test13.au3" Run(@AutoItExe & ' /ErrorStdOut "'&$filepath&'"') Link to comment Share on other sites More sharing options...
boat_58 Posted July 6, 2019 Author Share Posted July 6, 2019 Okay i got it to open the files as exe files. Is there a way that when i start the script, the main script willl keep running until i stop it, but the mini scripts that i open, i have the power to stop them and start another script when i click the button associated with it? How do i make it so that i can start and stop each of those cases without closing out the main script? Each of those cases run another autoscript file to automate. While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Virus Scan V_Scan() Case $Spyware S_Scan() Case $Misc Misc() Case $Stop Exit EndSwitch WEnd Link to comment Share on other sites More sharing options...
Network_Guy Posted July 6, 2019 Share Posted July 6, 2019 why you close the main script at all ? sry i cant get what you want , can u post your full code and what you try to achieve with it ? Link to comment Share on other sites More sharing options...
boat_58 Posted July 7, 2019 Author Share Posted July 7, 2019 (edited) Yes, sorry here is the full code. I want to run this script, i will get a menu with two buttons, V_Scan and S_Scan. When i click V_Scan, it will run V_Scan.exe. When i click S_Scan it will do the same for S_Scan.exe. How do i make it so i can run the main code, then select V_Scan, and then be able to add a stop V_Scan and then be able to start S_Scan also without having to stop the main script that is showing me the S_Scan and V_Scan menu. expandcollapse popup#include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form=I:\External Drive\Backup\AutoIt\AutoIt\Testing\Auto_Control.kxf $Auto_Control = GUICreate("Auto_Control", 190, 139, -1, -1) Global $Stop_Auto = GUICtrlCreateButton("Stop_Auto", 56, 104, 83, 25) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") Global $V_Scan = GUICtrlCreateButton("V_Scan", 8, 8, 83, 25) Global $S_Scan = GUICtrlCreateButton("S_Scan", 96, 8, 83, 25) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $V_Scan V_Scan() Case $S_Scan S_Scan() Case $Stop_Auto Exit EndSwitch WEnd ;Start V_Scan Function Func V_Scan() Run("V_Scan.exe") EndFunc ; Stop ;Start S_Scan Function Func S_Scan() Run("S_Scan.exe") EndFunc ; Stop Edited July 7, 2019 by boat_58 Link to comment Share on other sites More sharing options...
FrancescoDiMuro Posted July 7, 2019 Share Posted July 7, 2019 3 hours ago, boat_58 said: How do i make it so i can run the main code, then select V_Scan, and then be able to add a stop V_Scan and then be able to start S_Scan also without having to stop the main script that is showing me the S_Scan and V_Scan menu. The same way you can start process, you can close process with ProcessClose() Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette Link to comment Share on other sites More sharing options...
Network_Guy Posted July 7, 2019 Share Posted July 7, 2019 1- you can stop the v_scan by killing its process using ProcessClose ,example :- Global $V_PID func V_scan() $V_PID= Run("V_scan.exe") endfunc func Stop_V_Scan() ProcessClose($V_PID) endfunc 2-you can check if V_scan.exe is running or not by using ProcessExists , example :- Global $V_PID func V_scan() $V_PID= Run("V_scan.exe") endfunc func State_V_Scan() $state=ProcessExists($V_PID) if $state = 0 then ; V_scan not running else ;V_scan is running endif endfunc BTW ,using run will open another process completely separated from main script that mean :- even if u start V_scan and closed the main script v_scan still working on background Link to comment Share on other sites More sharing options...
boat_58 Posted July 7, 2019 Author Share Posted July 7, 2019 (edited) 2 hours ago, Network_Guy said: 1- you can stop the v_scan by killing its process using ProcessClose ,example :- Global $V_PID func V_scan() $V_PID= Run("V_scan.exe") endfunc func Stop_V_Scan() ProcessClose($V_PID) endfunc 2-you can check if V_scan.exe is running or not by using ProcessExists , example :- Global $V_PID func V_scan() $V_PID= Run("V_scan.exe") endfunc func State_V_Scan() $state=ProcessExists($V_PID) if $state = 0 then ; V_scan not running else ;V_scan is running endif endfunc BTW ,using run will open another process completely separated from main script that mean :- even if u start V_scan and closed the main script v_scan still working on background Thank you so much. This helps alot. I appreciate you BTW, for the first one. how do you stop the process? What button do you press to have the V_Scan stop? Edited July 7, 2019 by boat_58 Link to comment Share on other sites More sharing options...
Network_Guy Posted July 8, 2019 Share Posted July 8, 2019 i didnt create button i just gave an example how to stop v_scan , u just need to create new button and link it to the Stop_V_scan function ,finally dont forget to create the global variables ($V_PID) and change your run command to $V_PID= Run("V_scan.exe") boat_58 1 Link to comment Share on other sites More sharing options...
boat_58 Posted July 8, 2019 Author Share Posted July 8, 2019 Everything is working great, thank you very much. Link to comment Share on other sites More sharing options...
boat_58 Posted July 8, 2019 Author Share Posted July 8, 2019 Last question: How do i make the script window GUI stay frozen and active on my screen. So that it will always remain on top just like the AutoIT Info screen when opened? Link to comment Share on other sites More sharing options...
Nine Posted July 8, 2019 Share Posted July 8, 2019 11 minutes ago, boat_58 said: How do i make the script window GUI stay frozen and active on my screen. So that it will always remain on top just like the AutoIT Info screen when opened? In help file, under GUICreate function, there is style and extended style you can set. Like $WS_EX_TOPMOST.... “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy 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