LordRaven Posted June 29, 2011 Posted June 29, 2011 Hi im facing some issue in a utility im coding to revert links.I've found the way to reverse the link but my problem is at limiting to 'where' it shouldbe considered.For example, we got the inverted following link:http://telona.biz/protetor/?28YRO2UG=d?/moc.daolpuagem.www//:ptthIf we reverse this we will get the following:http://www.megaupload.com/?d=GU2ORY82?/rotetorp/zib.anolet//:ptthSo far everything is ok, the proble is limiting the code to get the real link part:http://www.megaupload.com/?d=GU2ORY82?/rotetorp/zib.anolet//:ptthIn this case the red part is the one needed. So what i did was a For counting from 0 to 36, that makes it count 37 characters which must return the full url correctly, my problem is that for a unknown reason, it adds a '65' number before the url...This might be stupid and useless but i would really appreciatte any help.Follows what I got:expandcollapse popup#include <GUIConstants.au3> Global $str_antes = "";link antes de ser invertido Global $str_depois = "";link depois de ser invertido #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 202, 243, 193, 125) $Input1 = GUICtrlCreateInput("", 16, 56, 169, 21) $Label1 = GUICtrlCreateLabel("Inversor de Links 1.0", 16, 8, 176, 28) GUICtrlSetFont(-1, 14, 400, 4, "MS Sans Serif") $Button1 = GUICtrlCreateButton("Inverter", 64, 88, 67, 25, 0) $Button2 = GUICtrlCreateButton("Copiar", 64, 192, 67, 25, 0) $Group1 = GUICtrlCreateGroup("Inversor", 8, 40, 185, 89) GUICtrlCreateGroup("", -99, -99, 1, 1) $Group2 = GUICtrlCreateGroup("Resultado", 8, 136, 185, 97) $Input2 = GUICtrlCreateInput("", 16, 160, 169, 21) GUICtrlCreateGroup("", -99, -99, 1, 1) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 $str_antes = GUICtrlRead($Input1) _Revert() Case $Button2 If $str_depois = "" Then MsgBox(0,"Erro","Sem link para ser copiado.") Else ClipPut($str_depois) MsgBox(0,"Link Copiado.") EndIf EndSwitch WEnd Func _Revert() Local $arrayString = StringSplit($str_antes, ""), $cont, $cont2, $Temp = "" For $cont = $arrayString[0] To 1 Step -1 $Temp &= $arrayString[$cont] Next MsgBox(0,"String: ",$Temp) Local $NewArr = StringSplit($Temp, "") For $cont2 = 0 To 37 Step 1 $str_depois &= $NewArr[$cont2] Next MsgBox(0,"String: ", $str_depois) EndFunc
sleepydvdr Posted June 29, 2011 Posted June 29, 2011 Would this do it? #include <String.au3> Global $wrongstring, $correctstring, $output $wrongstring = "http://telona.biz/protetor/?28YRO2UG=d?/moc.daolpuagem.www//:ptth" $correctstring = _StringReverse($wrongstring) $output = StringLeft($correctstring, 37) Msgbox(0, "", $output) #include <ByteMe.au3>
MvGulik Posted June 29, 2011 Posted June 29, 2011 (edited) nevermind. Edited June 29, 2011 by iEvKI3gv9Wrkd41u "Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions.""The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014) "Believing what you know ain't so" ... Knock Knock ...
LordRaven Posted June 29, 2011 Author Posted June 29, 2011 On 6/29/2011 at 1:56 PM, 'sleepydvdr said: Would this do it? #include <String.au3> Global $wrongstring, $correctstring, $output $wrongstring = "http://telona.biz/protetor/?28YRO2UG=d?/moc.daolpuagem.www//:ptth" $correctstring = _StringReverse($wrongstring) $output = StringLeft($correctstring, 37) Msgbox(0, "", $output) I tried this and got 'Unknown Function' error: #include <GUIConstants.au3> Global $wrong = "";link antes de ser invertido Global $correct = "";link depois de ser invertido Global $link = "";link correto #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 202, 243, 193, 125) $Input1 = GUICtrlCreateInput("", 16, 56, 169, 21) $Label1 = GUICtrlCreateLabel("Inversor de Links 1.0", 16, 8, 176, 28) GUICtrlSetFont(-1, 14, 400, 4, "MS Sans Serif") $Button1 = GUICtrlCreateButton("Inverter", 64, 88, 67, 25, 0) $Button2 = GUICtrlCreateButton("Copiar", 64, 192, 67, 25, 0) $Group1 = GUICtrlCreateGroup("Inversor", 8, 40, 185, 89) GUICtrlCreateGroup("", -99, -99, 1, 1) $Group2 = GUICtrlCreateGroup("Resultado", 8, 136, 185, 97) $Input2 = GUICtrlCreateInput("", 16, 160, 169, 21) GUICtrlCreateGroup("", -99, -99, 1, 1) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 $wrong = GUICtrlRead($Input1) $correct = _StringReverse($wrong) $link = StringLeft($correct, 37) MsgBox(0,"Link: ",$link) Case $Button2 EndSwitch WEnd
sleepydvdr Posted June 29, 2011 Posted June 29, 2011 On 6/29/2011 at 2:11 PM, 'LordRaven said: I tried this and got 'Unknown Function' error:You need to add #include <String.au3> #include <ByteMe.au3>
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