monitorlg Posted April 3, 2009 Share Posted April 3, 2009 Hi All, I am trying to call a script from other script but i am not able to do that... Here is my code: $abc = ShellExecute("Audio.au3", "", @ScriptDir) msgbox(0,"",$abc) The msgbox returns to me 1, that means calling the script is success, But still the script is not called... Can anybody help me... Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted April 3, 2009 Moderators Share Posted April 3, 2009 (edited) Your au3 file is a script, so you can't just expect it to run as an executable without compiling it first using functions like ShellExecute/OpenProcess API/ or Run. One way to do what you want is something like: Global $s_file_to_run = @ScriptDir & "\Audio.au3" Run('"' & @AutoItExe & '" /AutoIt3ExecuteScript "' & $s_script_to_run & '"') Edited April 3, 2009 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
monitorlg Posted April 3, 2009 Author Share Posted April 3, 2009 Hi All, I have two queries. a) I have two scripts. I want to call a Function Of script2 from Script 1. Does anybody know how can we acheieve it. b)Does AUTOIT support Object oriented Programming... Please Reply to me. Thanks in Advance.. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted April 3, 2009 Moderators Share Posted April 3, 2009 (edited) Hi All,I have two queries.a) I have two scripts.I want to call a Function Of script2 from Script 1.Does anybody know how can we acheieve it.b)Does AUTOIT support Object oriented Programming...Please Reply to me.Thanks in Advance..Your impatience is on the edge of annoying. Don't double post.Now, if you are just wanting to call functions from a script that isn't hard coded to run something, then you can use that .au3 (other file) as an #include in "script 1". Otherwise, you can hard code it and do as I suggested in the previous post.On your 2nd question, There is a manual/help file for you to read that can answer most of your questions if you take the time to do so.<merged> Edited April 3, 2009 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
monitorlg Posted April 3, 2009 Author Share Posted April 3, 2009 Your impatience is on the edge of annoying. Don't double post.Now, if you are just wanting to call functions from a script that isn't hard coded to run something, then you can use that .au3 (other file) as an #include in "script 1". Otherwise, you can hard code it and do as I suggested in the previous post.On your 2nd question, There is a manual/help file for you to read that can answer most of your questions if you take the time to do so.<merged>@SmOke_N, Thanks... Your code works.and I was not impatient, if u read my post clearly u can notice that i have posted abt calling a script in post 1 and calling a function in another script in post2...I cannot hardcode the funtion in the script 1. I had no means to annoy anyone and neither i was impatient.For my second question i read the help file..but i was not able to come to a conclusion so i had posted it thinking any body would have helped me..I Can understand that u being a moderator is more worried for the duplicate posts and unwanted posts..you want everybody to abide the rules while posting in the Forum..But i would request you to read the the posts and then comment if they are duplicate posts or not....Thanks for the Help.. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted April 3, 2009 Moderators Share Posted April 3, 2009 (edited) @SmOke_N, Thanks... Your code works.and I was not impatient, if u read my post clearly u can notice that i have posted abt calling a script in post 1 and calling a function in another script in post2...I cannot hardcode the funtion in the script 1. I had no means to annoy anyone and neither i was impatient.For my second question i read the help file..but i was not able to come to a conclusion so i had posted it thinking any body would have helped me..I Can understand that u being a moderator is more worried for the duplicate posts and unwanted posts..you want everybody to abide the rules while posting in the Forum..But i would request you to read the the posts and then comment if they are duplicate posts or not....Thanks for the Help..http://www.autoitscript.com/forum/index.ph...highlite=%2BOOPThird topic down, 2nd post by Valik.That's 15 seconds I'll never get back Edited April 3, 2009 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
LoranRendel Posted May 19, 2009 Share Posted May 19, 2009 May be a function from Script_2 be called from Script_1 without including it? I need to compile Script_1, and this compiled script should call a function from script_2.a3x Link to comment Share on other sites More sharing options...
Diception Posted May 19, 2009 Share Posted May 19, 2009 May be a function from Script_2 be called from Script_1 without including it? I need to compile Script_1, and this compiled script should call a function from script_2.a3xyes you can call a funtion from a second or even tenth script by using includes and when you compile a script that uses includes it .... wait for it .... it includes that other script into the compiled exe Your welcome 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