Leaderboard
Popular Content
Showing content with the highest reputation on 07/01/2017 in all areas
-
Bouvrie, Welcome to the AutoIt forum. What you want to achieve can certainly be accomplished. But the functions in the .NET Framework is not the proper way to do it. The proper way to do it is to use the Windows API functions. This is the documentation you need: Clipboard documentation, the Shell Data Object and the IDataObject interface. The difficult part of your project seems to be understanding the Microsoft documentation. Once you understand the documentation, implementing the code in AutoIt should be more or less straightforward. The main AutoIt commands you need are the DLLStruct-commands to create the necessary data structures, the DllCall function to implement the Windows API functions and ObjCreateInterface for the interfaces. A note about the documentation of ObjCreateInterface in the help file. In top of the help file there is a big warning about the function. This warning seems to be wrong from first to last. The function is not experimental, it does work, it contains no bugs, and it's not going to be changed or removed. The function was introduced in AutoIt 3.8.0 more than five years ago. There are hundreds of examples that shows that the function works. There are no examples that documents that it does not work or contains bugs. And it's the fundamental function in some of the most interesting examples and projects in recent years eg. the UI Automation Framework, Accessing AutoIt Variables (I'm not modest) and the .NET Framework. I find it very hard to believe that such a valuable function should be removed. I think you can be pretty relaxed about this warning.3 points
-
Automate all windows and browser applications with one UDF function library. Based on the microsoft automation API this library high level supports Recognition of conttrols from EDGE, Chrome, FF, Opera, Safari and Windows native apps Small testing framework to split object repository from coding away Introduction Quickstart - Getting started quickly Simple scripts With this module you can automate all applications/programs that support ui automation and/or accesibility api from microsoft you can recognize more controls than AutoIT can recognize "out of the box" you can use concepts from other testing frameworks like http://download.freedesktop.org/ldtp/doc/ldtp-tutorial.pdf http://safsdev.sourceforge.net/Default.htm coded ui testing from microsoft Some of those controls / applications are chrome browser (partly mainwindow has to be done with MSAA for navigating) chrome://accessibility in the adress bar of chrome or start with "--force-renderer-accessibility" silverlight controls Ribbon control controlbars of Excel/Word IE and FF browsers Windows Media Player Windows clock AFX .. controls (partly) .... Based on the initial AIO Object I now have made the interface file to work with objCreateInterface function which is in the latest beta's automate clicking and querying basic information It gives you a lot of basic information to be able to automate clicking, querying basic information where it goes further in certain situations than AutoIt is identifying Starting threads for background on the ui automation api of microsoft (not for starters) http://en.wikipedia.org/wiki/Microsoft_UI_Automation http://msdn.microsoft.com/en-us/library/ms747327.aspx Previous threads in general help/support Interface AutoItObject IUIAutomation ObjCreateInterface and struct tagPoint in method ElementFromPoint Be aware that API is not allways installed under XP/Vista see http://support.microsoft.com/kb/971513 Within Windows 7 and Windows 8 it should be preinstalled by default. Be aware on 32 and 64 bits way of running your script #AutoIt3Wrapper_UseX64=Y or N Basic example of usage / showing and retrieving the default information, will post multiple examples later Hover your mouse to an area of interest and press ctrl+w and information will be shown in the edit box of the form Simple spy demo (see simplespy.au3 or use latest ZIP attachment for latest version) Main features Recognize windows and html controls for the major browsers Logical and physical description for controls (UI mapping, Application map) Simple repository logic to abstract logical and physical descriptions Store Runtime Type Information in RTI. variables Rubberbanding/highlighting of objects Simple spy to help in making / identifying the physical description Support of regular expression(s) in identifying objects recognize objects on multiple properties supported properties: name ,title, automationid, classname, class, iaccessiblevalue, iaccessiblechildId, controltype, processid, acceleratorkey The actions provided so far "leftclick", "left", "click", "leftdoubleclick", "leftdouble", "doubleclick", _ "rightclick", "right", "rightdoubleclick", "rightdouble", _ "middleclick", "middle", "middledoubleclick", "middledouble", "mousemove", "movemouse" "setvalue","settextvalue" "setvalue using keys" "setValue using clipboard" "getvalue" "sendkeys", "enterstring", "type", "typetext" "invoke" "focus", "setfocus", "activate" "close" "move","setposition" "resize" "minimize", "maximize", "normal", "close", "exist", "exists" "searchcontext", "context" "highlight" "getobject","object" "attach" "capture","screenshot", "takescreenshot" "dump", "dumpthemall" "propertyvalue", "property" match on multiple properties like: name:=((Zoeken.*)|(Find.*)); ControlType:=Button; acceleratorkey:=Ctrl+F Support for 117 different properties see $UIA_propertiesSupportedArray in uiawrappers like for example title, regexptitle, class, regexpclass, iaccessiblevalue, iaccessiblechildid, name, accesskey, automationid, classname IAccessible, IAccessible2, ISimpleDom interfaces debuglogging to a file log.txt (no output in scitewindow) Examples Example 1 Iterating thru the different ways of representing the objects in the tree (#comment-1105548) Example 2 Finding the taskbar and clicking on the start menu button (#comment-1105680) Example 3 Clicking a litlle more and in the end displaying all items from the clock (thats not directly possible with AU3Info) (#comment-1108849) Example 4 that demonstrates the calculator Example 5 Automating chrome Example 6 Demonstrates all stuff within chrome to navigate html pages, find hyperlink, click hyperlink, find picture, click picture, enter data in inputbox Example 7 The chrome example modified to a firefox example Example 8 The other major browser Internet Explorer automated (made on Example 6 and 7) Example 9 Windows media player Example 10 Automating mach 3 (AFX windows and other hard to get recognized by AutoIT) Lot of links are broken due to forum upgrade just search for the text like "Example 11 Demonstrate Word, Notepad and Calculator actions" Example 11 Demonstrate Word, Notepad and Calculator actions ... Example 13 Details 1 about the right pane of the windows explorer Example 14 Details 2 about the right pane of the windows explorer Example 15 Details 3 about the right pane of the windows explorer Example 16 Details 4 about the right pane of the windows explorer Example 17 Details 5 about the right pane of the windows explorer WITH CACHING Example 18 Details 6 about the right pane of the windows explorer WITH VIRTUAL ITEMS Example 19 Eventhandling examples Example 20 Eventhandling examples Example 21a Eventhandling examples Internet Explorer Example 21b Eventhandling examples Internet Explorer Example 22 Eventhandling examples Follow focus Example 23 Eventhandling examples structure changed Example 24 Eventhandling examples IUIAutomationEventHandler Example 25 SAFEARRAYS Example 26 IACCESSIBLE / MSAA Example 27 IACCESSIBLE2 / MSAA Example 28 IACCESSIBLE / MSAA events Example 29 IACCESSIBLE2 events Example 30 ISimpleDOM Example 31 Notepad window move, maximize, minimize Example 32 Three browsers doing the same stuff with small differences in scripting only .. TODO Build recorder Enhance the spy with a nicer UI UI for the repository (now in the script with dot notation) Enhance mapping / identifying on multiple properties instead of 1 combined with index If speed becomes an issue use the caching logic of the MS UIA framework Add the other patterns later Generalize the concept of System Under Test of starting the SUT (for testing framework purposes) Remote running of scripts Fix issue on finding within dynamic context ... edit august 18th 2013 initial post Only zip files are needed to download , just unzip in 1 directory edit july 2016 Made V0_63 and examples works with AutoIt v3.3.14 Windows 10 tested Simple spy gives some basic code as a present Chrome latest versions seems to be having issues with IUIAutomation on tabs/buttons of mainwindow use MSAA for accessing tabsheets / buttons more cleanup to be in UDF style More comments in the source see changelog.txt for previous changes edit september 2017 All examples fixed for the IE, Firefox and Chrome browser Some small but essential fixes in UIAWrappers edit april 2018 Enhanced logic on fallback / dynamic search, still not perfect, to slow Retested with latest Chrome, FF, Edge and IE11 and some extensions to show how to get text from the webpage (examples 5,6,7) Some small bugfixes Some comments as given in forum incorporated edit may 2019 Speed enhancements on especially fallback searching UIA.CFG works now in a better way to turn on/off debug, highlighting, debug2file More stable and consistent behavior Internal cleanup and refactoring of bigger functions Checked with W10 (not tested on W7) Added some W10 properties Run with 3.3.14.5 on W10 UIA_V0_51.zip EXAMPLES_V0_5.zip UIA_V0_63.zip EXAMPLES_V0_63.zip UIA_V0_64.zip EXAMPLES_V0_64.zip EXAMPLES_V0_66.zip UIA_V0_66.zip EXAMPLES_V0_70.zip UIA_V0_70.zip1 point
-
Here an example for the 1st slider: ;coded by rover / Yashied / UEZ build 2017-06-28 #include <GDIPlus.au3> #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> #include <SliderConstants.au3> #include <StructureConstants.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> Global Const $tagNMCUSTOMDRAW = $tagNMHDR & ';dword DrawStage;handle hDC;long Rect[4];dword_ptr ItemSpec;uint ItemState;lparam ItemlParam' Global $hSlider, $hHBitmap, $hHBitmap2, $bmWidth = 8, $bmHeight = 25, $iWidth = 360, $iHeight = 15, $iXPos = 40 Example() Func Example() _GDIPlus_Startup() Local Const $hBitmap = _GDIPlus_BitmapCreateFromScan0($iWidth, $iHeight), $hGfx = _GDIPlus_ImageGetGraphicsContext($hBitmap), $hPen = _GDIPlus_PenCreate() _GDIPlus_GraphicsSetPixelOffsetMode($hGfx, 4) Local $h, $RGB For $h = 0 To $iWidth $RGB = HSLToRGB($h / 360, 1, 0.5) _GDIPlus_PenSetColor($hPen, 0xFF000000 + $RGB) _GDIPlus_GraphicsDrawLine($hGfx, $h, 0, $h, $iHeight, $hPen) Next $hHBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap) _GDIPlus_GraphicsDispose($hGfx) Local Const $hBitmap2 = _GDIPlus_BitmapCreateFromScan0($bmWidth, $bmHeight), $hGfx2 = _GDIPlus_ImageGetGraphicsContext($hBitmap), $hBrush = _GDIPlus_BrushCreateSolid() _GDIPlus_GraphicsFillRect($hGfx2, 0, 0, $bmWidth, $bmHeight, $hBrush) $hHBitmap2 = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap2,0xFF404040) ;slider thumb color _GDIPlus_PenDispose($hPen) _GDIPlus_BrushDispose($hBrush) _GDIPlus_GraphicsDispose($hGfx) _GDIPlus_GraphicsDispose($hGfx2) _GDIPlus_ImageDispose($hBitmap2) _GDIPlus_ImageDispose($hBitmap) _GDIPlus_Shutdown() GUICreate("HSL Slider", 450, 100) GUISetBkColor(0xFFFFFF) GUICtrlCreateLabel("HSL: ", 15, 18, 25, 20) Local $idSlider = GUICtrlCreateSlider($iXPos, 10, $iWidth + 30, 25, BitOR($TBS_NOTICKS, $TBS_FIXEDLENGTH, $WS_TABSTOP)) GUICtrlSetLimit(-1, 359, 0) ; change max/min value $hSlider = GUICtrlGetHandle($idSlider) GUICtrlSetCursor(-1, 0) GUICtrlSetBkColor(-1, 0xFFFFFF) _SendMessage($hSlider, $TBM_SETTHUMBLENGTH, 2 * $bmHeight - 1, 0) Local $idButton = GUICtrlCreateButton("RGB Value", 75, 70, 70, 20) GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") GUISetState(@SW_SHOW) GUICtrlSetData($idSlider, 0) ; set cursor ; Loop until the user exits. Do Switch GUIGetMsg() Case $GUI_EVENT_CLOSE GUIDelete() _WinAPI_DeleteObject($hHBitmap) _WinAPI_DeleteObject($hHBitmap2) Exit Case $idButton MsgBox($MB_SYSTEMMODAL, "Slider", "RGB color in hex format: " & Hex(HSLToRGB(GUICtrlRead($idSlider) / 360, 1, 0.5), 6), 10) EndSwitch Until False EndFunc ;==>Example Func HSLToRGB($h, $s, $l) If Not $s Then Return BitShift(0xFF * $l, -16) + BitShift(0xFF * $l, -8) + BitShift(0xFF * $l, 0) Local Const $q = $l < 0.5 ? $l * (1 + $s) : $l + $s - $l * $s Local Const $p = 2 * $l - $q Return BitShift(0xFF * HUEtoRGB($p, $q, $h - 0.33333333), -16) + BitShift(0xFF * HUEtoRGB($p, $q, $h), -8) + BitShift(0xFF * HUEtoRGB($p, $q, $h + 0.33333333), 0) EndFunc Func HUEtoRGB($p, $q, $t) If($t < 0) Then $t += 1 If($t > 1) Then $t -= 1 If($t < 0.16666666) Then Return $p + ($q - $p) * 6 * $t If($t < 0.5) Then Return $q If($t < 0.66666666) Then Return $p + ($q - $p) * (0.66666666 - $t) * 6 Return $p EndFunc Func WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam, $lParam Local $tNMHDR = DllStructCreate($tagNMHDR, $lParam) Local $hWndFrom = DllStructGetData($tNMHDR, 'hWndFrom') Local $Code = DllStructGetData($tNMHDR, 'Code') Local $IDFrom = DllStructGetData($tNMHDR, 'IDFrom') Switch $hWndFrom Case $hSlider Switch $Code Case $NM_CUSTOMDRAW Local $tNMCD = DllStructCreate($tagNMCUSTOMDRAW, $lParam) Local $DrawStage = DllStructGetData($tNMCD, 'DrawStage') Local $ItemSpec = DllStructGetData($tNMCD, 'ItemSpec') Local $hDC, $hMemDC, $hPrev Switch $DrawStage Case $CDDS_PREPAINT DllStructSetData($tNMCD, 'ItemState', BitXOR(DllStructGetData($tNMCD, 'ItemState'), $CDIS_FOCUS)) ; Remove focus Rectangle Return $CDRF_NOTIFYITEMDRAW Case $CDDS_ITEMPREPAINT Local $nLeft = DllStructGetData($tNMCD, 'Rect', 1) Local $nTop = DllStructGetData($tNMCD, 'Rect', 2) Local $nRight = DllStructGetData($tNMCD, 'Rect', 3) Local $nBottom = DllStructGetData($tNMCD, 'Rect', 4) Local $nWidth = $nRight - $nLeft Local $nHeight = $nBottom - $nTop $hDC = DllStructGetData($tNMCD, 'hDC') Switch $ItemSpec Case $TBCD_TICS Return $CDRF_SKIPDEFAULT ; draw custom ticks from bitmap or remove tics ;Return $CDRF_DODEFAULT ; draw tics from current theme Case $TBCD_CHANNEL $hMemDC = _WinAPI_CreateCompatibleDC($hDC) $hPrev = _WinAPI_SelectObject($hMemDC, $hHBitmap) _WinAPI_BitBlt($hDC, $nLeft + 10, $nTop - 16, $iWidth - 20, $iHeight, $hMemDC, 0, 0, $MERGECOPY) _WinAPI_SelectObject($hMemDC, $hPrev) _WinAPI_DeleteDC($hMemDC) Return $CDRF_SKIPDEFAULT ;custom draw channel with bitmap or remove channel ;Return $CDRF_DODEFAULT ;draw channel from current theme Case $TBCD_THUMB If ($nWidth - $bmWidth) > 0 Then $nLeft += (($nWidth - $bmWidth) / 2) $nWidth = $bmWidth EndIf If ($nHeight - $bmHeight) > 0 Then $nTop += ($nHeight - $bmHeight) / 2 $nHeight = $bmHeight EndIf $hMemDC = _WinAPI_CreateCompatibleDC($hDC) $hPrev = _WinAPI_SelectObject($hMemDC, $hHBitmap2) _WinAPI_BitBlt($hDC, $nLeft, $nTop - 10, $nWidth, $nHeight, $hMemDC, 0, 0, $SRCCOPY) _WinAPI_SelectObject($hMemDC, $hPrev) _WinAPI_DeleteDC($hMemDC) Return $CDRF_SKIPDEFAULT ;custom draw thumb with bitmap EndSwitch EndSwitch EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY You have to do some adjustments in WM_NOTIFY function when you modify the slider settings!1 point
-
Oh crap. It was a very long day... (Wednesday was like 5am-11:30pm, freaking long allright...) and I still hadn't caught up on sleep Will update Updated1 point
-
BASS Function Library (Sound and Music Functions)
Xandy reacted to eukalyptus for a topic
lol Not remove _BASS_ChannelSetFX and _BASS_ChannelRemoveFX but replace with the new ones: Func _BASS_ChannelSetFX($bass_dll, $handle, $type, $priority) $BASS_ret_ = DllCall($bass_dll, "dword", "BASS_ChannelSetFX", "DWORD", $handle, "DWORD", Eval($type & "_Value"), "int", $priority) $error = _BASS_ErrorGetCode($bass_dll) If $error <> 0 Then Return SetError($error, "", 0) Else Assign("BASS_FX_" & $BASS_ret_[0], Eval(StringReplace($type, "_FX", "")), 2) Return SetError(0, "", $BASS_ret_[0]) EndIf EndFunc ;==>_BASS_ChannelSetFX Func _BASS_ChannelRemoveFX($bass_dll, $handle, $fx) $BASS_ret_ = DllCall($bass_dll, "int", "BASS_ChannelRemoveFX", "DWORD", $handle, "DWORD", $fx) $error = _BASS_ErrorGetCode($bass_dll) If $error <> 0 Then Return SetError($error, "", 0) Else Return SetError(0, "", $BASS_ret_[0]) EndIf EndFunc ;==>_BASS_ChannelRemoveFX1 point