Sign in to follow this  
Followers 0
Mikeman27294

Using one script to run another.

11 posts in this topic

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.

Share this post


Link to post
Share on other sites



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. :huh2:

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

So it would be something like one of these?

Autoit.exe Script.au3

or

AutoIT.exe & Script.au3

Thanks.

Edited by Mikeman27294

Share this post


Link to post
Share on other sites

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. :huh2:

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Why not use #include <script.au3>?

Include it at the point that you want to run the script.


#include <ByteMe.au3>

Share this post


Link to post
Share on other sites

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. :huh2:

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

#7 ·  Posted (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.

EDIT

Ok, I tried this and it didnt work

Run("AutoIt3.Exe" & $ScriptPath)

$Scriptpath is a predifined variable, and I even compiled the program to make sure it worked, but it didnt.

Edited by Mikeman27294

Share this post


Link to post
Share on other sites

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. :huh2:

M23

P.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._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Yep, that worked. I might then try bumping it up to run a selected file then?

Share this post


Link to post
Share on other sites

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. :huh2:

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! :alien:

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

#11 ·  Posted (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.

EDIT

Nope, that didnt work. I will try changing the includes then, to paths.

EDIT 2

Yep... 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 by Mikeman27294

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