Moderators SmOke_N Posted September 19, 2006 Moderators Share Posted September 19, 2006 (edited) 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. Example: expandcollapse popup$str = 'msgbox(0, """title""", "apple")' _Au3ExecuteConvertString($str) 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)) Else $sHold &= "'" & StringReplace(StringLeft($sString, _ StringInStr($sString, '"', 0, 2)), '^^', '""') & "' & " $sString = StringTrimLeft($sString, StringInStr($sString, '"', 0, 2)) EndIf WEnd If StringLen($sString) > 0 Then $sHold &= "'" & StringReplace(StringReplace($sString, '^^', '""'), '@@', "''") & "'" EndIf Local $Au3ExCsGUI = GUICreate('Au3Execute Conversion', 400, 300) Local $Au3ExCsEdit = GUICtrlCreateEdit($sHold, 0, 0, 400, 240) Local $Au3ExCsButt = GUICtrlCreateButton('Ok', 175, 250, 50, 30) GUISetState() While 1 Switch GUIGetMsg() Case -3, $Au3ExCsButt ClipPut($sHold) GUIDelete($Au3ExCsGUI) ExitLoop EndSwitch WEnd Return 1 EndFunc 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. Edit: I never even looked at the GUI before posting it, I forgot to exit the loop Edit2: After looking at this, this very well could be absolutely USELESS! I'm too tired to even tell Edited January 15, 2015 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. Link to comment Share on other sites More sharing options...
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