TheDcoder

Weird error with script which accepts commandline arguments

5 posts in this topic

I Compile this:

#include <Array.au3>
#include <WinAPIShPath.au3>

Local $aData = _WinAPI_CommandLineToArgv('"a b" c d')
_ArrayDisplay($aData, '_WinAPI_CommandLineToArgv')

Pass commandline arguments with cmd and I get this:

QdpU.png

Thanks in advance :)


AutoIt.4.Life Clubrooms - Life is like a Donut (secret key)

Spoiler

My contributions to the AutoIt Community

Some messages & Apologizes:

If I hurt you, Please accept my apologies, I never (regardless of the situation) mean to hurt anybody!!!

Also, I am very busy with my project so I will appear in the last row of the online list, if you want to contact me: Email@TheDcoder.xyz

Or you can have a nice chat with me in freenode, I use the same nick on freenode too!

3fHNZJ.gif

PLEASE JOIN ##AutoIt AND HELP THE IRC AUTOIT COMMUNITY!

Share this post


Link to post
Share on other sites



The error make no sense. Probably an AV issue.

Further use this, when you want to provide command line arguments:

#include <Array.au3>
#include <WinAPIShPath.au3>

Local $aData = _WinAPI_CommandLineToArgv($CmdLineRaw)
_ArrayDisplay($aData, '_WinAPI_CommandLineToArgv')

Br,

UEZ


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

Just curious, why you'd use _WinAPI_CommandLineToArgv($CmdLineRaw) over the built in $CmdLine array?


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

@UEZ Same error, even with AV Disabled


AutoIt.4.Life Clubrooms - Life is like a Donut (secret key)

Spoiler

My contributions to the AutoIt Community

Some messages & Apologizes:

If I hurt you, Please accept my apologies, I never (regardless of the situation) mean to hurt anybody!!!

Also, I am very busy with my project so I will appear in the last row of the online list, if you want to contact me: Email@TheDcoder.xyz

Or you can have a nice chat with me in freenode, I use the same nick on freenode too!

3fHNZJ.gif

PLEASE JOIN ##AutoIt AND HELP THE IRC AUTOIT COMMUNITY!

Share this post


Link to post
Share on other sites

Disable AV before compile :)


AutoIt.4.Life Clubrooms - Life is like a Donut (secret key)

Spoiler

My contributions to the AutoIt Community

Some messages & Apologizes:

If I hurt you, Please accept my apologies, I never (regardless of the situation) mean to hurt anybody!!!

Also, I am very busy with my project so I will appear in the last row of the online list, if you want to contact me: Email@TheDcoder.xyz

Or you can have a nice chat with me in freenode, I use the same nick on freenode too!

3fHNZJ.gif

PLEASE JOIN ##AutoIt AND HELP THE IRC AUTOIT COMMUNITY!

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

  • Similar Content

    • Miliardsto
      By Miliardsto
      Im creating a tab
      Global $Tab1 = GUICtrlCreateTab(30, 30, 600, 420, $TCS_BUTTONS, -1) And what we see in the function reference:
      https://www.autoitscript.com/autoit3/docs/functions/GUICtrlCreateTab.htm
      GUICtrlCreateTab ( left, top [, width [, height [, style = -1 [, exStyle = -1]]]] ) ok in 5 arg I got $TCS_BUTTONS
      But How can I use multiple args like this below
      Global $Tab1 = GUICtrlCreateTab(30, 30, 600, 420, [$TCS_BUTTONS, $TCS_MULTILINE], -1)  
    • TheDcoder
      By TheDcoder
      Hello Everyone , Are you tired of searching the forum for getting both the exit code & the stdout output? Then you are in the right place!

      With this UDF you can get the both output & exit code of the command or the console app! Or you can get the exit code of another process without having to use RunWait...
      Features:
      1. Simple & Lightweight (15 KB)
      2. Detailed comments & description
      3. Flexible functions with many optional parameters
      A BIG THANKS TO PsaltyDS for the functions! 2 of the (main) functions in the UDF are his work
       
      List of functions:
      Downloads:
      Grab the latest (in development) code from GitHub
       
      Hope it may help you, TD
       
      P.S Icon made by Freepik from www.flaticon.com, Modified by TheDcoder
    • StMaSi
      By StMaSi
      If I am using a RunWait command to launch a batch file from within an AutoIt script, how can I pass a variable to said batch file so that the batch file can utilize said variable like in a %var% format? Thank you in advance.
    • FMS
      By FMS
      Hello,
      I've made a GUI that can send multiple commands.
      The way I'm doing this at the moment is whit "send" commands.
      also first go to the right directory where the "to be used" program sits
      And send from there the commandline argument whit parameters.
      Here is a example of the way I'm using it now:
      Func restart_app($xip) Run("C:\WINDOWS\system32\cmd.exe") WinWaitActive("C:\WINDOWS\system32\cmd.exe") Sleep(50) send("cd\" & "{ENTER}") Sleep(50) send("cd Tools" & "{ENTER}") Sleep(50) send("pskill \\" & $$xip & " -u username -p pass /accepteula app.exe" & "{ENTER}") EndFunc This way is working and I got no problems whit this.
      Also I realy think there is a mush better and way to do the same and maybe a little bit less error free
      (even better if this is hidden for the user :))
      On this forum I could not find anything related to this subject (or I was not looking in the right direction) and hope somebody knows a better way
      Is there a way where u can send the arguments and parameters directly in 1 line to the commandpromt whitout using "send" to commandprompt?
      Thanks in advanced

      ps: I also tried :
      ShellExecute("pskill", "\\" & $xip & " -u username -p pass /accepteula app.exe")

      But din't work
    • ur
      By ur
      I need to write a code in which I am reading a text file which is of .vbs format and in that a line contains function signature like below
      Function CreateEnvironmentVariable($sType, $sName, $sValue, $bOverwrite)
      If the string is in above format, then I need to check number of arguments in it.
      For in above case it should return 4.
      Can anyone help me on this.