Jump to content
Sign in to follow this  

Need help in getting parameters from command line

Recommended Posts



I have referred one of the sample program created by someone to open 5250 session using EHLAPI function. I am able to get into the screen but my requirment is to pass account number from command line and query the screen with account number.

following is my code where am accepting parameteres:

include <Array.au3>

#include <GUIConstantsEx.au3>

Global $dataSrting1 = " "

ReadCmdLineParams(); am calling this function to get the input parameter from command line.

Func ReadCmdLineParams()

$value= 0

for $i = 1 to $cmdLine[0]; $cmdline[0] gives you total no of parameters passed to program


case $CmdLine[$i] <> " "

if $i == $CmdLine[0] Then

$dataSrting1 = $cmdLine[1]





following is the function code which navigates me to the screen


sendCR(); is used to pass Enter button









sendtext('$dataSrting1'); this code is not working as account number from command line is not getting passed from $datastring1


I am calling my progrm from command prompt as below

C:\Documents and Settings\anantkulkarni\Desktop>test.exe 8029639

C:\Documents and Settings\anantkulkarni\Desktop>test.exe "8029639"

C:\Documents and Settings\anantkulkarni\Desktop>test.exe param1 "8029639"

none of the above three are working, my application is getting started but the place where I am passing this account number is not working properly. I meant I can not search the screen with account number as8029639.

Any help in this is greatly appreciated. I know this is very basic question and I bet have gone through all the help contents and other forum threads to get solution but unfortunately did not get any soution.

Note: I have compiled by application test.exe by pressing (ctrl+F7)

Kindly let me know if you need more details.

Thanking in advance.



Share this post

Link to post
Share on other sites


Welcome to the AutoIt forum :)

I see a couple of mistakes in your script.

Note that the equal sign is automatically handled in AutoIt, meaning that you need only one to assign or to check equality.

$i == $cmdLine[0] ;makes no sense, == is only valid for strings (case sensitive).
$i = $CmdLine[0] ;better

Fortunately it's not a problem since AutoIt is not a typed variable language.

Where it's critical, it's when you pass a variable as a string in parameter, you need to pass the variable itself.


Br, FireFox.

Edited by FireFox


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

I would recommend not to use Send but one of the Control* functions. They are much more reliable.

Which program do you try to automate?

My UDFs and Tutorials:


Active Directory (NEW 2018-12-03 - Version - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki

ADO - Wiki


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