Mikeman27294 Posted June 18, 2011 Posted June 18, 2011 Hello everyone... name says it all. Does anybody know of a way in which you can use one script to run another? I know two scripts can be run at the same time, so long as you manually run the second one atleast, with the autoit program provided in the autoit install directory. Is there any way which I can send parameters to this executable so that it runs the program without asking for me to select a file to run, becuase I am nearly certain that I have seen this just now with somebody else's script (but I dont want to go off topic on their board, and PMing is not allowed). Thanks people.
Moderators Melba23 Posted June 18, 2011 Moderators Posted June 18, 2011 Mikeman27294,Look in the Help file under <Using Autoit - Command Line Parameters> and you will see how to run scripts from within other scripts while passing parameters to it. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
Mikeman27294 Posted June 18, 2011 Author Posted June 18, 2011 (edited) So it would be something like one of these? Autoit.exe Script.au3 or AutoIT.exe & Script.au3 Thanks. Edited June 18, 2011 by Mikeman27294
Moderators Melba23 Posted June 18, 2011 Moderators Posted June 18, 2011 Mikeman27294,If you have already compiled the script then you can use Run as with any other executable.The first example you have used is for use with standard .au3 scripts - the second is not correct. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
sleepydvdr Posted June 18, 2011 Posted June 18, 2011 Why not use #include <script.au3>? Include it at the point that you want to run the script. #include <ByteMe.au3>
Moderators Melba23 Posted June 18, 2011 Moderators Posted June 18, 2011 sleepydvdr,Why not use #include <script.au3>?Because that merely inserts the code of the second file into your script at that point. The OP wants to run the script externally - and it may do something completely unconnected with the original script. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
Mikeman27294 Posted June 18, 2011 Author Posted June 18, 2011 (edited) Thanks people.And the reason that I do not include the script is because I want to have this like an extremely lightweight script editor, an my school has cracked on to me using scite because it looks like an IDE and they dont want me to get harrassed by other students over it and so on, but I dont want to be running the autoit3.exe program from it's root directory becuase it takes forever to get to, so it would be much quicker to get it to run from the program. I think I have it figured out now though, thanks guys.EDITOk, I tried this and it didnt workRun("AutoIt3.Exe" & $ScriptPath)$Scriptpath is a predifined variable, and I even compiled the program to make sure it worked, but it didnt. Edited June 18, 2011 by Mikeman27294
Moderators Melba23 Posted June 18, 2011 Moderators Posted June 18, 2011 Mikeman27294,Create and compile these 2 files:; Parent.au3 ConsoleWrite(1 & @CRLF) Run("Child.exe 1") ConsoleWrite(2 & @CRLF) Run("Parent.exe /AutoIt3ExecuteScript Child.au3 2") ConsoleWrite(3 & @CRLF) Run("Parent.exe /AutoIt3ExecuteScript Child.au3 3") ; ------------------ ; Child.au3 MsgBox(0,"Hi!", "Child here with " & $CmdLine[1])Then run Parent both from SciTE and compiled and you will see what works when. M23P.S. And then please go to this thread and let me know why you are using a "INTERNAL USE ONLY" function in my GUIFrame UDF! Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
Mikeman27294 Posted June 18, 2011 Author Posted June 18, 2011 Yep, that worked. I might then try bumping it up to run a selected file then?
Moderators Melba23 Posted June 18, 2011 Moderators Posted June 18, 2011 Mikeman27294,I might then try bumping it up to run a selected file then?If I had any idea of what you mean I might be able to offer an opinion. Please try to explain your questions more clearly so that we can understand what you are asking - it gets a bit difficult responding to the short staccato phrases you tend to use. Remember that I can only work on what I think you mean, not what you think you told me! M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
Mikeman27294 Posted June 18, 2011 Author Posted June 18, 2011 (edited) Fair enough. What I meant was that I get an open dialoge, and select my file. The path is assigned to a variable, which is included in the script. Like this:; Parent.au3 Local $OpenPath = FileOpenDialog("Open File", @UserProfileDir, "All Files (*.*)|AutoIt v3 Script (*.au3)|Text (*.txt)") ConsoleWrite(1 & @CRLF) Run("Child.exe 1") ConsoleWrite(2 & @CRLF) Run("Parent.exe /AutoIt3ExecuteScript " & $OpenPath & " 2") ConsoleWrite(3 & @CRLF) Run("Parent.exe /AutoIt3ExecuteScript Child.au3 3") ; ------------------ ; Child.au3 ;MsgBox(0,"Hi!", "Child here with " & $CmdLine[1])So pretty much, the second one runs a selected file. (You may have noticed by the way that I commented out the last line, this is because the array $CmdLine[1] didnt want to work and I wasnt exactly sure where it was meant to get it's data from, but it ran smoothly without that) The only problem now, is that it is not running the includes aswell, but I will try changing the program's running directory, so it would be like this;Run("Parent.exe /AutoIt3ExecuteScript " & $OpenPath & " 2", C:\Program Files (x86)\AutoIt3\Include)I will give this a try my self just before I start asking whether it would work or not though.EDITNope, that didnt work. I will try changing the includes then, to paths.EDIT 2Yep... that worked. What I might do then is set all my programs like that... wow fun, but atleast it will work.Thanks for helping out here. Edited June 18, 2011 by Mikeman27294
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