Sign in to follow this  
Followers 0
Unc3nZureD

How to execute() multiple lines at once?

16 posts in this topic

I know it's possible somehow, but I forgot how to do it, and can't find any resource.

Share this post


Link to post
Share on other sites



IIRC it was done by adding the return codes of the lines:

$iResult = (line 1) + (line 2) + (line 3)

But it might depend on the code you try to execute.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - 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

#4 ·  Posted (edited)

It is possible.

 

Example by Mars (26 lines of code):

Global $n = 20, $a = 'int', $m = @OSBuild, $x = DllStructCreate, $y = DllCall, $z = DllStructSetData, $t = Opt('GUIOnEventMode', 1), $b = 'handle', $1 = $x('uint Version;ptr Callback;bool NoThread;bool NoCodecs'), $2 = $x('ulong_ptr Data'), $t = $z($1, 'Version', 1), $3 = DllOpen(($m > 4999 And $m < 7600) ? @WindowsDir & '\winsxs\x86_microsoft.windows.gdiplus_6595b64144ccf1df_1.1.6000.16386_none_8df21b8362744ace\gdiplus.dll' : 'gdiplus.dll'), $t = $y($3, $a, 'GdiplusStartup', 'struct*', $2, 'struct*', $1, 'ptr', 0), $4 = DllStructGetData($2, 'Data'), $g = GUICreate('Fliegende Rechtecke (06.05.2014 Mars)', 512, 512), $d = $y('user32.dll', $b, 'GetDC', 'hwnd', $g)[0], $5 = 'GDI32.DLL', $6 = $y($5, $b, 'CreateCompatibleDC', $b, 0)[0], $7 = $x('struct;dword biSize;long biWidth;long biHeight;word biPlanes;word biBitCount;dword biCompression;dword biSizeImage;long biXPelsPerMeter;long biYPelsPerMeter;dword biClrUsed;dword biClrImportant;endstruct;dword biRGBQuad[1]'), $t = $z($7, 'biSize', 40) + $z($7, 'biWidth', 512) + $z($7, 'biHeight', -512) + $z($7, 'biPlanes', 1) + $z($7, 'biBitCount', 32), $p = DllStructGetPtr, $v = $y($5, 'ptr', 'CreateDIBSection', 'hwnd', 0, 'ptr', $p($7), 'uint', 0, 'ptr*', 0, 'ptr', 0, 'uint', 0)[0], $t = $y($5, $b, 'SelectObject', $b, $6, $b, $v), $8 = $y($3, $a, 'GdipCreateFromHDC', $b, $6, 'handle*', 0)[2], $9 = Random, $q[$n][9], $t = $y($3, $a, 'GdipSetSmoothingMode', $b, $8, $a, 4) + f(0, $n - 1, 'n($i,1)'), $j = $x('float;float'), $k = $x('float;float'), $t = GUISetOnEvent(-3, 'x') + GUISetState(), $02 = $x('float[8]')
Func f($s = 0, $e = 0, $w = 0, $o = '')
    Return ($s < $e) ? f($s + 1, $e, $w, Execute(StringReplace($w, '$i', $s, 0, 1))) : ''
EndFunc   ;==>f
Func a(ByRef $h, $r, $u, $c)
    $h[$r][$u] = $c
EndFunc   ;==>a
Func n($i, $09 = 0)
    Return a($q, $i, 1, $9(32, 256)) + a($q, $i, 0, $9(-$q[$i][1], 512 + $q[$i][1])) + a($q, $i, 2, 64 / $q[$i][1]) + a($q, $i, 3, 6 / ($q[$i][1] ^ 1.35) * ($9(0, 1, 1) ? -1 : 1)) + a($q, $i, 4, $9(0, (768) / $q[$i][2], 1) * $09) + a($q, $i, 5, '0x80' & Hex(Int($9(0, 255, 1)), 2) & Hex(Int($9(0, 255, 1)), 2) & Hex(Int($9(0, 255, 1)), 2)) + a($q, $i, 6, '0x80' & Hex(Int($9(0, 255, 1)), 2) & Hex(Int($9(0, 255, 1)), 2) & Hex(Int($9(0, 255, 1)), 2))
EndFunc   ;==>n
While Sleep(10)
    $t = $y($3, $a, 'GdipGraphicsClear', $b, $8, 'dword', 0xFF000000) + f(0, $n - 1, 'r($i)') + $y($5, 'bool', 'BitBlt', $b, $d, $a, 0, $a, 0, $a, 512, $a, 512, $b, $6, $a, 0, $a, 0, 'dword', 0xCC0020)
WEnd
Func r($i)
    Local $c = 768 - $q[$i][2] * $q[$i][4], $f = $q[$i][0], $l = $q[$i][3] * $q[$i][4], $w = $q[$i][1] / 2 ^ 0.5, $0[5][2] = [[0, 0],[$c - $w / 2, $f - $w / 2],[$c - $w / 2, $f + $w / 2],[$c + $w / 2, $f + $w / 2],[$c + $w / 2, $f - $w / 2]], $t = t($0[1][0], $0[1][1], $l, $c, $f) + t($0[2][0], $0[2][1], $l, $c, $f) + t($0[3][0], $0[3][1], $l, $c, $f) + t($0[4][0], $0[4][1], $l, $c, $f) + $z($j, 1, $0[1][0]) + $z($j, 2, $0[1][1]) + $z($k, 1, $0[3][0]) + $z($k, 2, $0[3][1]), $01 = $y($3, $a, 'GdipCreateLineBrush', 'struct*', $j, 'struct*', $k, 'uint', $q[$i][5], 'uint', $q[$i][6], $a, 0, 'handle*', 0)[6], $t = $z($02, 1, $0[1][0], 1) + $z($02, 1, $0[1][1], 2) + $z($02, 1, $0[2][0], 3) + $z($02, 1, $0[2][1], 4) + $z($02, 1, $0[3][0], 5) + $z($02, 1, $0[3][1], 6) + $z($02, 1, $0[4][0], 7) + $z($02, 1, $0[4][1], 8) + $y($3, $a, 'GdipFillPolygon', $b, $8, $b, $01, 'struct*', $02, $a, 4, 'int', 'FillModeAlternate') + $y($3, $a, 'GdipDeleteBrush', $b, $01) + a($q, $i, 4, $q[$i][4] + 1)
    If $q[$i][2] * $q[$i][4] < -1024 Then n($i)
EndFunc   ;==>r
Func t(ByRef $x, ByRef $y, $w, $c, $f)
    Local $x2 = $x, $y2 = $y
    $x = $c + ($x2 - $c) * Cos($w) - ($y2 - $f) * Sin($w)
    $y = $f + ($x2 - $c) * Sin($w) + ($y2 - $f) * Cos($w)
EndFunc   ;==>t
Func x()
    $t = $y($3, $a, 'GdipDeleteGraphics', $b, $8) + $y('user32.dll', $a, 'ReleaseDC', 'hwnd', $g, $b, $d) + $y($5, 'bool', 'DeleteObject', $b, $v) + $y($5, 'bool', 'DeleteDC', $b, $6) + $y($3, 'none', 'GdiplusShutdown', 'ulong_ptr', $4) + DllClose($3)
    Exit
EndFunc   ;==>x
Br,

UEZ

Edited by 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

Sure John, there is no multitasking possible. I assume op means more to have multi lines in one line.

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

That's how I understood it as well!

Let's see how the OP want's it be understood!


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - 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

#9 ·  Posted (edited)

Oh, sorry, I wasn't precise enough :) I meant the following thing:

Execute('MsgBox(0,"", "asd") + MsgBox(0,"", "qwe")')

So, that's it :) Quite easy (how could I don't know it...), thanks.

 

(P.s.: Yes, I know multitasking isn't possible in autoit, I just wanted to execute 2 lines of code with 1 command (of course one by one)

Edited by Unc3nZureD

Share this post


Link to post
Share on other sites

Is there a situation where it is necessary to use "Execute"? Why not simply write two lines of code?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - 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

... a "nested" way

MsgBox(0, "Fire!", "Done", 3 & MsgBox(0, "1", "ONE", 1 & MsgBox(0, "2", "TWO", 1 & MsgBox(0, "3", "THREE", 1))))

found >here


small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Share this post


Link to post
Share on other sites

Is there a situation where it is necessary to use "Execute"? Why not simply write two lines of code?

 

It's because I'm trying to use a "plugin system". It works by executing each line of a file. I wanted to do something like the following:

Execute('If FileExists("thisfile.exe") Then + MsgBox(0,"", "found") + Else + MsgBox(0,"", "lost") + EndIf')

Well, sadly it seems it's not possible :(

Share this post


Link to post
Share on other sites

You can only use function calls the way we described.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - 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

It's because I'm trying to use a "plugin system". It works by executing each line of a file. I wanted to do something like the following:

Execute('If FileExists("thisfile.exe") Then + MsgBox(0,"", "found") + Else + MsgBox(0,"", "lost") + EndIf')
Well, sadly it seems it's not possible :(

 

So, just try this:

Execute((FileExists("thisfile.exe")?MsgBox(0,"","found"):MsgBox(0,"","lost"))&((FileExists(@ScriptFullPath)?MsgBox(0,"","found"):MsgBox(0,"","lost"))))

My UDFs, Abbrevs and Snippets
If you like my post, just click the like button :) 

Share this post


Link to post
Share on other sites

#15 ·  Posted (edited)

It's because I'm trying to use a "plugin system". It works by executing each line of a file. I wanted to do something like the following:

Execute('If FileExists("thisfile.exe") Then + MsgBox(0,"", "found") + Else + MsgBox(0,"", "lost") + EndIf')

Well, sadly it seems it's not possible :(

 

It is  :)

Execute('FileExists("thisfile.exe") ? MsgBox(0,"", "found") : MsgBox(0,"", "lost")')

or

Execute('MsgBox(0,"", FileExists("thisfile.exe") ? "found" : "lost")')
Edited by mikell

Share this post


Link to post
Share on other sites

Oh, I totally forgot about them :) Lol, well, I have to look at them a little bit, since I'm confused a little bit, but thanks each reply! :)

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  
Followers 0