Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 01/08/2023 in all areas

  1. Here my take on your request. Instead of using your keyboard, I have use a hook that disables unauthorized keys. #include <Constants.au3> #include <GUIConstants.au3> #include <WinAPISys.au3> #include <WinAPIConstants.au3> #include <WinAPIProc.au3> #include <Array.au3> Opt("MustDeclareVars", True) Global $aKeyWords[] = ["fight", "first", "fly", "third", "fire", "wall", "hi", "high", "hello", "world", "window", _ "window 1", "window 2", "window 3", "window 4", "window 5", "window 6", "window 7", "window 8", "window 9", "window 10"] Global $aAllowedChar = EnumerateChar(1, $aKeyWords) Global $hHook, $idList, $idDummy, $bAllowed Local $sSelected = SelectWord() MsgBox($MB_SYSTEMMODAL, "You have selected", $sSelected) Func SelectWord() Local $hGui = GUICreate("Select Word") $idList = GUICtrlCreateInput("", 10, 10, 100, 20) $idDummy = GUICtrlCreateDummy() Local $idKey = GUICtrlCreateDummy() Local $hStub = DllCallbackRegister(WH_KEYBOARD, "LRESULT", "int;wparam;lparam") $hHook = _WinAPI_SetWindowsHookEx($WH_KEYBOARD, DllCallbackGetPtr($hStub), 0, _WinAPI_GetCurrentThreadId()) Local $aAccelKeys[1][2] = [["{ENTER}", $idKey]] GUISetAccelerators($aAccelKeys) GUIRegisterMsg($WM_COMMAND, WM_COMMAND) GUISetState() Local $aWordsLeft = $aKeyWords, $sWordSelected While True Switch GUIGetMsg() Case $GUI_EVENT_CLOSE $sWordSelected = "" ExitLoop Case $idDummy $aWordsLeft = WordsLeft(GUICtrlRead($idList), $aKeyWords) _ArrayDisplay($aWordsLeft) If UBound($aWordsLeft) = 1 Then $sWordSelected = $aWordsLeft[0] ExitLoop EndIf $aAllowedChar = EnumerateChar(StringLen(GUICtrlRead($idList)) + 1, $aWordsLeft) ;_ArrayDisplay($aAllowedChar) Case $idKey $sWordSelected = GUICtrlRead($idList) ExitLoop EndSwitch WEnd GUIDelete($hGui) _WinAPI_UnhookWindowsHookEx($hHook) DllCallbackFree($hStub) Return $sWordSelected EndFunc Func WH_KEYBOARD($iMsg, $wParam, $lParam) ;ConsoleWrite("wm_keyb " & Chr($wParam) & "/" & Hex($wParam, 2) & "/" & $wParam & @CRLF) If $iMsg = 0 And $wParam <> 27 And $wParam <> 8 And $wParam <> 13 Then $bAllowed = _ArraySearch($aAllowedChar, Chr($wParam)) >= 0 If Not $bAllowed Then Return 1 EndIf Return _WinAPI_CallNextHookEx($hHook, $iMsg, $wParam, $lParam) EndFunc ;==>MyProc Func WM_COMMAND($hWnd, $iMsg, $wParam, $lParam) Local $iIDFrom = _WinAPI_LoWord($wParam) Local $iCode = _WinAPI_HiWord($wParam) If $iIDFrom = $idList And $iCode = $EN_CHANGE And $bAllowed Then GUICtrlSendToDummy($idDummy) Return $GUI_RUNDEFMSG EndFunc ;==>_WM_COMMAND Func EnumerateChar($iLen, ByRef $aList) Local $aChar[UBound($aList)] For $i = 0 To UBound($aList) - 1 $aChar[$i] = StringMid($aList[$i], $iLen, 1) Next Return $aChar EndFunc Func WordsLeft($sInclude, ByRef $aList) Local $aLeft = _ArrayFindAll($aList, "^" & $sInclude, Default, Default, Default, 3) For $i = 0 To UBound($aLeft) - 1 $aLeft[$i] = $aList[$aLeft[$i]] Next Return $aLeft EndFunc
    2 points
  2. start with: _WD_FrameList()
    2 points
  3. @iSanThanks for clarifying. No need to delete it, but you can certainly go back and edit it to avoid any future confusion. 😉
    1 point
  4. @iSanPlease try to be more detailed in your posts. When you make statements like and it comes across (at least to me) as if you are implying that there is an issue with the UDF. Based on what you've posted thus far, the issue is that you used the wrong xpath with _WD_GetTable. If you think there's a problem with the coding of _WD_GetTable, please elaborate.
    1 point
  5. I try not to answer such hypothetical questions or to make assumptions based on little to no information. There's a big difference between 20-30 concurrent connections that are requesting information and 20-30 concurrent connections that are being served streaming media. Regardless of the use case, if you are running an HTTP server on a woefully under-resourced PC and/or network, then obviously that would have an effect on the HTTP server's performance also. Given that you've provided absolutely NO details about your intended use case, the hardware it would be running on, and the fact that I have no idea how proficient a coder you are, the best answer is to try it and see. Even if you had provided more details, the answer would probably have been the same. This UDF is just a wrapper for some of the Microsoft's HTTP Server API's -- enough to provide general HTTP(s) request/response processing. If you have specific questions about Microsoft's HTTPAPI and its features, functionality, implementation, and/or limitations, then I suggest you start looking for those answers at the source, by reading the documentation on Microsoft's website. If/when you decide to use this UDF, and have specific questions, comments, or concerns related to the UDF itself, feel free to ask or comment.
    1 point
  6. Hi @iSan, I thought we already discussed this and solve it too, regarding counting table row elements 🧐 ?! Please see this post. Again: Global Const $sSelector = '//table[@id="ctl00_FastBusiness_MainReport_dirExtender_FormGridd98_gridTable"]//tr' MsgBox('', 'Count of found elements', _GetElementsCount($sSelector)) Func _FindElements($sSelector) Return _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, $sSelector, Default, True) EndFunc Func _GetElementsCount($sSelector) Return UBound(_FindElements($sSelector)) EndFunc This should work if your posted table element ID is correct. Best regards Sven
    1 point
  7. A better option would be to learn to use the browser's Dev Tools. Being proficient with them and you can more easily determine things like xpath, frame usage, etc.
    1 point
  8. So, any other way to get how many line/row in a table? Tryed FindElement with "//tr" but there are so many //tr in the web
    1 point
  9. Hi @Vorph. Step 1: So the issue with drawing the image on the graphics object is simply an issue with your alpha channel. In your WAD_ReadPictureV1 and WAD_ReadPictureV2 you use GDIP_PXF32ARGB, yet when you assign pixel colors with _GDIPlus_BitmapSetPixel your $palette array holds only RGB info, so the alpha value is 0x00 (for example: 0x008B0000) so when drawing to anything that supports the alpha channel nothing is shown because the pixels are fully transparent. The quick fix is to change GDIP_PXF32ARGB to GDIP_PXF32RGB in your functions. I would like to help with step 2, but it is currently very late 😅 Storing BLOB in SQLite, extracting it and using it with a bitmap object is not that difficult, but time consuming to make a working example, so if i have time another time and you havent solved it, I might make some example code for you Hope i helped somewhat.
    1 point
  10. Hey, so I've been using this, and it seems to work quite well :) However, I would suggest you rename your global variables, many of them have extremely common names, like $URL, $TOKEN etc which may cause conflicts with scripts that have similarly named globals. Personally I renamed some of the globals in your UDF, $TOKEN ---> $TELEGRAM_CURRENT_TOKEN $URL ---> $TELEGRAM_API_URL $OFFSET ---> $TELEGRAM_OFFSET $PAUSETIMER ---> $TELEGRAM_PAUSETIMER Other than the cleaning up the Globals, it seems fine so far..thanks!
    1 point
  11. Maybe something like this? $dir = @StartMenuDir MsgBox(0, 'Directory', $dir) $dirup1 = _upone($dir) MsgBox(0, 'Up One', $dirup1) Func _upone($arg) $ret = StringLeft($arg, StringInStr($arg, '\', 0, -1) - 1) Return $ret EndFunc You'll have to add error checking.
    1 point
  12. @SOLVE-SMART I tryed before, is my code right? $aTable = _WD_FindElement($sSession, 'xpath', '//table[@id="ctl00_FastBusiness_MainReport_dirExtender_FormGridd98_gridTable"]//tr', Default, True) $numTable = UBound($aTable) ConsoleWrite("How many row?" &$numTable) And _WD_FindElement ==> Success [0] : Parameters: Strategy=xpath Selector=//table[@id="ctl00_FastBusiness_MainReport_dirExtender_FormGridd98_gridTable"]//tr StartNodeID=Default Multiple=True ShadowRoot=Default How many row?1>Exit code: 0
    0 points
×
×
  • Create New...