TheDcoder

Is it a Good Idea?: $CmdLineRaw as a Macro

Commandline Dilemma   9 members have voted

  1. 1. What would be best option according to you?

    • Change $CmdLineRaw to @CmdLine and remove $CmdLine array
    • Change $CmdLineRaw to @CmdLine(Raw) and keep $CmdLine array
      0
    • Don't change anything!
    • Other (please specify)

Please sign in or register to vote in this poll.

22 posts in this topic

Hello! I am back with another IIAGI? (Is it a Good Idea?) :P

 

I think $CmdLineRaw is more like a macro than a "special" variable (which cannot be changed)... So making ti @CmdLineRaw would make more sense and there will 1 less exception to variables :D, I know that you were wondering about the $CmdLine "special" array... I didn't forgot it, but I don't think a macro can be a array, so I just ignored it... Maybe removing the $CmdLine and changing $CmdLineRaw to @CmdLine would be nice if you ask me :).

 

Think before choosing! TD :D

 

P.S Feel free to disagree with me, I want hear your opinion as well :).


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



changing anything in $CmdLine[] & $CmdLineRaw now, will give a whole new meaning to the concept of maintaining backward compatibility ;)

in practice, it is true that AutoIt is somewhat lacking in it's way of handling command line arguments; that's why several users have come up with their own methods and UDF. this is one such example:

Share this post


Link to post
Share on other sites

I think it would be better to have both @CmdLine and @CmdLineRaw.

A macro better expresses the behavior of $cmdline and by keeping both.

But this would also make breaking changes for little gain.


All my projects live on github

Share this post


Link to post
Share on other sites

@orbs Yeah, but the people who want those feature can use older version (like @TheSaint)

@MachinistProgrammer Hmm... a macro array? :think:, While I agree that it will create breaking changes, AutoIt Coder can easily fix the issue by using a simple Replace operation :)

 

TD :D


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

A macro by definition is a quick way of getting some run-time system information which may differ from machine to machine. the command line parameters are not like that they are absolute and provided by the user.

I initially cannot see a reason to have it look like a macro.


AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites

@JohnOne What about @MIN @SEC etc?

 

I need to go, I will be back later, TD :bye:


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

#7 ·  Posted (edited)

At run-time, you don't know what @sec is, and it changes, well, every second. while command line is still absolute and remains so for the lifetime of your script.

EDIT:

I might be similar to doing this...

Global Const $GCONST = 99.9

$value = 100 / _GetGlobalConst()

Func _GetGlobalConst()
    Return $GCONST
EndFunc

 

Edited by JohnOne

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites

@JohnOne How do you explain @CRLF then? They remain the same the whole life :P. This Quote is taken from the help file:

...macros are generally used to provide easy access to system information...

As you can see that macros "generally" provide easy access to system... There is no rule that the should only provide "that", viz. the birth of @CRLF :lol:


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

@JohnOne :shocked: R-R-Really?


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

What about @WorkingDir? Its set by the user too... I guess...


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

Every AutoIt macro is there to save you from writing a bunch of lines yourself to get the correct information, you can list them all one by one if you wish to but it wont change it.

With $CommandLineRaw, you'd be replacing $ with @ and probably making some internal call which is not needed.

I've tried, but still cannot see a single valid reason to have it.

1 person likes this

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites

:think:... Yet, I lose again :P

 

Good job, J1 :)


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

True :)


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

Except a little naivety perhaps .... we all try to lose that.


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

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Share this post


Link to post
Share on other sites

A Line Feed or Carriage Return can be different from machine to machine.

Don't think this is 100% correct. I would have said that a "newline" is sometime CRLF and sometimes either LF or CR.
 

On this topic in general: it feels like some people have way too much time on their hands to come up with these kind of proposals and have this lengthy discussion about it.
These design decision where made a long time ago and honestly fail to see the benefit of any change other than when the goal is to confuse people. :)

.Jos

1 person likes this

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

some people have way too much time on their hands to come up with these kind of proposals and have this lengthy discussion about it.

:shifty::idea::lmao:o:)


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

    • 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
    • VIP
      By VIP
      Full Document: https://www.autoitscript.com/autoit3/docs/intro/running.htm
      Application used for checking CMD input into the application! (Attached with source) 


      Use: testCMD.exe CMD1 CMD2 CMD3 CMD.n..

      Quick source: 
       
      #NoTrayIcon ;~ #include <WinAPIShPath.au3> Global Const $iShow_MsgBox = 1, $iCmdLineRaw = @Compiled ? $CmdLineRaw : "" ;//; $CmdLineRaw ; StringReplace($CmdLineRaw, '/ErrorStdOut "' & @ScriptFullPath & '" ', "") Global $icmdMsgBox, $icmdConsole, $iCmdLine = _WinAPI_CommandLineToArgv($iCmdLineRaw) Global $ExeInfo = "-Execute: " & @ScriptFullPath & @CRLF & "-Working Dir: " & @WorkingDir Global $SysInfo = "> " & @OSVersion & "/" & @OSArch & "/" & @OSServicePack & " - UserName: " & @UserName & " (Is Admin = " & IsAdmin() & ")" ConsoleWrite(@CRLF & $SysInfo & @CRLF & "+ CommandLine Checker " & @CRLF) If @error Or ($iCmdLine[0] = 0) Then ConsoleWrite("! Error: no comnand line!" & @CRLF & @CRLF) If $iShow_MsgBox Then MsgBox(48 + 262144, "CommandLine Checker", "Error: no comnand line!" & @CRLF & @CRLF & $ExeInfo & @CRLF & @CRLF & $SysInfo) Exit 1 EndIf ConsoleWrite($ExeInfo & @CRLF & "+ Comnand List:" & @CRLF) For $i = 1 To $iCmdLine[0] $icmdConsole = "- CMD_" & $i & " = " & $iCmdLine[$i] & @CRLF ConsoleWrite($icmdConsole) $icmdMsgBox &= " " & $icmdConsole Next If $iShow_MsgBox Then MsgBox(64 + 262144, "CommandLine Checker", $ExeInfo & @CRLF & "+ Comnand List:" & @CRLF & $icmdMsgBox & @CRLF & @CRLF & $SysInfo) Exit 0 #Region Internal Functions :: WinAPIShPath.au3 Func _WinAPI_CommandLineToArgv($sCmd) Local $aResult[1] = [0] $sCmd = StringStripWS($sCmd, 1 + 2) ;$STR_STRIPLEADING = 1 / $STR_STRIPTRAILING = 2 If Not $sCmd Then Return $aResult EndIf Local $aRet = DllCall('shell32.dll', 'ptr', 'CommandLineToArgvW', 'wstr', $sCmd, 'int*', 0) If @error Or Not $aRet[0] Or (Not $aRet[2]) Then Return SetError(@error + 10, @extended, 0) Local $tPtr = DllStructCreate('ptr[' & $aRet[2] & ']', $aRet[0]) Dim $aResult[$aRet[2] + 1] = [$aRet[2]] For $i = 1 To $aRet[2] $aResult[$i] = _WinAPI_GetString(DllStructGetData($tPtr, 1, $i)) Next DllCall("kernel32.dll", "handle", "LocalFree", "handle", $aRet[0]) Return $aResult EndFunc ;==>_WinAPI_CommandLineToArgv Func _WinAPI_GetString($pString, $bUnicode = True) Local $iLength = _WinAPI_StrLen($pString, $bUnicode) If @error Or Not $iLength Then Return SetError(@error + 10, @extended, '') Local $tString = DllStructCreate(__Iif($bUnicode, 'wchar', 'char') & '[' & ($iLength + 1) & ']', $pString) If @error Then Return SetError(@error, @extended, '') Return SetExtended($iLength, DllStructGetData($tString, 1)) EndFunc ;==>_WinAPI_GetString Func _WinAPI_StrLen($pString, $bUnicode = True) Local $W = '' If $bUnicode Then $W = 'W' Local $aRet = DllCall('kernel32.dll', 'int', 'lstrlen' & $W, 'struct*', $pString) If @error Then Return SetError(@error, @extended, 0) Return $aRet[0] EndFunc ;==>_WinAPI_StrLen Func __Iif($bTest, $vTrue, $vFalse) Return $bTest ? $vTrue : $vFalse EndFunc ;==>__Iif #EndRegion Internal Functions :: WinAPIShPath.au3 ; * -----:| Dao Van Trong - TRONG.WIN  
      CMDtest.zip
    • SkysLastChance
      By SkysLastChance
      I have a Razer Blackwidow Ultimate keyboard that has 5 extra keys marked M1 - M5. I was wondering if I would be able to setup Macros in AutoIt using these.
      I saw that Fn key is not possible. 
      I am also aware that the M1 keys work with razor snyapse. However, I am at work and can't download that program.
      If someone could let me know and point me in the right direction if it is possible I would be grateful.
    • TheAutomator
      By TheAutomator
      How can you get the downloads folder in AutoIT?
      As far as i know there isn't a macro for it right? like @Downloads or something?
      The ugly solution would be typing in the whole path but what if the user has chosen another location?
      Need to clear that folder regularly on my work and on different accounts..
      regards, TheAutomator
    • ur
      By ur
      I wrote a macro for outlook to send an email.
      Till yesterday it worked, don't know why it is not working today
      I am getting below error when I ran the macro.