au3scr Posted December 18, 2008 Posted December 18, 2008 Does anyone know why this code dont work? _RunAu3AsExe('SOMESCRIPT.AU3') ;Be sure to add a space before any param string Func _RunAu3AsExe($hAutoItExe, $hFileIn, $strParams = "", $sWorkingDir = "", $sShowHide = @SW_HIDE, $nSTDOut = 0);Returns PID of newly spawned exe Return Run('"' & $hAutoItExe & '" /AutoIt3ExecuteScript "' & _ $hFileIn & '"' & $strParams, $sWorkingDir, $sShowHide, $nSTDOut) EndFunc ;==>_RunAu3AsExe and error >"C:\Program Files\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "C:\Documents and Settings\Rain\My Documents\yguyg5.au3" /autoit3dir "C:\Program Files\AutoIt3" /UserParams +>23:47:40 Starting AutoIt3Wrapper v.1.10.1.14 Environment(Language:0409 Keyboard:00000425 OS:WIN_XP/Service Pack 2 CPU:X86 ANSI) >Running AU3Check (1.54.13.0) from:C:\Program Files\AutoIt3 C:\Documents and Settings\Rain\My Documents\yguyg5.au3(3,147) : ERROR: _RunAu3AsExe() called by a previous line with 1 arg(s). Min = 2. First previous line calling this Func is 1. Func _RunAu3AsExe($hAutoItExe, $hFileIn, $strParams = "", $sWorkingDir = "", $sShowHide = @SW_HIDE, $nSTDOut = 0);Returns PID of newly spawned exe ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ C:\Documents and Settings\Rain\My Documents\yguyg5.au3 - 1 error(s), 0 warning(s) !>23:47:40 AU3Check ended.rc:2 +>23:47:58 AutoIt3Wrapper Finished >Exit code: 0 Time: 18.487
FireFox Posted December 18, 2008 Posted December 18, 2008 Hi, This should be better : ShellExecute("Script.au3") Run("AutoIt3.exe","Script.au3")
MrCreatoR Posted December 18, 2008 Posted December 18, 2008 Try this: _RunAu3AsExe('SomeScript.au3') ;Returns PID of newly spawned exe Func _RunAu3AsExe($sScriptFile, $sParams = "", $sWorkDir = @WorkingDir, $nState = @SW_HIDE, $nSTDOut = 0) Local $sAu3Exe = @AutoItExe If @Compiled Then $sAu3Exe = @ScriptFullPath ;Can be ommited, it's the same as @AutoItExe when compiled Return Run('"' & $sAu3Exe & '" /ErrorStdOut /AutoIt3ExecuteScript "' & $sScriptFile & '"' & $sParams,$sWorkDir,$nState,$nSTDOut) EndFunc Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team
herewasplato Posted December 18, 2008 Posted December 18, 2008 Does anyone know why this code dont work? _RunAu3AsExe('SOMESCRIPT.AU3') ;Be sure to add a space before any param string Func _RunAu3AsExe($hAutoItExe, $hFileIn, $strParams = "", $sWorkingDir = "", $sShowHide = @SW_HIDE, $nSTDOut = 0);Returns PID of newly spawned exe Return Run('"' & $hAutoItExe & '" /AutoIt3ExecuteScript "' & _ $hFileIn & '"' & $strParams, $sWorkingDir, $sShowHide, $nSTDOut) EndFunc ;==>_RunAu3AsExe and error >"C:\Program Files\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "C:\Documents and Settings\Rain\My Documents\yguyg5.au3" /autoit3dir "C:\Program Files\AutoIt3" /UserParams +>23:47:40 Starting AutoIt3Wrapper v.1.10.1.14 Environment(Language:0409 Keyboard:00000425 OS:WIN_XP/Service Pack 2 CPU:X86 ANSI) >Running AU3Check (1.54.13.0) from:C:\Program Files\AutoIt3 C:\Documents and Settings\Rain\My Documents\yguyg5.au3(3,147) : ERROR: _RunAu3AsExe() called by a previous line with 1 arg(s). Min = 2. First previous line calling this Func is 1. Func _RunAu3AsExe($hAutoItExe, $hFileIn, $strParams = "", $sWorkingDir = "", $sShowHide = @SW_HIDE, $nSTDOut = 0);Returns PID of newly spawned exe ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ C:\Documents and Settings\Rain\My Documents\yguyg5.au3 - 1 error(s), 0 warning(s) !>23:47:40 AU3Check ended.rc:2 +>23:47:58 AutoIt3Wrapper Finished >Exit code: 0 Time: 18.487 The output states: ERROR: _RunAu3AsExe() called by a previous line with 1 arg(s). Min = 2. You called the UDF with _RunAu3AsExe('SOMESCRIPT.AU3') try _RunAu3AsExe(@ScriptFullPath, 'SOMESCRIPT.AU3') From the help file: Execute another script file from a compiled AutoIt3 Script File. Then you don't need to fileinstall another copy of AutoIT3.exe in your compiled file. or try _RunAu3AsExe(@AutoItExe, 'SOMESCRIPT.AU3') if AutoIt is installed [size="1"][font="Arial"].[u].[/u][/font][/size]
MHz Posted December 19, 2008 Posted December 19, 2008 The 1st parameter in the original UDF is pointless as /AutoItExecuteScript uses the value of @AutoItExe whether compiled or not. Updated to only what is needed. _RunAu3AsExe('SOMESCRIPT.AU3') ;Be sure to add a space before any param string Func _RunAu3AsExe($strFileIn, $strParams = "", $sWorkingDir = "", $sShowHide = @SW_HIDE, $nSTDOut = 0);Returns PID of newly spawned exe Return Run('"' & @AutoItExe & '" /AutoIt3ExecuteScript "' & _ $strFileIn & '"' & $strParams, $sWorkingDir, $sShowHide, $nSTDOut) EndFunc ;==>_RunAu3AsExe Note that the reply of ShellExecute() depends on the default verb set to run unless a verb is supplied. Not everyone uses the same value for the default verb.
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