Jump to content

Recommended Posts

Posted (edited)

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
Posted (edited)

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
Posted (edited)

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 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Posted

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??
Posted (edited)

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 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Posted

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.
Posted (edited)

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
Posted

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.

Posted

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.

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...