Jump to content

Mingre

Active Members
  • Posts

    142
  • Joined

  • Last visited

About Mingre

  • Birthday 03/24/1992

Profile Information

  • Location
    Philippines
  • WWW
    http://mingresque.deviantart.com

Recent Profile Visitors

462 profile views

Mingre's Achievements

Adventurer

Adventurer (3/7)

0

Reputation

  1. Hello forums, My tablet's (T100TA) digitizer got broken and so the screen gets random phantom (haha) touch inputs. I can disable the whole touchscreen functionality but I can't because I really need to use the touchscreen. I can also have the digitizer replaced but unfortunately I don't have enough money to afford that now. As seen on the attached image, I'm able to detect the touchscreen inputs on the left side of the screen. (Those are the phantom touch inputs!) Problem is, is there a way to block those inputs (so instead of it sending a primary down, nothing is passed on the windows)? What I'm going to do is to block inputs only in areas where the phantom inputs usually are. I have done what I wanted with MrCreator's MouseOnEvent UDF with his "Restrict clicks in certain area" example but the downside is that both the touch AND mouse inputs are block. Thanks so much! Here's the WM_TOUCH code: #include <GUIConstantsEx.au3> #include <GuiButton.au3> #include <WindowsConstants.au3> #include <StructureConstants.au3> #include <GuiEdit.au3> #include <WinAPI.au3> #RequireAdmin Global $iMemo ;Global $WM_TOUCH = 0x240 Local $hGUI Global Const $tagTOUCHINPUT = "LONG x; LONG y; HANDLE hSource; DWORD dwID; DWORD dwFlags; DWORD dwMask; DWORD dwTime; ULONG_PTR dwExtraInfo; DWORD cxContact; DWORD cyContact" _Main() Func _Main() $hGUI = GUICreate("WM_TOUCH", 1080, 640) $iMemo = GUICtrlCreateEdit("", 10, 10, 300, 600, $WS_VSCROLL) _GUICtrlEdit_SetLimitText($iMemo, 0x80000000) GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New") DllCall("User32.dll", "BOOL", "RegisterTouchWindow", "HWND", $hGUI, "ULONG", 2) GUIRegisterMsg($WM_TOUCH, "WM_TOUCH") GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd Exit EndFunc ;==>_Main Func WM_TOUCH($hWnd, $Msg, $wParam, $lParam) Dim $arrayTouchInput[Int($wParam)] $Buffer = DllStructCreate("BYTE buffer[" & (Int($wParam)*40) & "]") ;GUICtrlSetData($iMemo, "BYTE buffer[" & (Int($wParam)*40) & "]" & @CRLF, 1) $TouchInfo = DllStructCreate($tagTOUCHINPUT, DllStructGetPtr($Buffer)) $pTouchInfo = DllStructGetPtr($TouchInfo) For $i = 0 To (Int($wParam)-1) Step 1 $arrayTouchInput[$i] = DllStructCreate($tagTOUCHINPUT, ($pTouchInfo+($i*40))) Next $aRet0 = DllCall("User32.dll", "BOOL", "GetTouchInputInfo", "HANDLE", $lParam, "UINT", $wParam, "ULONG_PTR", $pTouchInfo, "int", DllStructGetSize($TouchInfo)) ;GUICtrlSetData($iMemo, "@error: " & @error & @CRLF, 1) ;GUICtrlSetData($iMemo, "_WinAPI_GetLastError(): " & _WinAPI_GetLastError() & @CRLF, 1) ;GUICtrlSetData($iMemo, "Func0 Ret: " & $aRet0[0] & @CRLF, 1) GUICtrlSetData($iMemo, "************************************" & @CRLF, 1) GUICtrlSetData($iMemo, "Finger Numbers: " & Int($wParam) & @CRLF, 1) For $j = 0 To (Int($wParam)-1) Step 1 GUICtrlSetData($iMemo, "Points " & $j & " dwID: " & DllStructGetData($arrayTouchInput[$j], "dwID") & " ", 1) GUICtrlSetData($iMemo, " x: " & DllStructGetData($arrayTouchInput[$j], "x")/100 & " ", 1) GUICtrlSetData($iMemo, " y: " & DllStructGetData($arrayTouchInput[$j], "y")/100 & @CRLF, 1) Next ;GUICtrlSetData($iMemo, "TouchInfo Size: " & DllStructGetSize($TouchInfo) & @CRLF, 1) ;$aRet1 = DllCall("User32.dll", "BOOL", "CloseTouchInputHandle", "HANDLE", $lParam) ;GUICtrlSetData($iMemo, "Func1 Ret: " & $aRet1[0] & @CRLF, 1) ;$TouchInfo = 0 Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY
  2. @jchd (and to other kind souls) I have two HTML files saved as <*.txt>: one is the original version (ORIG.txt) and the other is the simplified one (SIMPLE.txt; simplified in the sense that all tag parameters are stripped off, e.g., <p style="bla bla"> turned to <p>). (Both are attached on this post.) I already got another code working, but for curiosity's sake, can you guys enlighten me why this code doesn't work on the original HTML? #include <Array.au3> Local $fileread = FileRead(@ScriptDir & '\ORIG.txt') ; Function does not work on this ;Local $fileread = FileRead(@ScriptDir & '\SIMPLE.txt') ; Function works on the simplified version of HTML. Local $ha[1] __retrieveList($ha, $fileread) _ArrayDisplay($ha) Func __retrieveList(ByRef $array, Const $string, $iRecursion = -1) If $iRecursion = -1 Then ReDim $array[1][2] $array[0][0] = '' $array[0][1] = '' EndIf $iRecursion += 1 Local Const $regEx_Start = "<li[^>]*?>", _ $regEx_End = "<\/li>", _ $regex = '(?imsx)' & _ '(?(DEFINE) (?<LiStart> ' & $regEx_Start & ' ) )' & _ '(?(DEFINE) (?<LiEnd> ' & $regEx_End & ' ) )' & _ '(?(DEFINE) (?<LiBlock> (?&LiStart) (?: (?&LiBlock)* | .*? )* (?&LiEnd) ) )' & _ '(?&LiBlock)' Local $data = StringRegExp($string, $regex, 3) ; Not Const because this will be modified later. Local $aTemp, $iUbound For $i = 0 To UBound($data) - 1 Step +1 $data[$i] = StringRegExpReplace($data[$i], '(?imsx)\A' & $regEx_Start & '(.*)' & $regEx_End & '\Z', '$1') $iUbound = UBound($array) If String($array[$iUbound - 1][0]) = "" Then $iUbound -= 1 ReDim $array[$iUbound + 1][2] $array[$iUbound][0] = $iRecursion ;$data[$i] If Not StringRegExp($data[$i], $regex) Then $array[$iUbound][1] = $data[$i] ContinueLoop EndIf $aTemp = StringRegExp($data[$i], '(?imsx)(\A.*?)(?:' & $regEx_Start & ')', 3) $array[$iUbound][1] = $aTemp[0] __retrieveList($array, $data[$i], $iRecursion) Next $iRecursion -= 1 Return 1 ; $data EndFunc ;==>__retrieveList SCiTE output: >Running:(3.3.14.2):C:\Program Files\AutoIt3\autoit3.exe "C:\Documents and Settings\G99\Desktop\__retrieveList.au3" --> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop !>19:39:49 AutoIt3.exe ended.rc:-1073741819 +>19:39:49 AutoIt3Wrapper Finished. >Exit code: 3221225477 Time: 0.6851 Anyway, here's the other code I'm referring to, quite a different approach but basically does what I want. This works on both HTML files. #include <Array.au3> Local $fileread = FileRead(@ScriptDir & '\ORIG.txt') ; This works. ;Local $fileread = FileRead(@ScriptDir & '\SIMPLE.txt') ; This works. Local $ha[1] __retrieveList($ha, $fileread) _ArrayDisplay($ha) Func __retrieveList(ByRef $array, $s__parsedRight, $i__recurse = -1) If $i__recurse = -1 Then ReDim $array[1][2] $array[0][0] = '' $array[0][1] = '' EndIf $i__recurse += 1 Local Const $s__keyWord = 'li', _ $s__start = "<" & $s__keyWord & "[^>]*?>", _ $s__end = "<\/" & $s__keyWord & ">", _ $s__regEx = "(?ims)\A.*?(" & $s__start & ".*?" & $s__end & ")" Local $s__parsedLeft = '', $a__temp[1], $i__uBound Do Switch UBound(StringRegExp($s__parsedLeft, $s__start, 3)) Case 0 Case UBound(StringRegExp($s__parsedLeft, $s__end, 3)) $a__temp = StringRegExp($s__parsedLeft, '\A' & $s__start & '(.*)' & $s__end & '\Z', 3) $i__uBound = UBound($array) If String($array[$i__uBound - 1][0]) = "" Then $i__uBound -= 1 ReDim $array[$i__uBound + 1][2] $array[$i__uBound][0] = $i__recurse $array[$i__uBound][1] = $a__temp[0] If StringRegExp($a__temp[0], $s__start) Then __retrieveList($array, $a__temp[0], $i__recurse) Case Else $s__parsedLeft &= __parse($s__parsedRight, "(?ims)(\A.*?" & $s__end & ")") ContinueLoop EndSwitch $s__parsedLeft = __parse($s__parsedRight, $s__regEx) Until @error $i__recurse -= 1 EndFunc ;==>__retrieveList Func __parse(ByRef $parsedString, $s__regEx) Local Const $a__temp = StringRegExp($parsedString, $s__regEx, 3) If @error Then Return SetError(1, 0, 0) $parsedString = StringRegExpReplace($parsedString, $s__regEx, "") Return $a__temp[0] EndFunc ;==>__parse SIMPLE.txt ORIG.txt
  3. Hello, sorry if I'm committing the crime of "necro-ing" a thread here but having received lots of help from this community, I just felt obliged to post this working version (at least in my 32-bit Win XP PC with MS Excel 2010) for the benefit of those who still need this: #include <GUIConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> ; ; Embedding an Excel document inside an AutoIt GUI ; ; Limitations: ; ; 1. Integrating the GUI Menu with the Objects Menu does not work. ; (they have seperate menu bars) ; ; Initialize my error handler $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc") ;~ $FileName=@ScriptDir & "\Worksheet.xls" $FileName = FileOpenDialog("Pick a file", @ScriptDir, "Excel Files (*.xls;*.xlsx)") If Not FileExists($FileName) Then MsgBox(0, "Excel File Test", "Can't run this test, because it requires an Excel file in " & $FileName) Exit EndIf $oExcelDoc = ObjGet($FileName) ; Get an Excel Object from an existing filename If IsObj($oExcelDoc) Then GUICreate("Embedded ActiveX Test", 640, 580, (@DesktopWidth - 640) / 2, (@DesktopHeight - 580) / 2, $WS_MINIMIZEBOX + $WS_SYSMENU + $WS_CLIPCHILDREN) $GUI_ActiveX = GUICtrlCreateObj($oExcelDoc, 1, 95, 400, 300) For $Bar In $oExcelDoc.CommandBars If $Bar.Enabled = True Then $Bar.Enabled = False If $Bar.Visible = True Then $Bar.Visible = False Next $oExcelDoc.Application.DisplayFormulaBar = False $oExcelDoc.Application.CommandBars("Shadow Settings").Visible = False $oExcelDoc.Application.DisplayScrollBars = True $oExcelDoc.Application.DisplayStatusBar = False ControlHide("Embedded ActiveX Test", "", "[CLASS:EXCEL2; INSTANCE:1]") ControlHide("Embedded ActiveX Test", "", "[CLASS:EXCEL2; INSTANCE:2]") GUISetState(@SW_SHOW) ;Show GUI ; GUI Message loop While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ;or $msg = $GUI_FileExit ExitLoop EndSelect WEnd GUIDelete() ; Don't forget to close your workbook, otherwise Excel will stay in memory after the script exits ! $oExcelDoc.Close(0) ; Close the Excel workbook - Save prompt will not open EndIf Exit ; This is my custom error handler Func MyErrFunc() $HexNumber = Hex($oMyError.number, 8) MsgBox(0, "AutoItCOM Test", "We intercepted a COM Error !" & @CRLF & @CRLF & _ "err.description is: " & @TAB & $oMyError.description & @CRLF & _ "err.windescription:" & @TAB & $oMyError.windescription & @CRLF & _ "err.number is: " & @TAB & $HexNumber & @CRLF & _ "err.lastdllerror is: " & @TAB & $oMyError.lastdllerror & @CRLF & _ "err.scriptline is: " & @TAB & $oMyError.scriptline & @CRLF & _ "err.source is: " & @TAB & $oMyError.source & @CRLF & _ "err.helpfile is: " & @TAB & $oMyError.helpfile & @CRLF & _ "err.helpcontext is: " & @TAB & $oMyError.helpcontext _ ) SetError(1) ; to check for after this function returns EndFunc ;==>MyErrFunc I simply added these lines: ControlHide("Embedded ActiveX Test", "", "[CLASS:EXCEL2; INSTANCE:1]") ControlHide("Embedded ActiveX Test", "", "[CLASS:EXCEL2; INSTANCE:2]")
  4. I don't know proper HTML but sometimes there are intervening texts between two "</li>". #include<array.au3> Local $s = "<li><b>One<li>Inner<li>Innermost</li></li></b></li><li>Two</li>" _ArrayDisplay(stringregexp($s , "(<li>.*?(?:</li>)+)" , 3))
  5. I actually trimmed the ends after getting the content Here's what I'm working with straight from SCiTe, hehe. Sorry for my messy coding style! #include <Array.au3> Local $s = "Lal<li>One<li>Inner<li hehe>Innermost</li></li><li>Inner 2<li>Innermost 2</li></li></li><li>Two</li>" ;GLobal $iRecursion = 0 ;Local $s = "Innermost" Local $ha[1][2] hehe($ha, $s) _ArrayDisplay($ha) Func hehe(ByRef $array, $x, $iRecursion = -1) $iRecursion += 1 Local Const $regEx_Start = "<li[^>]*?>" Local Const $start = '(?(DEFINE) (?<LiStart> ' & $regEx_Start & ' ) )' Local Const $regEx_End = "<\/li>" Local Const $end = '(?(DEFINE) (?<LiEnd> ' & $regEx_End & ' ) )' Local $regex = _ '(?imsx)' & _ $start & _ $end & _ '(?(DEFINE) (?<LiBlock> (?&LiStart) (?: (?&LiBlock)* | .*? )* (?&LiEnd) ) )' & _ '(?&LiBlock)' Local $data = StringRegExp($x, $regex, 3) ;Consolewrite(@LF & 'x' & ' - ' & $x) Local $left, $wilLRecurse For $i = 0 To UBound($data) - 1 Step +1 $data[$i] = StringRegExpReplace($data[$i], _ '(?imsx)\A' & $regEx_Start & '(.*)' & $regEx_End & '\Z', '$1') $wilLRecurse = False If StringRegExp($data[$i], $regex) Then $wilLRecurse = True $left = $data[$i] $hi = StringRegExp($data[$i], '(?imsx)(\A.*?)(?:' & $regEx_Start & ')', 3) $data[$i] = $hi[0] EndIf ;_ArrayDisplay($left) _ArrayAdd($array, $iRecursion) $array[UBound($array) -1][1] = $data[$i] ConsoleWrite(@LF & $iRecursion & ' - ' & $data[$i]) If $wilLRecurse Then hehe($array, $left, $iRecursion) ;EndIf Next ; $iRecursion -= 1 ;_ArrayDisplay($data, $x) Return $data EndFunc ;==>hehe
  6. @mikell If it's done that way, the first encountered "</li>" from the left will be a match, which isn't exactly the pair of the outermost "<li>".
  7. Thanks also for the tip re: unescaped whitespaces. I was having a hard time reading through regexps because of the lack of spaces.
  8. @jchd Thanks so much! That's exactly what I need tho I don't really understand that regexp Will try to learn it. Again, thanks!
  9. #include <Array.au3> ; Script Start - Add your code below here Local $test = "<li>One<li>Inner<li>Innermost</li></li></li>" & _ "<li>Two</li> " $loob = StringRegExp($test, '\Q<li>\E(.*?)\Q</li>\E', 3) _ArrayDisplay($loob, "How to return the One... and Two?") Hello, can somebody help me: (1) How can I have the regexp matched the two outermost bullets? Such that: (2) How can I match the "Innermost" bullet? Thanks so much.
  10. Ok, thanks so much!
  11. What I'm trying to achieve is to run a UDF (e.g., _ArrayDisplay) with this, but that requires #include... Local $sCommand = 'Local $x[2] = [0, 1], $dummy = _ArrayDisplay($x)' $sCommand = '"' & StringReplace($sCommand, '"', "'") & '"' ConsoleWrite($sCommand & @CRLF) Run(@AutoItExe & ' /AutoIt3ExecuteLine ' & $sCommand)
  12. @jguinch Thanks for the rep! But what confuses me is how this code (which translates to three lines in a typical autoit code) works. Local $sCommand = '(msgBox(0, "First", "") * (Tooltip("Boo!") * (msgBox(0, "Second", "")' $sCommand = '"' & StringReplace($sCommand, '"', "'") & '"' ConsoleWrite($sCommand & @CRLF) Run(@AutoItExe & ' /AutoIt3ExecuteLine ' & $sCommand) Do you know a list of notations, e.g., "( ) * ( )", that I can use? Thanks!
  13. To put all my questions simply: is there a pattern/syntax to convert an autoit program (say a couple of lines) to a single line that can be run with "/AutoIt3ExecuteLine"?
  14. Hello, I just learned about /AutoIt3ExecuteLine to run lines outside your codes. The usual code passed to run a series of lines is to put all those lines in a single declaration line such as Local (see above post). But I learned through guinness' _InetGet() function (see below) another way of running series of lines: Local $cmd = 'Exit (msgBox(0, "First", "") ? 1 : 0) * (msgBox(0, "Second", "") ? 1 : 0)' My questions are: (1) Am I right in saying that the code below basically translates to the next one? Local $cmd = 'Exit (msgBox(0, "First", "") ? 1 : 0) * (msgBox(0, "Second", "") ? 1 : 0)' Local $sCommand = '"' & StringReplace($cmd, '"', "'") & '"' ConsoleWrite($sCommand & @CRLF) Run(@AutoItExe & ' /AutoIt3ExecuteLine ' & $sCommand) msgBox(0, "First", "") msgBox(0, "Second", "") Exit (2) Can someone explain how "( ? 1: 0)" works? I see them as ways to run two separate lines but using them as such won't allow me to run this: Local $sCommand = _ 'Exit (Local $x = msgBox(0, "First", "")) * (msgBox(0, "Second", "") ? 1 : 0)' $sCommand = '"' & StringReplace($sCommand, '"', "'") & '"' ConsoleWrite($sCommand & @CRLF) Run(@AutoItExe & ' /AutoIt3ExecuteLine ' & $sCommand) Thanks so much!
×
×
  • Create New...