Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 03/28/2016 in all areas

  1. Here some photos: Guess who is who!
    4 points
  2. My grandmother is a true code-whispers.
    2 points
  3. Updated UDF to v3.5 Updated Metro Msgbox function to support different button combinations like the default MsgBox function in Autoit.(See Help file for the button combination flags) Added function "_Metro_RadioIsChecked" due to request. Changed default font to Arial because "Calibri Light" is not installed on all Windows 7 computers. Updated example.
    1 point
  4. AutoBert

    GUI from function question

    There is nothing missing. There is 1 Local to much. The 2. in line 12, after removing it the ControlID of the LV is assigned to Global $ListView (line 6) as needed.
    1 point
  5. You can use this example. To call it, just use this: _GUIDisable($Form1, 0, 30);For better visibility of the second GUI _SecondGUI() _GUIDisable($Form1) Func _SecondGUI() $Form2 = _Metro_CreateGUI("Example 2", 500, 300, -1, -1, True, True) ;Set variables $GUI_HOVER_REG2 = $Form2[1] $GUI_CLOSE_BUTTON_GUI2 = $Form2[2] $Form2 = $Form2[0] GUISetState(@SW_SHOW) While 1 _Metro_HoverCheck_Loop($GUI_HOVER_REG2, $Form2);Add hover check in loop $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE, $GUI_CLOSE_BUTTON_GUI2 _Metro_GUIDelete($GUI_HOVER_REG2, $Form2) _GUI_DragAndResizeUpdate($Form1);Update the first GUI to properly support drag/resize again. (Only needed if you created 2 guis with control buttons(close,minimize,maximize)) Return 0 EndSwitch WEnd EndFunc ;==>_SecondGUI There is no function for a metro style edit. But you can use "0" as ex-style parameter to make it look modern/flat: $Edit1 = GUICtrlCreateEdit("", 15, 285, 430, 213, BitOR($ES_AUTOVSCROLL, $ES_READONLY, $WS_VSCROLL), 0) I never needed that before. As given in the example, I usually execute what has to be done after the user selects a radio But I will update the UDF today and add that check function + example. As written via PM, this can be done with a custom gui or by simply copying the default metro msgbox function and modifying it. If I find some time, i will try to update the message box function to support the default button types that the normal MsgBox of Autoit also supports.
    1 point
  6. Well then sort it as soon as it becomes an array. If you then want to hard code the declaration string of the sorted array, you could try this:
    1 point
  7. #include "_ProgressGUI.au3" $Return = _ProgressGUI("Time Left:", 1, 30, "", 400, 300);, 4, 6) $count = 0 For $I = 100 To 0 Step -1 GUICtrlSetData($Return[1], $I) Sleep(100) GUICtrlSetData($Return[2], "Time Left: " & $I) ; $Return[2] = control ID of label Next GUICtrlSetData($Return[2], "DONE!!") Sleep(2000) GUIDelete($Return[0]) This is probably what you're looking for.
    1 point
  8. We are all "young".
    1 point
  9. Hi all, A new, slightly tweaked Alpha version of the UDF and 2 examples - see posts #465 & #470 above for explanations on how it differs from the last release: <snip> All comments welcome. M23
    1 point
  10. @czardas, thank you! Best regards
    1 point
  11. 1.A. I was wrong chrome popup seems not to be readable with AutoIT functions B. Advice is first to use highlight functions and work per object in the hierarchy If stuff seems to be to difficult even after using inspect.exe to see full tree just start using $treescope_subtree if you are 100% sure your tree is not huge anymore. Working source with UIAWrappers below (click is commented out), you can try by just typing javascript:alert("Hello world");void(0); in your chrome addressbar ;~ *** Standard code Flexible*** #include "UIAWrappers.au3" AutoItSetOption("MustDeclareVars", 1) Local $oP4=_UIA_getObjectByFindAll($UIA_oDesktop, "Title:=.*Google Chrome;controltype:=UIA_WindowControlTypeId;class:=Chrome_WidgetWin_1", $treescope_children) Local $oP3=_UIA_getObjectByFindAll($oP4, "controltype:=UIA_PaneControlTypeId;class:=Chrome_WidgetWin_1", $treescope_children) ;~ Local $oP2=_UIA_getObjectByFindAll($oP3, Title:=;controltype:=UIA_CustomControlTypeId;class:=, $treescope_children) ;~ Local $oP1=_UIA_getObjectByFindAll($oP2, Title:=;controltype:=UIA_CustomControlTypeId;class:=, $treescope_children) ;~ Local $oP0=_UIA_getObjectByFindAll($oP1, "Title:=OK;controltype:=UIA_ButtonControlTypeId", $treescope_children) ;~ First find the object in the parent before you can do something ;~$oUIElement=_UIA_getObjectByFindAll("OK.mainwindow", "title:=OK;ControlType:=UIA_TextControlTypeId", $treescope_subtree) ;~ Local $oUIElement=_UIA_getObjectByFindAll($oP0, "title:=OK;ControlType:=UIA_TextControlTypeId", $treescope_subtree) ;~ Local $oUIElement=_UIA_getObjectByFindAll($oP4, "Title:=OK;controltype:=UIA_ButtonControlTypeId", $treescope_children) Local $oUIElement=_UIA_getObjectByFindAll($oP4, "Title:=OK;controltype:=UIA_ButtonControlTypeId", $treescope_subtree) _UIA_Action($oP4,"setfocus") ;~ _UIA_action($oP4,"highlight") _UIA_Action($oP3,"setfocus") _UIA_action($oP3,"highlight") _UIA_action($oUIElement,"highlight") _UIA_Action($oP4,"setfocus") _UIA_Action($oP3,"setfocus") ;~ _UIA_action($oUIElement,"click") Steps are basically 1. Find the main window of the application under the desktop $treescope_children 2. Find the subwindow within your application $treescope_children and sometimes $treescope_subtree 3. Find the element you need and as this one is sometimes in a deep difficult treehierarchy you can use $treescope_subtree So maybe cleaned for chrome it can look like this #include "UIAWrappers.au3" AutoItSetOption("MustDeclareVars", 1) Local $oChrome=_UIA_getObjectByFindAll($UIA_oDesktop, "Title:=.*Google Chrome;controltype:=UIA_WindowControlTypeId;class:=Chrome_WidgetWin_1", $treescope_children) ;~ Local $oChromeDocument=_UIA_getObjectByFindAll($oChrome, "Title:=Accessibility;controltype:=UIA_DocumentControlTypeId;class:=Chrome_RenderWidgetHostHWND, $treescope_children) Local $oChromeDocument=_UIA_getObjectByFindAll($oChrome, "controltype:=UIA_DocumentControlTypeId;class:=Chrome_RenderWidgetHostHWND", $treescope_children) ;~ Local $oP0=_UIA_getObjectByFindAll($oP1, Title:=;controltype:=UIA_CustomControlTypeId;class:=, $treescope_children) ;~ First find the object in the parent before you can do something ;~$oUIElement=_UIA_getObjectByFindAll("Globalaccessibilitymode:.mainwindow", "title:=Global accessibility mode: ;ControlType:=UIA_TextControlTypeId", $treescope_subtree) Local $oUIElement=_UIA_getObjectByFindAll($oChromeDocument, "title:=Global accessibility mode: ;ControlType:=UIA_TextControlTypeId", $treescope_subtree) _UIA_Action($oChrome,"setfocus") _UIA_Action($oChromeDocument,"setfocus") _UIA_action($oChrome,"highlight") _UIA_action($oChromeDocument,"highlight") _UIA_action($oUIElement,"highlight") ;~ _UIA_action($oUIElement,"click")
    1 point
  12. dynamitemedia, The up/down keys do not work in the combo because you have set them as Accel keys - so we have to check whether the combo is open and, if so, cancel the Accel keys (look at lines 177-189): #include <GUIConstantsEx.au3> #include <ButtonConstants.au3> #include <WinAPI.au3> #include <File.au3> #include <Date.au3> #include <MsgBoxConstants.au3> #include <StringConstants.au3> #include <GuiComboBox.au3> #include <Array.au3> #include "GUIScrollbars_Ex.au3" ; Declare global arrays to hold ControlIDs Global $aImage, $aButton, $aLabel ; Declare image count Global $iCount ; Max buttons per row Global $iCol_Count = 5 Global $hActive, $iRow_Count, $hDialog, $fFocusMain = True, $cCurrFocus = 9999 Global $f1stTimeOpened = True Global $sImg2load1stTime = @ScriptDir & "\www\img\maxresdefault.jpg" Global $idLblTime ; Create listing filter Global $sListFilter = "" ; Set max dialog size $iDialog_Width = 1265 $iDialog_Depth = 720 ; Determine button width $iButton_Dim = Floor(($iDialog_Width - 10 - _WinAPI_GetSystemMetrics(2)) / $iCol_Count) ; Determine required depths $iVisRows = 0 While 1 $iVisRows += 1 If $iButton_Dim * $iVisRows > $iDialog_Depth Then $iVisRows -= 1 ExitLoop EndIf WEnd $iDialog_Depth = ($iButton_Dim * $iVisRows) + 10 ; Add the space for the buttons to get the main GUI size $iMain_Depth = $iDialog_Depth + 200 Mainscript() Func Mainscript() ; Liat the images to display $aImage = _List_Images($sListFilter) $iCount = UBound($aImage) ; Create arrays to hold button and label ControlIDs Global $aButton[$iCount], $aLabel[$iCount] ; Determine rows required $iRow_Count = Ceiling($iCount / $iCol_Count) ; Determine Bottom positions $clockDepth = $iMain_Depth - 60 ; Create main GUI $hGUI = GUICreate("MainGUI", $iDialog_Width, $iMain_Depth) $idLblTime = GUICtrlCreateLabel(" ", ($iDialog_Width - 180), 36, 300, 65) $iLastSec = @SEC GUICtrlSetFont(-1, 20, 600, 0, "Arial") $sAddDate = _DateTimeFormat(_NowCalc(), 1) $idLblDate = GUICtrlCreateLabel($sAddDate, 40, $clockDepth, 420, 65) GUICtrlSetFont(-1, 20, 600, 0, "Arial") ;Create a combobox control. Local $idComboBox = GUICtrlCreateCombo("", 40, 32, 260, 250) GUICtrlSetFont(-1, 20, 600, 0, "Arial") ;Add items to the combobox. GUICtrlSetData($idComboBox, "Constants|Functions") GUICtrlSetFont(-1, 20, 600, 0, "Arial") $cGo = GUICtrlCreateButton("GO", ($iDialog_Width / 2) - 300, 20, 160, 60) GUICtrlSetFont(-1, 20, 600, 0, "Arial") $cRefresh = GUICtrlCreateButton("Refresh", ($iDialog_Width - 508), $clockDepth - 20, 224, 60) GUICtrlSetFont(-1, 20, 600, 0, "Arial") $exitButton = GUICtrlCreateButton("Exit", ($iDialog_Width - 260), $clockDepth - 20, 224, 60) GUICtrlSetFont(-1, 20, 600, 0, "Arial") GUISetState() ; Create dialog $hDialog = GUICreate("", $iDialog_Width, $iDialog_Depth, 0, 100, $WS_POPUP, $WS_EX_MDICHILD, $hGUI) GUISetBkColor(0xFFFFFF) If $iRow_Count > $iVisRows Then _GUIScrollbars_Generate($hDialog, 0, $iButton_Dim * $iRow_Count) EndIf ; <<<<<<<<<<<------------- load opening page info ----------------->>>>>>>>>>>>>>> Local $idPic = GUICtrlCreatePic($sImg2load1stTime, 30, 30, 500, 450) ; <<<<<<<<<<<----------------------------------------------------------------->>>>>>>>>>>>>>> ; Create dummy controls $cDummy_Up = GUICtrlCreateDummy() $cDummy_Dn = GUICtrlCreateDummy() $cDummy_Left = GUICtrlCreateDummy() $cDummy_Right = GUICtrlCreateDummy() $cDummy_PgDn = GUICtrlCreateDummy() $cDummy_PgUp = GUICtrlCreateDummy() GUISetState() ; Set the Up/Down/Left/Right keys as accelerators - they will only act like this when your GUI is active Local $aAccelKeys[6][2] = [["{UP}", $cDummy_Up], ["{DOWN}", $cDummy_Dn], ["{LEFT}", $cDummy_Left], ["{RIGHT}", $cDummy_Right], ["{PGUP}", $cDummy_PgUp], ["{PGDN}", $cDummy_PgDn]] GUISetAccelerators($aAccelKeys, $hGUI) GUISetAccelerators($aAccelKeys, $hDialog) ; Set flag to show Accel keys active Local $fAccelSet = True While 1 $iMsg = GUIGetMsg() Switch $iMsg Case $GUI_EVENT_CLOSE ExitLoop Case $exitButton ExitLoop Case $cGo If $f1stTimeOpened Then GUICtrlDelete($idPic) $f1stTimeOpened = False EndIf $sListFilter = StringStripWS(GUICtrlRead($idComboBox), $STR_STRIPLEADING) ConsoleWrite("$sListFilter : " & $sListFilter & @CRLF) _Load_Images($sListFilter) Case $cRefresh If $f1stTimeOpened Then ; Do nothing Else _Load_Images($sListFilter) EndIf Case $cDummy_Up _Move_Focus($hDialog, 1) Case $cDummy_Dn _Move_Focus($hDialog, 2) Case $cDummy_Left _Move_Focus($hDialog, 3) Case $cDummy_Right _Move_Focus($hDialog, 4) Case $cDummy_PgUp GUICtrlSetState($cGo, $GUI_FOCUS) Case $cDummy_PgDn GUICtrlSetState($cCurrFocus, $GUI_FOCUS) Case 0 ; Do nothing - needed because button array is empty when first started Case Else For $i = 0 To $iCount - 1 If $iMsg = $aButton[$i] Then MsgBox($MB_SYSTEMMODAL, "Pressed", GUICtrlRead($aButton[$i])) ExitLoop EndIf Next EndSwitch ; Check if combo opened and Accel keys set If _GUICtrlComboBox_GetDroppedState($idComboBox) And $fAccelSet Then ; Clear flag and stop Accel keys $fAccelSet = False GUISetAccelerators(0, $hGUI) GUISetAccelerators(0, $hDialog) ; Check if combo closed and Accel keys inactive ElseIf (Not _GUICtrlComboBox_GetDroppedState($idComboBox)) And (Not $fAccelSet) Then ; Set flag and reset Accel keys $fAccelSet = True GUISetAccelerators($aAccelKeys, $hGUI) GUISetAccelerators($aAccelKeys, $hDialog) EndIf ; Get focused control $hCurrFocus = _WinAPI_GetFocus() ; If it has changed If $hCurrFocus <> $hActive Then ; See if it is a button For $i = 0 To $iCount - 1 If $hCurrFocus = GUICtrlGetHandle($aButton[$i]) Then ; Reset all the labels For $j = 0 To $iCount - 1 GUICtrlSetBkColor($aLabel[$j], 0xFFFFFF) Next ; Highlight the correct label GUICtrlSetBkColor($aLabel[$i], 0x00FF00) ; Store ControlID $cCurrFocus = $aButton[$i] ExitLoop EndIf Next $hActive = $hCurrFocus EndIf _UpdateTime() WEnd EndFunc ;==>Mainscript Func _Draw_Images() ; Create labels For $i = 0 To $iRow_Count - 1 For $j = 0 To $iCol_Count - 1 $iIndex = $j + ($i * $iCol_Count) If $iIndex > $iCount - 1 Then ExitLoop $aLabel[$iIndex] = GUICtrlCreateLabel("", 10 + ($iButton_Dim * $j), 10 + ($iButton_Dim * $i), $iButton_Dim - 10, $iButton_Dim - 10) GUICtrlSetBkColor($aLabel[$iIndex], 0xFFFFFF) GUICtrlSetState($aLabel[$iIndex], $GUI_DISABLE) GUICtrlSetResizing($aLabel[$iIndex], $GUI_DOCKALL) Next Next ; Create buttons For $i = 0 To $iRow_Count - 1 For $j = 0 To $iCol_Count - 1 $iIndex = $j + ($i * $iCol_Count) If $iIndex > $iCount - 1 Then ExitLoop $aButton[$iIndex] = GUICtrlCreateButton($aImage[$iIndex], 15 + ($iButton_Dim * $j), 15 + ($iButton_Dim * $i), $iButton_Dim - 20, $iButton_Dim - 20, $BS_BITMAP) GUICtrlSetImage($aButton[$iIndex], $aImage[$iIndex]) GUICtrlSetResizing($aButton[$iIndex], $GUI_DOCKALL) Next Next ; Set default button GUICtrlSetState($aButton[0], $GUI_FOCUS) GUICtrlSetBkColor($aLabel[0], 0x00FF00) $hActive = GUICtrlGetHandle($aButton[0]) EndFunc ;==>_Draw_Images Func _Load_Images($sListFilter) ; Remove current images, buttons and labels For $i = 0 To $iCount - 1 GUICtrlDelete($aButton[$i]) GUICtrlDelete($aLabel[$i]) Next ; Liat the images to display $aImage = _List_Images($sListFilter) $iCount = UBound($aImage) ; Create arrays to hold button and label ControlIDs Global $aButton[$iCount], $aLabel[$iCount] ; Determine rows required $iRow_Count = Ceiling($iCount / $iCol_Count) ; Redraw buttons _Draw_Images() ; Scrol to top, hide and if required reset the scrolling _GUIScrollbars_Scroll_Page($hDialog, 0, 1) _GUIScrollBars_ShowScrollBar($hDialog, $SB_BOTH, False) If $iRow_Count > $iVisRows Then _GUIScrollbars_Generate($hDialog, 0, $iButton_Dim * $iRow_Count) EndIf EndFunc ;==>_Load_Images Func _List_Images($sFilter) ; Here you would have your FileListToArray lines to get a list of the images to display ; But for this example we will look in the AutoIt include folder and show files with/without "Constant" in the name Local $sIncludeFolder = StringLeft(@AutoItExe, StringInStr(@AutoItExe, "\", Default, -1)) & "Include" Local $aList = _FileListToArray($sIncludeFolder, "*.au3", $FLTA_FILES) ; Now filter according to the setting For $i = $aList[0] To 1 Step -1 Switch $sFilter Case "Functions" If StringInStr($aList[$i], "Constant") Then _ArrayDelete($aList, $i) $aList[0] -= 1 EndIf Case "Constants" If Not StringInStr($aList[$i], "Constant") Then _ArrayDelete($aList, $i) $aList[0] -= 1 EndIf EndSwitch Next ; Remove the count element _ArrayDelete($aList, 0) ; And return the list Return $aList EndFunc ;==>_List_Images Func _Move_Focus($hDialog, $iMode) Local $iNext_Button, $iRow, $iNewRow Local $iRow_Count = Ceiling($iCount / $iCol_Count) ; Get active control $hActive = _WinAPI_GetFocus() For $i = 0 To $iCount - 1 ; If it is a button If $hActive = GUICtrlGetHandle($aButton[$i]) Then ; Determine row $iRow = Int($i / $iCol_Count) $iNewRow = $iRow ; Set default value for next button $iNext_Button = $i Switch $iMode Case 1 ; Not if in top row If $iRow Then $iNext_Button -= $iCol_Count ; Set new row $iNewRow -= 1 EndIf Case 2 ; Not if in bottom row or there no button below If ($iRow < $iRow_Count - 1) And ($i + $iCol_Count < $iCount) Then $iNext_Button += $iCol_Count ; Set new row $iNewRow += 1 EndIf Case 3 ; If not first button If $i <> 0 Then $iNext_Button -= 1 $iNewRow = Int($iNext_Button / $iCol_Count) EndIf Case 4 ; If not last button If $i <> $iCount Then $iNext_Button += 1 $iNewRow = Int($iNext_Button / $iCol_Count) EndIf EndSwitch ; Set focus to new button GUICtrlSetState($aButton[$iNext_Button], $GUI_FOCUS) ; Get button into view by scrolling to page which includes button _GUIScrollbars_Scroll_Page($hDialog, 0, Int($iNewRow / 2) + 1) ; No point in looking further ExitLoop EndIf Next EndFunc ;==>_Move_Focus Func _UpdateTime() Static Local $iLastSec = @SEC $iCurrSec = @SEC If $iCurrSec <> $iLastSec Then $iLastSec = $iCurrSec GUICtrlSetData($idLblTime, "" & _NowTime()) EndIf EndFunc ;==>_UpdateTime I have also adjusted the behaviour of the "Refresh" key - if there is nothing to refresh it does nothing! Plus one or two other little tweaks which should be obvious. I do not fully understand what you mean when you say: Do you mean that you want to put all of that GUI on a tab control with a setting page on another tab? If so I would counsel against it - what is wrong with adding a "Settings" button to open a separate dialog? M23
    1 point
  13. You must use the $bReturnPath param in _FileListToArray .
    1 point
  14. 1. Not behind my pc so wait a little longer A. Can be done with regular autoit functions B. Just with the uiawrapper functions 2. You have access to full dom of html. See http://www.w3schools.com/jsref/prop_html_innerhtml.asp But many more properties and frames can complicate the answer.
    1 point
  15. Within chrome you can see whole uia accessibility tree by typing chrome://accessibility. That information you can get with iuiautomation using find and treewalker functions. As thats frequently limited you can get everything thru short javascript in adressbar. By A.injecting websocket javascript or B.textbox adding within html page and filling with information you can read with iuiautomation or C. Javascript:alert(.....);void(0); and read the info from the popupbox. B and C work with most browsers and A is more difficult as you sometimes need certificates with https websites.
    1 point
  16. You seem to be referring to an html page. Most likely a bookmarklet in your addressbar can most easily do what you want. Simple example that shows you all text of your page. You can make this as advanced as you want with oneliners of javascript javascript:alert(document.body.innerText); Scraping popupbox should not be difficult
    1 point
  17. Hi, I got it to work. Changed structures a little bit and worked like a charm. Thank you for your help! Global Const $tagPOINT = "struct; long X;long Y; endstruct;" Global Const $tagRECT = "struct; long Left;long Top;long Right;long Bottom; endstruct;" Global Const $tagPOINTER_INFO = "struct;struct;int pointerType;int pointerId;int frameId;int pointerFlags;hwnd sourceDevice;hwnd hwndTarget;struct;int ptPixelLocation_x;int ptPixelLocation_y;endstruct; struct;int ptHimetricLocation_x;" & _ "int ptHimetricLocation_y;endstruct; struct;int ptPixelLocationRaw_x;int ptPixelLocationRaw_y;endstruct;struct;int ptHimetricLocationRaw_x;int ptHimetricLocationRaw_y;endstruct;dword dwTime;" & _ "int historyCount;int inputData;dword dwKeyStates;UINT64 PerformanceCount;int ButtonchangeType;endstruct;" Global Const $tagPOINTER_TOUCH_INFO = $tagPOINTER_INFO & "int touchFlags;int touchMask;struct;int rcContact_left;int rcContact_right;int rcContact_top;int rcContact_bottom;endstruct;struct;int rcContactRaw_left;int rcContactRaw_right;" & _ "int rcContactRaw_top;int rcContactRaw_bottom;endstruct;int orientation;int pressure;endstruct;" Global Const $TOUCH_FEEDBACK_DEFAULT = 0x1 Global Const $TOUCH_FEEDBACK_INDIRECT = 0x2 Global Const $TOUCH_FEEDBACK_NONE = 0x3 Global Const $PT_POINTER = 0x00000001 Global Const $PT_TOUCH = 0x00000002 Global Const $PT_PEN = 0x00000003 Global Const $PT_MOUSE = 0x00000004 Global Const $PT_TOUCHPAD = 0x00000005 Global Const $TOUCH_MASK_NONE = 0x00000000 Global Const $TOUCH_MASK_CONTACTAREA = 0x00000001 Global Const $TOUCH_MASK_ORIENTATION = 0x00000002 Global Const $TOUCH_MASK_PRESSURE = 0x00000004 Global Const $POINTER_FLAG_NONE = 0x00000000 Global Const $POINTER_FLAG_NEW = 0x00000001 Global Const $POINTER_FLAG_INRANGE = 0x00000002 Global Const $POINTER_FLAG_INCONTACT = 0x00000004 Global Const $POINTER_FLAG_FIRSTBUTTON = 0x00000010 Global Const $POINTER_FLAG_SECONDBUTTON = 0x00000020 Global Const $POINTER_FLAG_THIRDBUTTON = 0x00000040 Global Const $POINTER_FLAG_FOURTHBUTTON = 0x00000080 Global Const $POINTER_FLAG_FIFTHBUTTON = 0x00000100 Global Const $POINTER_FLAG_PRIMARY = 0x00002000 Global Const $POINTER_FLAG_CONFIDENCE = 0x00004000 Global Const $POINTER_FLAG_CANCELED = 0x00008000 Global Const $POINTER_FLAG_DOWN = 0x00010000 Global Const $POINTER_FLAG_UPDATE = 0x00020000 Global Const $POINTER_FLAG_UP = 0x00040000 Global Const $POINTER_FLAG_WHEEL = 0x00080000 Global Const $POINTER_FLAG_HWHEEL = 0x00100000 Global Const $POINTER_FLAG_CAPTURECHANGED = 0x00200000 Tap() Func Tap() DllCall('User32.dll','BOOL','InitializeTouchInjection','int',1,'dword',$TOUCH_FEEDBACK_INDIRECT) If @error Then Return -1 Else Local $tPOINTER_TOUCH_INFO = DllStructCreate($tagPOINTER_TOUCH_INFO) DllStructSetData($tPOINTER_TOUCH_INFO,1,$PT_TOUCH) DllStructSetData($tPOINTER_TOUCH_INFO,2,0) DllStructSetData($tPOINTER_TOUCH_INFO,7,300) DllStructSetData($tPOINTER_TOUCH_INFO,8,300) DllStructSetData($tPOINTER_TOUCH_INFO,21,0x00000000) DllStructSetData($tPOINTER_TOUCH_INFO,22,BitOR($TOUCH_MASK_CONTACTAREA,$TOUCH_MASK_ORIENTATION,$TOUCH_MASK_PRESSURE)) DllStructSetData($tPOINTER_TOUCH_INFO,23,DllStructGetData($tPOINTER_TOUCH_INFO,7)-2) DllStructSetData($tPOINTER_TOUCH_INFO,25,DllStructGetData($tPOINTER_TOUCH_INFO,7)+2) DllStructSetData($tPOINTER_TOUCH_INFO,24,DllStructGetData($tPOINTER_TOUCH_INFO,8)-2) DllStructSetData($tPOINTER_TOUCH_INFO,26,DllStructGetData($tPOINTER_TOUCH_INFO,8)+2) DllStructSetData($tPOINTER_TOUCH_INFO,31,90) DllStructSetData($tPOINTER_TOUCH_INFO,32,1024) DllStructSetData($tPOINTER_TOUCH_INFO,4,BitOR($POINTER_FLAG_DOWN,$POINTER_FLAG_INRANGE,$POINTER_FLAG_INCONTACT)) DllCall('User32.dll','BOOL','InjectTouchInput','int',1,'ptr',DllStructGetPtr($tPOINTER_TOUCH_INFO)) If @error Then Return -2 Else DllStructSetData($tPOINTER_TOUCH_INFO,4,$POINTER_FLAG_UP) DllCall('User32.dll','BOOL','InjectTouchInput','int',1,'ptr',DllStructGetPtr($tPOINTER_TOUCH_INFO)) If @error Then Return -3 Else Return True EndIf EndIf EndIf EndFunc
    1 point
×
×
  • Create New...