Jump to content
Sign in to follow this  


Recommended Posts


I've noticed more and more people using /AutoIt3ExecuteScript or /AutoIt3ExecuteLine, I've also seen some nice ways to manipulate those options from fellow forum members. It seems ... as was the case with myself initially ... that people have a hard time converting the string to be useable with them.

This is just a stab at making a conversion utility that will convert your strings for you, I can't remember for the life of me if MHz has already done it, if he has, I'm sure his is more efficient for mine was done on fatigue stamina.

If you'd like to better it, or make it more efficient please feel free, I don't know how it will handle every circumstance, but with the proper string submission it should do ok.


$str = 'msgbox(0, """title""", "apple")'

Func _Au3ExecuteConvertString($sString)
    Local $sSQ, $sDQ, $sHold
    $sString = StringReplace($sString, "''", '@@')
    $sString = StringReplace($sString, '""', '^^')
    While StringLen($sString) > 0
        $sSQ = StringInStr($sString, "'")
        $sDQ = StringInStr($sString, '"')
        If Not $sSQ And Not $sDQ Then ExitLoop
        If $sSQ > 0 And ($sDQ > $sSQ Or $sDQ = 0) Then
            $sHold &= '"' & StringReplace(StringLeft($sString, _
                StringInStr($sString, "'", 0, 2)), '@@', "''") & '" & '
            $sString = StringTrimLeft($sString, StringInStr($sString, "'", 0, 2))
            $sHold &= "'" & StringReplace(StringLeft($sString, _
                StringInStr($sString, '"', 0, 2)), '^^', '""') & "' & "
            $sString = StringTrimLeft($sString, StringInStr($sString, '"', 0, 2))
    If StringLen($sString) > 0 Then
        $sHold &= "'" & StringReplace(StringReplace($sString, '^^', '""'), '@@', "''") & "'"
    Local $Au3ExCsGUI = GUICreate('Au3Execute Conversion', 400, 300)
    Local $Au3ExCsEdit = GUICtrlCreateEdit($sHold, 0, 0, 400, 240)
    Local $Au3ExCsButt = GUICtrlCreateButton('Ok', 175, 250, 50, 30)
    While 1
        Switch GUIGetMsg()
            Case -3, $Au3ExCsButt
    Return 1

The theory was all you had to do was copy and paste from the Edit control directly to your Run() command or variables for your Run() command, it's put in the clipboard anyway, but the option is still there to copy manually or see what it turned out like before doing so.

I never even looked at the GUI before posting it, I forgot to exit the loop :P

After looking at this, this very well could be absolutely USELESS! :D I'm too tired to even tell :)

Edited by SmOke_N
fixed broken autoit tag

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

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  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.