Jump to content
Naumishe

Can't transfer parameters into script

Recommended Posts

Naumishe

Hi all!

After reinstall OS - Windows 10 Home get some new problem for me with AutoIT.

There is 1 little script test.au3- 

Quote

#include <MsgBoxConstants.au3>

MsgBox($MB_SYSTEMMODAL, "Title", $cmdline[0], 10)

If I run it from CMD or powershell by command -

test.au3 12312312312

I get "0" instead of "1". So I think that something in my new OS prevents to transfer parameters into script.

Someone knows what happened?

Share this post


Link to post
Share on other sites
water

When I use

"C:\Program Files (x86)\AutoIt3\autoit3.exe" C:\temp\test_CMD.au3 123

it works just fine.
You are sure that the file type association of au3 is correct?


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
Naumishe

Off course, I receive window from Auto IT with title - "Title" and variable $cmdline[0] that just 0 instead of 1.

P.S. On other computer it all work fine.

Share this post


Link to post
Share on other sites
Naumishe

Sorry, if I type in cmd 

"c:\Program Files (x86)\AutoIt3\AutoIt3.exe" test.au3 123         it is show me 1

test.au3 123 it is show me 0

WTF? 

Share this post


Link to post
Share on other sites
water

Is there another test.au3 in another directory that gets executed by Windows?


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
Naumishe

No. It is my script  - show Msgbox with title "Title" and in windows - text $cmdline[0] that show how many parameters was send to script.

If I just launch script something prevents transferring parameters and it is show 0

 

Share this post


Link to post
Share on other sites
water

What do you get if you run

#include <MsgBoxConstants.au3>
MsgBox($MB_SYSTEMMODAL, "Title", ">>" & $CmdLineRaw & "<<", 10)

 


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
Naumishe

---------------------------
Title
---------------------------
>>"C:\Users\Naum\Desktop\test2\test3.au3"<<
---------------------------
ОК   
---------------------------
 

Share this post


Link to post
Share on other sites
water

When you double click your script in Windows Explorer does it get executed or does this start SciTE for editing the script source?


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
Naumishe

Double click ot script execute it and I see Msgbox Window (with 0 or last message).

Share this post


Link to post
Share on other sites
PACaleala

@Naumishe $cmdline[0] is just a counter .

Re-read AutoIt help file about "Running Scripts - Command Line Parameters"

Share this post


Link to post
Share on other sites
water

True. But even the counter should return a value > 0 when parameters are passed to the script.
It seems that the way the OP calls the script parameters aren't accepted.


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

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

×