Jump to content
Sign in to follow this  
au3scr

Why _RunAu3AsExe dont work?

Recommended Posts

au3scr

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

Share this post


Link to post
Share on other sites
FireFox

Hi,

This should be better :

ShellExecute("Script.au3")

Run("AutoIt3.exe","Script.au3")

 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
au3scr

thanks for quick replay


Share this post


Link to post
Share on other sites
MrCreatoR

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_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: 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 Program

AutoIt_Icon_small.pngUDFs: 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
 
AutoIt_Icon_small.pngExamples: 
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 AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Share this post


Link to post
Share on other sites
herewasplato

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]

Share this post


Link to post
Share on other sites
MHz

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.

:)

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  

×