Jump to content

Problem with execute command


fahad
 Share

Recommended Posts

  • Moderators

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.

Link to comment
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
Link to comment
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
Link to comment
Share on other sites

  • Moderators

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.

Link to comment
Share on other sites

  • Moderators

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.

Link to comment
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.

Edited by fahad
Link to comment
Share on other sites

  • Moderators

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.

Link to comment
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?

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...