Leaderboard
Popular Content
Showing content with the highest reputation on 12/20/2014 in all areas
-
; ;################################## ; Include ;################################## #Include<file.au3> ;################################## ; Variables ;################################## $SmtpServer = "MailServer" ; address for the smtp-server to use - REQUIRED $FromName = "Name" ; name from who the email was sent $FromAddress = "your@Email.Address.com" ; address from where the mail should come $ToAddress = "your@Email.Address.com" ; destination address of the email - REQUIRED $Subject = "Userinfo" ; subject from the email - can be anything you want it to be $Body = "" ; the messagebody from the mail - can be left blank but then you get a blank mail $AttachFiles = "" ; the file(s) you want to attach seperated with a ; (Semicolon) - leave blank if not needed $CcAddress = "CCadress1@test.com" ; address for cc - leave blank if not needed $BccAddress = "BCCadress1@test.com" ; address for bcc - leave blank if not needed $Importance = "Normal" ; Send message priority: "High", "Normal", "Low" $Username = "******" ; username for the account used from where the mail gets sent - REQUIRED $Password = "********" ; password for the account used from where the mail gets sent - REQUIRED $IPPort = 25 ; port used for sending the mail $ssl = 0 ; enables/disables secure socket layer sending - put to 1 if using httpS $tls = 0 ; enables/disables TLS when required ;~ $SmtpServer = "smtp.gmail.com" ; GMAIL address for the smtp-server to use - REQUIRED ;~ $IPPort=465 ; GMAIL port used for sending the mail ;~ $ssl=1 ; GMAIL enables/disables secure socket layer sending - put to 1 if using https ;~ $SmtpServer = "smtp.office365.com" ; O365 address for the smtp-server to use - REQUIRED ;~ $IPPort=25 ; O365 port used for sending the mail ;~ $ssl=1 ; O365 enables/disables secure socket layer sending - put to 1 if using https ;~ SmtpServer = "smtp.mail.yahoo.com" ; Yahoo address for the smtp-server to use - REQUIRED ;~ $IPPort = 465 ; Yahoo port used for sending the mail ;~ $ssl = 1 ; Yahoo enables/disables secure socket layer sending - put to 1 if using https ;################################## ; Script ;################################## Global $oMyRet[2] Global $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc") $rc = _INetSmtpMailCom($SmtpServer, $FromName, $FromAddress, $ToAddress, $Subject, $Body, $AttachFiles, $CcAddress, $BccAddress, $Importance, $Username, $Password, $IPPort, $ssl, $tls) If @error Then MsgBox(0, "Error sending message", "Error code:" & @error & " Description:" & $rc) EndIf ; ; The UDF Func _INetSmtpMailCom($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject = "", $as_Body = "", $s_AttachFiles = "", $s_CcAddress = "", $s_BccAddress = "", $s_Importance="Normal", $s_Username = "", $s_Password = "", $IPPort = 25, $ssl = 0, $tls = 0) Local $objEmail = ObjCreate("CDO.Message") $objEmail.From = '"' & $s_FromName & '" <' & $s_FromAddress & '>' $objEmail.To = $s_ToAddress Local $i_Error = 0 Local $i_Error_desciption = "" If $s_CcAddress <> "" Then $objEmail.Cc = $s_CcAddress If $s_BccAddress <> "" Then $objEmail.Bcc = $s_BccAddress $objEmail.Subject = $s_Subject If StringInStr($as_Body, "<") And StringInStr($as_Body, ">") Then $objEmail.HTMLBody = $as_Body Else $objEmail.Textbody = $as_Body & @CRLF EndIf If $s_AttachFiles <> "" Then Local $S_Files2Attach = StringSplit($s_AttachFiles, ";") For $x = 1 To $S_Files2Attach[0] $S_Files2Attach[$x] = _PathFull($S_Files2Attach[$x]) ;~ ConsoleWrite('@@ Debug : $S_Files2Attach[$x] = ' & $S_Files2Attach[$x] & @LF & '>Error code: ' & @error & @LF) ;### Debug Console If FileExists($S_Files2Attach[$x]) Then ConsoleWrite('+> File attachment added: ' & $S_Files2Attach[$x] & @LF) $objEmail.AddAttachment($S_Files2Attach[$x]) Else ConsoleWrite('!> File not found to attach: ' & $S_Files2Attach[$x] & @LF) SetError(1) Return 0 EndIf Next EndIf $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = $s_SmtpServer If Number($IPPort) = 0 then $IPPort = 25 $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = $IPPort ;Authenticated SMTP If $s_Username <> "" Then $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") = $s_Username $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") = $s_Password EndIf ; Set security params If $ssl Then $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True If $tls Then $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendtls") = True ;Update settings $objEmail.Configuration.Fields.Update ; Set Email Importance Switch $s_Importance Case "High" $objEmail.Fields.Item ("urn:schemas:mailheader:Importance") = "High" Case "Normal" $objEmail.Fields.Item ("urn:schemas:mailheader:Importance") = "Normal" Case "Low" $objEmail.Fields.Item ("urn:schemas:mailheader:Importance") = "Low" EndSwitch $objEmail.Fields.Update ; Sent the Message $objEmail.Send If @error Then SetError(2) Return $oMyRet[1] EndIf $objEmail="" EndFunc ;==>_INetSmtpMailCom ; ; ; Com Error Handler Func MyErrFunc() $HexNumber = Hex($oMyError.number, 8) $oMyRet[0] = $HexNumber $oMyRet[1] = StringStripWS($oMyError.description, 3) ConsoleWrite("### COM Error ! Number: " & $HexNumber & " ScriptLine: " & $oMyError.scriptline & " Description:" & $oMyRet[1] & @LF) SetError(1); something to check for when this function returns Return EndFunc ;==>MyErrFunc Edit: Fixed Bcc ... Edit: Added support for different port and SLL which are used by GMail (Port 465) Edit: Added Importance support (10/2008) EDIT: Added $TLS option (07/2020 Some interesting Info from the thread:1 point
-
_IEJS has been deprecated, please see: These are a few functions I've put together either for current necessity, past necessity, or looking forward at possible future necessity (and no, I didn't see how many lines of code it was until I was putting this together to upload). Issues with interacting with all types of IE versions and in all types of modes (standard or quirks), and trying to develop the means to successfully drag and drop automated are what started me on this javascript injection method. But keep in mind, not all functions make use of JS. I tried to make it as inline with the IE.au3 library as I was comfortable with. Right now, there are no only a few example codes, there are headers for each function other than internal functions. Some functions (specifically the position ones) are either untested, have proven to be a pain with visible document area only issues, or are in conflict with other types of position functions. I've not had time to debug those and see where their benefit lie at the moment. I've not been able to successfully implement a drag and drop (moving one object to another objects location, firing all necessary events) scenario using the JS move/drag events or even postmessage + WM_[TYPE]BUTTONMOVE/DOWN/UP, etc, as of yet. The issue with the position functions above have been somewhat the issue. So, if you find a solution to that, let me know, if you find issues with the code, please provide a reproducer, IE version, OS Type/Arch, and AutoIt version you're running. I will not respond to "I get this error" or "It doesn't work" with nothing else. If you have javascript code and you'd like to implement, explain what it is, why it's a great idea, and we'll get it in there. Other than that... I'll get examples up as soon as I get a chance, I just knew if I didn't get it up today, I'd forget for another month or 2 years . [some Examples in Zip] Functions: _IEJS_CallObjEval() _IEJS_CallObjExecScript() _IEJS_CheckAppVersionAlways() _IEJS_ClickObjByPoint() _IEJS_CreateWithParams() _IEJS_EmbeddedGetVersion() _IEJS_EmbeddedSetVersion() _IEJS_GetAppMajorVersion() _IEJS_GetObjEval() _IEJS_GetObjParentWindow() _IEJS_GetObjPos() _IEJS_GetObjType() _IEJS_GetScroll() _IEJS_GetScrollPoint() _IEJS_GetWindowSize() _IEJS_MouseEventExec() _IEJS_JSClassNameGetArray() _IEJS_JSClassNameGetCollection() _IEJS_JSClickObj() _IEJS_JSClickObjById() _IEJS_JSClickObjByName() _IEJS_JSClickObjByPoint() _IEJS_JSDragEventObj() _IEJS_JSEnable() _IEJS_JSGetObjByClassName() _IEJS_JSGetObjPos() _IEJS_JSIsEnabled() _IEJS_JSMouseEventObj() _IEJS_JSMouseEventObjById() _IEJS_JSMouseEventObjByName() _IEJS_JSObjQuerySelector() _IEJS_JSObjQuerySelectorAll() _IEJS_JSTypeOf() _IEJS_TabAttach() _IEJS_TabCount() _IEJS_TabCreate() _IEJS_TabGetInstance() _IEJS_VersionInfo() _IEJS_WinGetBrowserObjArray() Changes: Changes from 0.0.3 - 0.0.5 have been lost! 2014-12-30 B0.0.6 Added: _IEJS_EmbeddedGetVersion(); Get the embedded version used from something like _IECreateEmbedded 2014-12-30 B0.0.6 Added: _IEJS_EmbeddedSetVersion(); Set the embedded version used from something like _IECreateEmbedded (see example) 2014-12-30 B0.0.6 Added: _IEJS_TabAttach(); Similar to _IEAttach(), but browser specific and different string cases 2014-12-30 B0.0.6 Added: _IEJS_TabCount(); Get a count of the tabs open in a specific browser session 2014-12-30 B0.0.6 Added: _IEJS_TabGetInstance(); Get the tab instance number from the specific browser session 2014-12-30 B0.0.6 Added: _IEJS_WinGetBrowserObjArray(); Get all the browser objects (tabs) from a specific browser window handle/title Fixes for next version (B0.0.7): ; I mistakenly left out interacting with 3 params (attach/visible/takefocus) Func _IEJS_CreateWithParams($sURL, $sParams = "", $iTryAttach = 0, $iVisible = 1, $iWait = 1, $iTakeFocus = 1) Local Static $sHKCR = ((@AutoItX64) ? "HKCR64" : "HKCR") Local Static $szCOMIE = FileGetShortName(RegRead($sHKCR & _ "\CLSID\{0002DF01-0000-0000-C000-000000000046}\LocalServer32","")) If Not FileExists(StringReplace($szCOMIE, '"', "")) Then $szCOMIE = FileGetShortName(RegRead($sHKCR & _ "\CLSID\{D5E8041D-920F-45e9-B8FB-B1DEB82C6E5E}\LocalServer32","")) If Not FileExists(StringReplace($szCOMIE, '"', "")) Then Return SetError($_IESTATUS_NoMatch, 1, 0) EndIf EndIf Local $oRet If $iTryAttach Then $oRet = _IEJS_TabAttach($sURL, "URL") If IsObj($oRet) Then $oRet.visible = $iVisible If $iVisible And $iTakeFocus Then WinActivate($oRet.hwnd) EndIf Return SetError($_IESTATUS_Success, 1, $oRet) EndIf EndIf ; get current shell windows open and their count Local $oShell = ObjCreate("Shell.Application") Local $oWin, $nCount = $oShell.windows.count() $sParams = (StringLen($sParams) > 0) ? " " & $sParams : "" Local $iTimer = TimerInit() ; set a 5 minute timeout Local $iPID = Run($szCOMIE & $sParams & ' "' & $sURL & '"') While 1 $oWin = $oShell.windows() If $oWin.count() <> $nCount Then $nCount = $oWin.count() $oRet = $oWin($nCount - 1) If $oRet.TopLevelContainer Then ExitLoop EndIf If (TimerDiff($iTimer) / 1000) >= 300 Then ; timed out waiting, close IE instance ProcessClose($iPID) Return SetError($_IESTATUS_LoadWaitTimeout, 2, 0) EndIf Sleep(10) WEnd If Not $iVisible Then $iTakeFocus = 0 $oRet.visible = False EndIf If $iTakeFocus Then WinActivate($oRet.hwnd) EndIf If $iWait Then _IELoadWait($oRet) If @error Then Return SetError(@error, 3, $oRet) EndIf EndIf Return SetError($_IESTATUS_Success, 2, $oRet) EndFunc ;==>_IEJS_CreateWithParams 2014-12-21: IEJS.B003.zip 2014-12-23: IEJS.B004.zip 2014-12-29: IEJS.B005.zip 2014-12-30: IEJS.B006.zip1 point
-
Do you even know what a script is?1 point
-
Mimic Excel Formula for converting HH:MM:SS to seconds
coffeeturtle reacted to Gianni for a topic
...nice reading... here one more (also from seconds back to HH:MM:SS) Local $sTime = "05:01:30" ; HH:MM:SS ; From HH:MM:SS to seconds ConsoleWrite($sTime & " = " & Convert2Sec($sTime) & " seconds" & @CRLF) ; and back (From seconds to HH:MM:SS) ConsoleWrite(Convert2Sec($sTime) & " seconds = " & Convert2HMS(Convert2Sec($sTime)) & " HH:MM:SS" & @CRLF) Func Convert2Sec($sTime) ; format HH:MM:SS, no error / validity check for input! Local $x = StringSplit($sTime, ":") Return $x[1] * 3600 + $x[2] * 60 + $x[3] EndFunc ;==>Convert2Sec Func Convert2HMS($sSeconds) Local $hr = Int($sSeconds / 3600), $mn = Int(($sSeconds - ($hr * 3600)) / 60), $sc = Int(($sSeconds - ($hr * 3600) - ($mn * 60))) Return StringFormat("%02s", $hr) & ":" & StringFormat("%02s", $mn) & ":" & StringFormat("%02s", $sc) EndFunc ;==>Convert2HMS p.s. does someone have some better ways to go back from seconds to HH:MM:SS? ...1 point -
First time working with "_WinAPI_GetModuleHandle"
FeliXXL reacted to computergroove for a topic
Your video was a good idea to post here. Go to your script window and click f5 (this will run your opened script) and open notepad and don't maximize the window (You want to see the console in Scite). Add a @CR at the end of your text insertion. This works for me more than 10 times on windows 7 x64 (I had to change the F1 to F2 because I have the help menu popping up with F1): #include <WinAPI.au3> #include <WindowsConstants.au3> Global $g_hHook, $g_hStub_KeyProc = "" Test() Func Test() OnAutoItExitRegister("CleanUp") Local $hMod $g_hStub_KeyProc = DllCallbackRegister("_KeyProc", "Int", "int;wparam;lparam") $hMod = _WinAPI_GetModuleHandle(0) $g_hHook = _WinAPI_SetWindowsHookEx($WH_KEYBOARD_LL, DllCallbackGetPtr($g_hStub_KeyProc), $hMod) While 1 Sleep(100) WEnd EndFunc Func _KeyProc($nCode, $wParam, $lParam) Local $tKEYHOOKS $tKEYHOOKS = DllStructCreate($tagKBDLLHOOKSTRUCT, $lParam) If $wParam = $WM_KEYDOWN Then KeyValue(DllStructGetData($tKEYHOOKS, "vkCode")) EndIf Return _WinAPI_CallNextHookEx($g_hHook, $nCode, $wParam, $lParam) EndFunc Func KeyValue($iKeycode) If ($iKeycode = 113) Then send("This is a really long bit of text I dont want to type manually" & @CR) ElseIf ($iKeycode = 117) Then Exit ;exit if F6 has been pressed EndIf EndFunc Func CleanUp() _WinAPI_UnhookWindowsHookEx($g_hHook) DllCallbackFree($g_hStub_KeyProc) EndFunc Look in the console window below your code in the scite window for an error to occur when your script stops working.1 point -
1 point
-
_TCPIPtoName() extremly slow, if no PTR record exists.
Gianni reacted to Authenticity for a topic
Local Const $sRange = "189.108.105." Local $sName, $sAddress TCPStartup() For $i = 100 To 200 $sAddress = $sRange & $i $sName = _ReverseLookup($sAddress) ConsoleWrite(StringFormat("\tName: %s\n\tAddress: %s\n", $sName, $sAddress)) Next TCPShutdown() Func _ReverseLookup($sIP, $iTimeout = 1000) Local Const $AF_INET = 2, $SOCK_DGRAM = 2, $IPPROTO_IP = 0 Local $socket = _socket($AF_INET, $SOCK_DGRAM, $IPPROTO_IP) Local $tSockAddr = DllStructCreate("ushort;byte[14]"), $pSockAddr = DllStructGetPtr($tSockAddr), $iSockAddr = DllStructGetSize($tSockAddr) Local $sDNSServer = _GetPrimaryDnsServerAddress() DllStructSetData($tSockAddr, 1, $AF_INET) DllStructSetData($tSockAddr, 2, Binary("0x0035") & Binary(_inet_addr($sDNSServer))) _connect($socket, $pSockAddr, $iSockAddr) Local $tData = _GeneratePacket($sIP), $pData = DllStructGetPtr($tData), $iData = DllStructGetSize($tData) _send($socket, $pData, $iData) Local $tReadSockets = DllStructCreate("int;int"), $pReadSockets = DllStructGetPtr($tReadSockets) Local $tTimeout = DllStructCreate("int;int"), $pTimeout = DllStructGetPtr($tTimeout) DllStructSetData($tReadSockets, 1, 1) DllStructSetData($tReadSockets, 2, $socket) If $iTimeout < 100 Then $iTimeout = 100 DllStructSetData($tTimeout, 1, Int($iTimeout/1000)) DllStructSetData($tTimeout, 2, Mod($iTimeout, 1000)) Local $iRet = _select($socket, $pReadSockets, 0, 0, $pTimeout) If $iRet = 0 Then _closesocket($socket) Return "DNS request timeout." EndIf Local $tRecvBuf = DllStructCreate("byte[65536]"), $pRecvBuf = DllStructGetPtr($tRecvBuf), $iRecvBuf = DllStructGetSize($tRecvBuf) Local $iReceived = _recv($socket, $pRecvBuf, $iRecvBuf) Local $xRecvData = BinaryMid(DllStructGetData($tRecvBuf, 1), 1, $iReceived) _closesocket($socket) Return _ParsePacket($xRecvData) EndFunc Func _socket($iaf, $itype, $iprotocol) Local $aResult = DllCall("wsock32.dll", "int", "socket", "int", $iaf, "int", $itype, "int", $iprotocol) If @error Then Return SetError(@error, @extended, 0) If $aResult[0] = -1 Then Return SetError(-1, 0, 0) Return $aResult[0] EndFunc Func _closesocket($socket) Local $aResult = DllCall("wsock32.dll", "int", "closesocket", "int", $socket) If @error Then Return SetError(@error, @extended, 0) If $aResult[0] = -1 Then Return SetError(-1, 0, 0) Return True EndFunc Func _connect($socket, $pname, $inamelen) Local $aResult = DllCall("wsock32.dll", "int", "connect", "int", $socket, "ptr", $pname, "int", $inamelen) If @error Then Return SetError(@error, @extended, 0) If $aResult[0] = -1 Then Return SetError(-1, 0, 0) Return True EndFunc Func _recv($socket, $pbuffer, $ibuflen, $iflags = 0) Local $aResult = DllCall("wsock32.dll", "int", "recv", "int", $socket, "ptr", $pbuffer, "int", $ibuflen, "int", $iflags) If $aResult[0] = -1 Then Return SetError(-1, 0, 0) Return SetError($aResult[0] = 0, 0, $aResult[0]) EndFunc Func _send($socket, $pbuffer, $ibuflen, $iflags = 0) Local $aResult = DllCall("wsock32.dll", "int", "send", "int", $socket, "ptr", $pbuffer, "int", $ibuflen, "int", $iflags) If @error Then Return SetError(@error, @extended, 0) If $aResult[0] = -1 Then Return SetError(-1, 0, 0) Return SetError($aResult[0] = 0, 0, $aResult[0]) EndFunc Func _select($socket, $preadfds, $pwritefds, $pexceptfds, $ptimeout) Local $aResult = DllCall("wsock32.dll", "int", "select", "int", $socket, "ptr", $preadfds, "ptr", $pwritefds, "ptr", $pexceptfds, "ptr", $ptimeout) If @error Then Return SetError(@error, @extended, 0) If $aResult[0] = -1 Then Return SetError(-1, 0, 0) Return SetError($aResult[0] = 0, 0, $aResult[0]) EndFunc Func _inet_addr($sIP) Local $aResult = DllCall("wsock32.dll", "int", "inet_addr", "str", $sIP) If @error Then Return SetError(@error, @extended, 0) If $aResult[0] = -1 Then Return SetError(-1, 0, 0) Return SetError($aResult[0] = 0, 0, $aResult[0]) EndFunc Func _GetPrimaryDnsServerAddress() Local $aResult, $tBuf, $tDnsServersList $aResult = DllCall("iphlpapi.dll", "uint", "GetNetworkParams", "int*", 0, "uint*", 4) If $aResult[0] = 111 Then $tBuf = DllStructCreate("byte[" & $aResult[2] & "]") $aResult = DllCall("iphlpapi.dll", "uint", "GetNetworkParams", "ptr", DllStructGetPtr($tBuf), "uint*", $aResult[2]) If $aResult[0] <> 0 Then Return SetError($aResult[0], 0, "") $tDnsServersList = DllStructCreate("ptr;char[16];char[16];uint;", DllStructGetPtr($tBuf)+268) Return DllStructGetData($tDnsServersList, 2) Else Return SetError(-1, 0, "") EndIf EndFunc Func _GeneratePacket($sIP) Local $aParts = StringSplit($sIP, "."), $xData = Binary("0x001701000001000000000000"), $tRet For $i = 4 To 1 Step -1 $xData &= Binary("0x" & Hex(StringLen($aParts[$i]), 2)) & StringToBinary($aParts[$i]) Next $xData &= Binary("0x07696E2D61646472046172706100000C0001") $tRet = DllStructCreate("byte[" & BinaryLen($xData) & "]") DllStructSetData($tRet, 1, $xData) Return $tRet EndFunc Func _ParsePacket($xData) Local $sRet, $iErr, $iPos, $iChrs $iErr = BitAND(BinaryMid($xData, 4, 1), 0xf) If $iErr <> 0 Then Switch $iErr Case 2 $sRet = "Server failed" Case 3 $sRet = "Non-existent domain" Case 4 $sRet = "Not implemented" Case 5 $sRet = "Query refused" Case 0xf $sRet = "No change" Case Else $sRet = "Contact Microsoft©. Ask them what to do" EndSwitch Else ; Step over the "in-addr.arpa" part $iPos = 13 Do $iPos += Number(BinaryMid($xData, $iPos, 1)) + 1 Until Number(BinaryMid($xData, $iPos, 1)) = 0 $iPos += 17 $iChrs = Number(BinaryMid($xData, $iPos, 1)) $sRet = "" While $iChrs $sRet &= BinaryToString(BinaryMid($xData, $iPos + 1, $iChrs)) & "." $iPos += $iChrs + 1 $iChrs = Number(BinaryMid($xData, $iPos, 1)) WEnd $sRet = StringTrimRight($sRet, 1) EndIf Return $sRet EndFunc Nslookup sends a packet through dgram socket on port 53, among other things. Deciphering the sent and received packets requires more, but for now this script should do the trick. P.S. If sending or receiving packets takes long time you can use the select function. Edit: Added timeout option.1 point -
URL Encoding
Colduction reacted to ProgAndy for a topic
I wrote some functions including UTF-8 conversion Func _URIEncode($sData) ; Prog@ndy Local $aData = StringSplit(BinaryToString(StringToBinary($sData,4),1),"") Local $nChar $sData="" For $i = 1 To $aData[0] ; ConsoleWrite($aData[$i] & @CRLF) $nChar = Asc($aData[$i]) Switch $nChar Case 45, 46, 48 To 57, 65 To 90, 95, 97 To 122, 126 $sData &= $aData[$i] Case 32 $sData &= "+" Case Else $sData &= "%" & Hex($nChar,2) EndSwitch Next Return $sData EndFunc Func _URIDecode($sData) ; Prog@ndy Local $aData = StringSplit(StringReplace($sData,"+"," ",0,1),"%") $sData = "" For $i = 2 To $aData[0] $aData[1] &= Chr(Dec(StringLeft($aData[$i],2))) & StringTrimLeft($aData[$i],2) Next Return BinaryToString(StringToBinary($aData[1],1),4) EndFunc MsgBox(0, '', _URIDecode(_URIEncode("testäöü fv"))) Edit 2012: Fixed bug in _URIEncode, removed debug output1 point