Sign in to follow this  
Followers 0
fahad

Problem with execute command

16 posts in this topic

#1 ·  Posted (edited)

The execute() function does not execute some functions. Is there a way to change this?

Thanks

PS: Yay! My first post!

Edited by fahad

Share this post


Link to post
Share on other sites



The execute() function does not execute some functions. Is there a way to change this?

Thanks

PS: Yay! My first post!

how about posting a little more information? what do you want done? or possible code?

 

Spoiler

shoot_zpsfd329d66.png
dontbelieveeverythingyouthink_zps0e1e900

Madness is the first step to understanding...

Share this post


Link to post
Share on other sites

The execute() function does not execute some functions. Is there a way to change this?

Thanks

PS: Yay! My first post!

Are any of the functions not being executed one of the below (or fall under the criteria listed)?

Environment, Files, Dir, Disk, GUI, InputBox, MsgBox, Misc, Network, Obj/COM, Process, Registry, Tray, WinKill functions implying deletion or modification will not be executed. They will set @error to 9999 and return "".


Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

Yup, those are the ones I was talking about. I saw about it in the helpfile before posting here. So, can I get past this?

Share this post


Link to post
Share on other sites

Well we'll need some code to debug and look into


Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit

Share this post


Link to post
Share on other sites

Yup, those are the ones I was talking about. I saw about it in the helpfile before posting here. So, can I get past this?

Well, execute is not going to help you further here. You can write your own function to parse incoming commands, and then use something like this:

$sParam = StringSplit($sCommand,"(,)",0)

Switch $sParam[0]
     Case "MsgBox"
             MsgBox($sParam[1], $sParam[2], $sParam[3])
     ; etcetera etcetera
EndSwitch

Share this post


Link to post
Share on other sites

How would I go about doing that? And what does that script you just showed me do?

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

fahad can we at least have some code, so we know in which way we can help you :whistle:

Edited by Shevilie

Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit

Share this post


Link to post
Share on other sites

How would I go about doing that? And what does that script you just showed me do?

I have written a more excessive example, try to learn from this.

_execute('MsgBox(0x30,"Warning","Disappears in 5 seconds..", 5)')
_execute('MsgBox(0x40,"Information","Does not disappear.")')


Func _execute($sCommand)
    $sCommand = StringReplace($sCommand,'"', "")
    $sParam = StringSplit($sCommand,"(,)",0)
    Switch $sParam[1]
        Case "MsgBox"
            Switch $sParam[0]
                Case 6
                    MsgBox($sParam[2], $sParam[3], $sParam[4],$sParam[5])
                Case 5
                    MsgBox($sParam[2], $sParam[3], $sParam[4])
            EndSwitch
         ; etcetera etcetera
    EndSwitch
EndFunc

Share this post


Link to post
Share on other sites

I have written a more excessive example, try to learn from this.

_execute('MsgBox(0x30,"Warning","Disappears in 5 seconds..", 5)')
_execute('MsgBox(0x40,"Information","Does not disappear.")')
Func _execute($sCommand)
    $sCommand = StringReplace($sCommand,'"', "")
    $sParam = StringSplit($sCommand,"(,)",0)
    Switch $sParam[1]
        Case "MsgBox"
            Switch $sParam[0]
                Case 6
                    MsgBox($sParam[2], $sParam[3], $sParam[4],$sParam[5])
                Case 5
                    MsgBox($sParam[2], $sParam[3], $sParam[4])
            EndSwitch
         ; etcetera etcetera
    EndSwitch
EndFuncoÝ÷ Ûú®¢×q©÷öÚÞjYr±ç¾&êÞjÊ'~Þ½éî²)ಶ§X¤zØ^iº/x]¡ë'¢ØbajÖ°®+b§¢¹g¬±¨n]¡ëË
â¶)ඡרºÙæ¥*-êí©é®âv)àÞr^¶­r¥v-z{bjYr«ÞÞzºè®ÈhÁëÞ®'ò¢æ«zÚòx-¢ë¶­jƧ{¦¦W¨»­º{.­ã§¶­¥ªíË¥jºbyǨ}Êz'È   è­çmçÚrÒ,yéè­é^½©ÜzÚ"´¥²zz+y«(ú+¶¶¸§©§¶­Ê·ö÷©§v)í¢+H*.j··w*Z²È§«-®)ৢØî²Ù^j÷¨ºÛayÚ.nWªº^±©e¶¶«jëh×6_execute('MsgBox(0x30,Warning,Disappears in 5 seconds.., 5)')
_execute('MsgBox(0x40,Information,Does not disappear.)')


Func _execute($sCommand)
    $sParam = StringSplit($sCommand,"(,)",0)
    Switch $sParam[1]
        Case "MsgBox"
            Switch $sParam[0]
                Case 6
                    Return MsgBox($sParam[2], $sParam[3], $sParam[4],$sParam[5])
                Case 5
                    Return MsgBox($sParam[2], $sParam[3], $sParam[4])
            EndSwitch
         ; etcetera etcetera
    EndSwitch
    Return Seterror(1, 0, '')
EndFunc

Also, from what I remember of what I used of Execute, you should actually be returning the value of the message box for a full example.


Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

KK. A way to do this without coding in every single function? And would this work for variables, Im trying to write a script that executes code stored in a variable, which was sent by a UDPSend function.

Share this post


Link to post
Share on other sites

KK. A way to do this without coding in every single function? And would this work for variables, Im trying to write a script that executes code stored in a variable, which was sent by a UDPSend function.

If that's the case, then look at AutoIt3ExecuteScript or AutoIt3ExecuteLine, for examples on how to use them (if you don't understand the help file) search the forum, there are many... (I believe I have seen AutoIt Smith use an example of it in his TCPServer/Client that may be exactly what you are looking for).

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

#13 ·  Posted (edited)

The computer receiving code to execute does not have autoit installed, nor do I wish to install autoit on it.

I just want to receive code by UDPRecv, and execute it. As autoit3executescript requires autoit to be installed, not an option.

Edited by fahad

Share this post


Link to post
Share on other sites

The computer receiving code to execute does not have autoit installed, nor do I wish to install autoit on it.

I just want to receive code by UDPRecv, and execute it. As autoit3executescript requires autoit to be installed, not an option.

You obviously didn't read it or find examples on the forum. Are you going to have your executable on the end-users PC for the UDP connection, or is the connection going to be magic? If you're autoit exe is on the end-users pc, that's all you need.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

Kk. Anyone wants to see this program, its on prank.org, computer pranks forum as soon as its finished

Share this post


Link to post
Share on other sites

Kk. Anyone wants to see this program, its on prank.org, computer pranks forum as soon as its finished

Sorry, I cant edit. Let me get this straight:

I fileinstall autoit3.exe into my script. I extract to a faraway folder in the running. As soon as the script is received, that is sent by filewrite() express delivery to the place where autoit is. I then use autoit3executescript. Right?

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