fmen Posted June 20, 2005 Posted June 20, 2005 I am trying to run an au3 script from inside of another script without success: If $msg = $bphone Then #include ("D:\HK\Phone.au3") or If $msg = $bphone Then run ("D:\HK\Phone.au3") Both do not work... Run works only when I make Phone.au3 an executable file. Any suggestions how to run a script inside a script? Thanks.
GaryFrost Posted June 20, 2005 Posted June 20, 2005 I am trying to run an au3 script from inside of another script without success:If $msg = $bphone Then #include ("D:\HK\Phone.au3") orIf $msg = $bphone Then run ("D:\HK\Phone.au3")Both do not work...Run works only when I make Phone.au3 an executable file.Any suggestions how to run a script inside a script? Thanks.<{POST_SNAPBACK}>Instead of trying to run the fileHave a function in the file that you callFor Example:#include "D:\HK\Phone.au3" If $msg = $bphone Then Phone() SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
fmen Posted June 20, 2005 Author Posted June 20, 2005 Instead of trying to run the fileHave a function in the file that you callFor Example:#include "D:\HK\Phone.au3" If $msg = $bphone Then Phone()<{POST_SNAPBACK}>===========================================Thanks but....Error on loading file:If $msg = $bphone Then Phone()If $msg = $bphone Then ^ERROR
MSLx Fanboy Posted June 20, 2005 Posted June 20, 2005 Both of the things you are trying to do are using the wrong syntax. The #include is a preprocessor instruction, so that entire file is dumped into the script without regard to the if statement. Also, there are only 4 types of files that can be natively executed in Run(): EXE, BAT, COM, or PIF. Other files need an interpreter or another program to execute them (msi files need msiexec.exe, etc) gafrost's method should work fine for what you want to do, just make a function around the entire include file, and call the function if it matches the statement Writing AutoIt scripts since _DateAdd("d", -2, _NowCalcDate())
JSThePatriot Posted June 20, 2005 Posted June 20, 2005 I would say that is a dirty method. It may be his only choice. He can always use Run() in conjunction with AutoIt3.exe. If I am not mistaken you can run a script using the command line. So that would be the cleanest option if he absolutly must not turn his script into an exe. My thoughts, JS AutoIt Links File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out. ComputerGetInfo UDF's Updated! 11-23-2006 External Links Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)
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