Mingre Posted July 19, 2016 Posted July 19, 2016 (edited) Hello, I just learned about /AutoIt3ExecuteLine to run lines outside your codes. The usual code passed to run a series of lines is to put all those lines in a single declaration line such as Local (see above post). But I learned through guinness' _InetGet() function (see below) another way of running series of lines: Local $cmd = 'Exit (msgBox(0, "First", "") ? 1 : 0) * (msgBox(0, "Second", "") ? 1 : 0)' My questions are: (1) Am I right in saying that the code below basically translates to the next one? Local $cmd = 'Exit (msgBox(0, "First", "") ? 1 : 0) * (msgBox(0, "Second", "") ? 1 : 0)' Local $sCommand = '"' & StringReplace($cmd, '"', "'") & '"' ConsoleWrite($sCommand & @CRLF) Run(@AutoItExe & ' /AutoIt3ExecuteLine ' & $sCommand) msgBox(0, "First", "") msgBox(0, "Second", "") Exit (2) Can someone explain how "( ? 1: 0)" works? I see them as ways to run two separate lines but using them as such won't allow me to run this: Local $sCommand = _ 'Exit (Local $x = msgBox(0, "First", "")) * (msgBox(0, "Second", "") ? 1 : 0)' $sCommand = '"' & StringReplace($sCommand, '"', "'") & '"' ConsoleWrite($sCommand & @CRLF) Run(@AutoItExe & ' /AutoIt3ExecuteLine ' & $sCommand) Thanks so much! Edited July 19, 2016 by Mingre Rephrased my questions.
Mingre Posted July 19, 2016 Author Posted July 19, 2016 To put all my questions simply: is there a pattern/syntax to convert an autoit program (say a couple of lines) to a single line that can be run with "/AutoIt3ExecuteLine"?
jguinch Posted July 19, 2016 Posted July 19, 2016 /AutoIt3ExecuteLine is made to execute one line of code. If your code cannot be written in one line, you have to put you code in an external file and use /AutoIt3ExecuteScript instead. In both cases, don't forget to put #pragma compile(AutoItExecuteAllowed, True) at the top of your main script Spoiler Network configuration UDF, _DirGetSizeByExtension, _UninstallList Firefox ConfigurationArray multi-dimensions, Printer Management UDF
Mingre Posted July 19, 2016 Author Posted July 19, 2016 @jguinch Thanks for the rep! But what confuses me is how this code (which translates to three lines in a typical autoit code) works. Local $sCommand = '(msgBox(0, "First", "") * (Tooltip("Boo!") * (msgBox(0, "Second", "")' $sCommand = '"' & StringReplace($sCommand, '"', "'") & '"' ConsoleWrite($sCommand & @CRLF) Run(@AutoItExe & ' /AutoIt3ExecuteLine ' & $sCommand) Do you know a list of notations, e.g., "( ) * ( )", that I can use? Thanks!
Mingre Posted July 19, 2016 Author Posted July 19, 2016 What I'm trying to achieve is to run a UDF (e.g., _ArrayDisplay) with this, but that requires #include... Local $sCommand = 'Local $x[2] = [0, 1], $dummy = _ArrayDisplay($x)' $sCommand = '"' & StringReplace($sCommand, '"', "'") & '"' ConsoleWrite($sCommand & @CRLF) Run(@AutoItExe & ' /AutoIt3ExecuteLine ' & $sCommand)
jguinch Posted July 19, 2016 Posted July 19, 2016 In your case,_ArrayDisplay needs #Include <Array.au3>. So a one line is not possible . Also, the computer needs to have the Array.au3 lib. Spoiler Network configuration UDF, _DirGetSizeByExtension, _UninstallList Firefox ConfigurationArray multi-dimensions, Printer Management UDF
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now