Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 05/28/2017 in all areas

  1. D'oh! There's a problem on my PHP script. This: $pwd = isset($_GET['pwd']) ? $_GET['pwd'] : null; Should only be used if you're calling so (the "pwd" parameter as GET, on the query string/part of the URL): $test = _HTTP_Upload("http://139.59.137.45/index.php?pwd=123", @ScriptDir & "\myFile.txt", "uploadinput", "filename=" & URLEncode("test.txt") ) However, we are calling with the "pwd" parameter as POST: $test = _HTTP_Upload("http://139.59.137.45/index.php", @ScriptDir & "\myFile.txt", "uploadinput", "pwd=123&filename=" & URLEncode("test.txt") ) So we should replace that line on the PHP file with this: $pwd = isset($_POST['pwd']) ? $_POST['pwd'] : null; Or even this if we want to support the "pwd" parameter in any POST or GET method: $pwd = isset($_REQUEST['pwd']) ? $_REQUEST['pwd'] : null; So just replace the first PHP line of this answer by one of the last two lines above (you choose) and you're all done
    1 point
  2. Hi bro, thanks for your report! I've updated the code on the repo. Just replace the function by this one: Func URLDecode($urlText) $urlText = StringReplace($urlText, "+", " ") Local $matches = StringRegExp($urlText, "\%([abcdefABCDEF0-9]{2})", 3) If Not @error Then For $match In $matches $urlText = StringReplace($urlText, "%" & $match, BinaryToString('0x' & $match)) Next EndIf Return $urlText EndFunc ;==>URLDecode
    1 point
  3. Xandy

    Remove loop

    Have a look at: https://www.autoitscript.com/autoit3/docs/functions/Send.htm Use the Exit command to terminate the program.
    1 point
  4. mikell

    Allow +/- numbers

    The inputbox can't guess the precise moment when the typing is assumed to be complete The previous script is intended to check the typing while it is entered. The final comparison/check must be done when the input content is read, and the easiest way to do this is to check if the input contains at least one digit #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> GUICreate("Input Filter", 300, 60, -1, -1) Global $inTest = GUICtrlCreateInput("", 5, 5, 290) $btn = GUICtrlCreateButton("Validate", 200, 30, 60, 25) GUIRegisterMsg($WM_COMMAND, "MY_WM_COMMAND") GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then Exit If $msg = $btn Then $content = GuiCtrlRead($inTest) If StringRegExp($content, '\d') Then Msgbox(0,"", "OK, " & $content & " is valid") Else GUICtrlSetData($inTest, "") Msgbox(0,"", "Entry is invalid. Try again") EndIf EndIf WEnd Func MY_WM_COMMAND($hWnd, $iMsg, $wParam, $lParam) Local $iIDFrom = BitAND($wParam, 0xFFFF);LoWord Local $iCode = BitShift($wParam, 16) ;HiWord If $iIDFrom = $inTest And $iCode = $EN_CHANGE Then $Read_Input = GUICtrlRead($inTest) If not StringRegExp($Read_Input, '^[\d-]?\d*(?:\.\d*)?$') Then GUICtrlSetData($inTest, StringTrimRight($Read_Input, 1)) Else GUICtrlSetData($inTest, StringRegExpReplace($Read_Input, '^(-?)\.', '${1}0.')) EndIf EndIf EndFunc;==>_WM_COMMAND Edit Rectification : it could be done though by checking $EN_KILLFOCUS with WM_COMMAND (moment when the input loses focus) but it is hazardous, such a behavior could be baffling for the user ^^
    1 point
  5. At least I achieved you are willing to type a full sentence now. Going back to my cave now Jos
    1 point
  6. Reporting back with all my findings. Contains all the free/taken Com Ports via Binary to Hex [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\COM Name Arbiter] Parent Key for Devices GPS is under USB [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\ FriendlyName: What shows up in Device Manager DeviceParameters\PortName: The Actual Port Assignment If you Change in Device Manager Record of Ports [HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\SERIALCOMM] All Ports Registered and there settings HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Ports Seems the FriendlyName is key only effects the name you see in Device Manager, this one is system level permissions, but the Deviceparameters\PortName is the actual port asignment and its not locked to system. I can change it as admin without any permission changes. So of all the keys above I can change exclusively that one and it works! However its sloppy because I am not blocking/relieving any ports for autodetect, I am not changing the display name, I found the CurrentVersion\Ports key this must be where port settings are stored. Definitely close on this project. What would be awesome is a script to take all ports listed in HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Ports and do the conversion needed to block/unblock those ports in HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\COM Name Arbiter then you can just delete/add as needed and have the script/function do the update. Edit: I have a working script its sort of a "shotgun" approach. I am taking any/all instances of this device and making them Port25 I think this is safe because you can only have one device plugged in so its not like 2 of them will be attached causing a conflict. I do have Port25 being blocked out here in the ComDatabase but I am not relieving the old port, but that is not a major issue and ok for now until I can figure out how to make that work cleanly. This script runs as system so I did not need to use the SetACL to give permissions to change the FriendlyName. #RequireAdmin #Include <Array.au3> Local $sTestKey ="HKLM\SYSTEM\CurrentControlSet\Enum\USB\VID_067B&PID_2303" Local $sNewReg RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Ports", "COM25:", "REG_SZ", "9600,n,8,1") RegWrite("HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\SERIALCOMM", "\Device\ProlificSerial0", "REG_SZ", "COM25") For $i = 1 to 30 $sCurKey = RegEnumKey($sTestKey, $i) If @Error Then ExitLoop RegWrite($sTestKey & "\" & $sCurKey & "\Device Parameters", "PortName", "REG_SZ", "COM25") RegWrite($sTestKey & "\" & $sCurKey, "FriendlyName", "REG_SZ", "Prolific USB-to-Serial Comm Port (COM25)") Next $sComDB = RegRead("HKLM\SYSTEM\CurrentControlSet\Control\COM Name Arbiter", "ComDB") $sComDB = StringTrimLeft($sComDB, 2) $aComDB = _StringChop($sComDB, 2) ;Array of ComDB ;_ArrayDisplay($aComDB) ;Debug Show Array $aComDB[4] = "01" ;Change Port 25 to Occupied For $i = 1 to $aComDB[0] $sNewReg &= $aComDB[$i] Next ;Write Port25 Taken to Registry RegWrite("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\COM Name Arbiter", "ComDB", "REG_BINARY", Binary("0x" & $sNewReg)) ;Functions Func _StringChop($string, $size) $count = Ceiling(StringLen($string)/$size) Dim $array[$count+1], $start = 1 For $i = 1 To $count $array[$i] = StringMid($string, $start, $size) $start += $size Next $array[0] = $count Return $array EndFunc
    1 point
×
×
  • Create New...