Jump to content
Sign in to follow this  
Kris123

Exe is not running when passes any arguements

Recommended Posts

Kris123

Dear all,

i am sending arguements to my exe from my main script.

But exe is not executing. Please help me out.

Main script code

Run( '"' & $AutoItexePath & '\AutoIt3.exe' & @ScriptDir & "\Hai.au3" & "10" & ' ' & "20" & ' ' & "30")

my exe code

msgbox(64, "Hello", $CmdLine[0])
Edited by Kris123

Share this post


Link to post
Share on other sites
Juvigy

I think you need to add spaces between your script name and the parameters.

Run( '"' & $AutoItexePath & '\AutoIt3.exe' & @ScriptDir & "\Hai.au3" & "10" & ' ' & "20" & ' ' & "30")

this should be

Run( '"' & $AutoItexePath & '\AutoIt3.exe' & @ScriptDir & "\Hai.au3 10 20 30")

Edited by Juvigy

Share this post


Link to post
Share on other sites
water

You have to insert some spaces:

Run($AutoItexePath & "\AutoIt3.exe " & @ScriptDir & "\Hai.au3 10 20 30")
Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
Kris123

No yar it is still not working

Share this post


Link to post
Share on other sites
Kris123

In my main code i am putting these statements.

$AutoItProdexePath = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\AutoIt v3\AutoIt","InstallDir");installDir for production

$AutoItBetaexePath = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\AutoIt v3\AutoIt","betaInstallDir");installDir for production

$AutoItexePath = $AutoItProdexePath;default to beta??

Share this post


Link to post
Share on other sites
water

Are there any spaces in your $AutoItexePath or the @ScriptDir?

EDIT: I tried with spaces in the $AutoItexePath and it still works.

Could you please post your complete code you are running now?

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
martin

In my main code i am putting these statements.

$AutoItProdexePath = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\AutoIt v3\AutoIt","InstallDir");installDir for production

$AutoItBetaexePath = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\AutoIt v3\AutoIt","betaInstallDir");installDir for production

$AutoItexePath = $AutoItProdexePath;default to beta??

If that is taken from where I think it is then you will see how Run is used a little further on in the script which might help.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites
Kris123

Hi water

my code is that only.

i don't have anything other than that. i trying this for some other purpose.

If it is works out , then i will try to implement.

Main script:

$AutoItProdexePath = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\AutoIt v3\AutoIt","InstallDir");installDir for production

$AutoItBetaexePath = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\AutoIt v3\AutoIt","betaInstallDir");installDir for production

$AutoItexePath = $AutoItProdexePath;default to beta??

Run( '"' & $AutoItexePath & '\AutoIt3.exe' & @ScriptDir & "\Hai.au3 10 20 30")

Exe Script :

msgbox(64, "Hello", "Hai I am in exe") msgbox(64, "Hello", $CmdLine[2])

Please help me.

Edited by Kris123

Share this post


Link to post
Share on other sites
Juvigy

I think you dont understand how this works. Let me illustrate that:

Create a script with only one line :

msgbox(64,"Number of parameters:"&$CmdLine[0], "Value of parameter number 2:"&$CmdLine[2])

Compile it to Command.exe and save it to c:\

Then open start menu>Run and type CMD > press OK

In the CMD window type:

1. cd\

2. command 10 20 30 40 50

The above line will start your newly created Command.exe with the 10 20 30 40 50 parameters.

Share this post


Link to post
Share on other sites
martin

Hi water

my code is that only.

i don't have anything other than that. i trying this for some other purpose.

If it is works out , then i will try to implement.

Main script:

$AutoItProdexePath = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\AutoIt v3\AutoIt","InstallDir");installDir for production

$AutoItBetaexePath = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\AutoIt v3\AutoIt","betaInstallDir");installDir for production

$AutoItexePath = $AutoItProdexePath;default to beta??

Run( '"' & $AutoItexePath & '\AutoIt3.exe' & @ScriptDir & "\Hai.au3 10 20 30")

Exe Script :

msgbox(64, "Hello", "Hai I am in exe") msgbox(64, "Hello", $CmdLine[2])

Please help me.

If you make the string for the Run parameter into a variable and print it out using ConsoleWrite you can usually see what is wrong.

$torun =  '"' & $AutoItexePath & '\AutoIt3.exe' & @ScriptDir & "\Hai.au3 10 20 30"
consolewrite($torun & @CRLF)

You need to put some thought into what that string is; you have an unbalanced quotation mark for example, no space between the exe and the @ScriptDir, no quotation marks around the script to run; it's a bit of a mess :)


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

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  

×