Hi, I was wondering if it's possible to include only a part of the script included.
For Example:
MAIN SCRIPT:
#include C:\SUBSCRIPT.apk
SUBSCRIPT:
msgbox, string 1
msgbox, string 2
msgbox, string 3
Is it possible to start the included script from msgbox, string 2 or msgbox, string 3?
Thanks in advice
#include only a part of the script included
-
- Posts: 440
- Joined: 28 Apr 2018, 21:59
Re: #include only a part of the script included
If you make the subscript a bunch of functions then depending on what you have in the main script you could have the second string appear first. But it would have to be something like this
You could also use the Run command to run the second script and pass a parameter, and use that parameter to say to skip the first one, but functions might be easier for you to use.
Code: Select all
MAIN SCRIPT:
#include C:\SUBSCRIPT.apk
function2(string)
SUBSCRIPT:
function1(string) {
msgbox, string 1
}
function2(string) {
msgbox, string 2
}
function3(string) {
msgbox, string 3
}
Re: #include only a part of the script included
Something like this perhaps, using GoSub. Cheers.
Code: Select all
MsgBox, % "1 auto-execute section"
GoSub MyLabel
return
MsgBox, % "x" ;not executed
MyLabel:
MsgBox, % "2"
return
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
Re: #include only a part of the script included
Thanks for the reply, unfortunately when I launch the script a messagge appear:MannyKSoSo wrote: ↑13 Dec 2018, 09:37If you make the subscript a bunch of functions then depending on what you have in the main script you could have the second string appear first. But it would have to be something like thisYou could also use the Run command to run the second script and pass a parameter, and use that parameter to say to skip the first one, but functions might be easier for you to use.Code: Select all
MAIN SCRIPT: #include C:\SUBSCRIPT.apk function2(string) SUBSCRIPT: function1(string) { msgbox, string 1 } function2(string) { msgbox, string 2 } function3(string) { msgbox, string 3 }
Line Text:function1(string)
Error: Parameters of hotkey functions must be optional.
-
- Posts: 440
- Joined: 28 Apr 2018, 21:59
Re: #include only a part of the script included
Sorry for the confusion, but they were meant to be separated like so
MAIN SCRIPT:
SUBSCRIPT:
MAIN SCRIPT:
Code: Select all
#include C:\SUBSCRIPT.ahk
string := "this"
function2(string)
Code: Select all
function1(string) {
msgbox, string 1
}
function2(string) {
msgbox, string 2
}
function3(string) {
msgbox, string 3
}
Last edited by MannyKSoSo on 19 Dec 2018, 09:21, edited 1 time in total.
Re: #include only a part of the script included
Thank you again, I wrote them separately from the first time, but the error still remain
-
- Posts: 440
- Joined: 28 Apr 2018, 21:59
Re: #include only a part of the script included
I have adjusted and tested it above and got it to work on my side. Make sure that the subscript.ahk file is in the exact location as stated in the includes (if it is in the same folder simply just state the subscript.ahk without any directory).
Who is online
Users browsing this forum: Hile82, inseption86, peter_ahk and 117 guests