Jump to content

All Activity

This stream auto-updates     

  1. Past hour
  2. Use an icon tool (I use IcoFx 1.6 this version is free) and create multiple .ico files, then follow the link below which shows you how to add the icons to your compiled exe and then display them in the system tray: https://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/adding-extra-icons-to-the-program-resources.html
  3. When I run my program below for some reason when the ClickDepartmentButton is called, it causes COM errors and the program to freeze and basically fails... But when I run the ClickDepartmentButton function by itself without running the rest of the code, it works perfectly everytime. Is there something I am doing wrong? Or do I need to perhaps 'reset' the UIA engine or something? I have no clue why it doesn't work when I run it as part of the whole program, but on it's own, it works fine. I even tried to insert a 10second pause to make sure the program was REALLY fully loaded, and it still failed. Local $omega1 = _UIA_getFirstObjectOfElement($UIA_oDesktop, $program, $treescope_children) Local $SDLI = _UIA_getFirstObjectOfElement($omega1, "Analytical", $treescope_subtree) _UIA_action($SDLI, "click") Local $omega2 = _UIA_getFirstObjectOfElement($UIA_oDesktop, $program, $treescope_children) Local $SDLI = _UIA_getFirstObjectOfElement($omega2, "Sample Due", $treescope_subtree) Dim $t $t = StringSplit(_UIA_getPropertyValue($SDLI, $UIA_BoundingRectanglePropertyId), ";") MouseMove($t[1] + ($t[3] / 20), $t[2] + $t[4] / 2) $hTimerDebug = TimerInit() ; Begin the timer and store the handle in a variable. MouseClick("left") AutoItSetOption("MouseCoordMode", 0) WinWait(" - [frmMC_SampleDue]") ClickRefreshButton() ;Click the refresh button - This will cause the program (msaccess) to poll server for data - the program will freeze, this is normal behavior for that software so WaitForHungAndUnhung WinWaitForProgramToStartResondingAgain() WinActivate(" - [frmMC_SampleDue]") ; No effect - Click Department Button still causes freezing/COM errors. ClickDepartmentButton() Func ClickRefreshButton() _UIA_setVar("oP1", "Title:= - [frmMC_SampleDue];controltype:=UIA_WindowControlTypeId;class:=OMain") ;McCampbell Omega_Me - [frmMC_SampleDue] _UIA_setVar("oP2", "Title:=Workspace;controltype:=UIA_PaneControlTypeId;class:=MDIClient") ;Workspace _UIA_setVar("oP3", "Title:=frmMC_SampleDue;controltype:=UIA_WindowControlTypeId;class:=OForm") ;frmMC_SampleDue _UIA_setVar("oUIElement", "Title:=Get Data;controltype:=UIA_ButtonControlTypeId;class:=") ;ControlType:=UIA_ButtonControlTypeId;classname:=") _UIA_Action("oP1", "setfocus") _UIA_Action("oP2", "setfocus") _UIA_Action("oP3", "setfocus") _UIA_action("oUIElement", "click") EndFunc ;==>ClickRefreshButton Func WinWaitForProgramToStartResondingAgain() ;Move a window around, and track how long it takes for it to actually move. $c = 0 Do $hTimerDebug = TimerInit() Local $aPos = WinGetPos(" - [frmMC_SampleDue]") WinMove(" - [frmMC_SampleDue]", "", $aPos[0] + 10, $aPos[1] + 10, $aPos[2] - 20, $aPos[3] - 20) WinMove(" - [frmMC_SampleDue]", "", $aPos[0], $aPos[1], $aPos[2], $aPos[3]) Local $r = WinGetState(" - [frmMC_SampleDue]") Local $fDiff = TimerDiff($hTimerDebug) If $fDiff < 1000 Then $c = 1 ConsoleWrite("Time it took for winmove was: " & $fDiff & @CRLF) Until $c = 1 EndFunc ;==>WinWaitForHungAndUnhung Func ClickDepartmentButton() _UIA_setVar("oP1", "Title:= - [frmMC_SampleDue];controltype:=UIA_WindowControlTypeId;class:=OMain") ; - [frmMC_SampleDue] _UIA_setVar("oP2", "Title:=Workspace;controltype:=UIA_PaneControlTypeId;class:=MDIClient") ;Workspace _UIA_setVar("oP3", "Title:=frmMC_SampleDue;controltype:=UIA_WindowControlTypeId;class:=OForm") ;frmMC_SampleDue _UIA_setVar("oUIElement", "Title:=Dept:;controltype:=UIA_TextControlTypeId;class:=") ;ControlType:=UIA_TextControlTypeId;classname:=") _UIA_Action("oP1", "setfocus") _UIA_Action("oP2", "setfocus") _UIA_Action("oP3", "setfocus") _UIA_action("oUIElement", "click") EndFunc ;==>ClickDepartmentButton ERROR from my ComErrorHandler: SampleDueLoaderv2.1.au3 (1128) : ==> Global COM error handler - COM Error intercepted ! err.number is: 0x00000003 err.windescription: NULL Pointer assignment err.description is: err.source is: err.helpfile is: err.helpcontext is: err.lastdllerror is: 0 err.scriptline is: 1128 err.retcode is: 0x00000000
  4. Today
  5. So, why do you think it will work then as it is simply one single image? YOu obviously need to have a properly formatted file for this to work as there is no miracle parameter available. Jos
  6. bunch of icons combined into 1 image, extracted from batmeter.dll
  7. Is this an proper ICO file or just a bunch of icons combined into one image? Jos
  8. Tried to ask for help here . Since obviously this dont work and i dont know what else to try i dont see what were other options: TraySetState($TRAY_ICONSTATE_SHOW) For $i = 1 to 100 Sleep(500) TraySetIcon(@ScriptDir & "\Bitmap351.bmp", $i) Next
  9. Ok, so what have you tried that isn't working? Jos
  10. @Letraindusoir I don't have any plans to create such a tool. Besides, you should really get accustomed to using the browser's built-in dev tools. 😛
  11. i mean to get icon handle or something that can be used with TraySetIcon
  12. ...there is access and permissions. Look at permissions. Other than that, I'm out of clues. 😕
  13. Define "Get". Do you mean to display them in a GUI? Jos
  14. @FrancescoDiMuro Doesn't seem to be related to UAC as it worked fine before, disabling it didn't work @argumentum Same result with both tests: C:\Program Files (x86)\AutoIt3>AutoIt3 "\\VBOXSVR\Win10JailBox\Test.au3" C:\Program Files (x86)\AutoIt3>echo %ERRORLEVEL% 0 C:\Program Files (x86)\AutoIt3>AutoIt3 W:\Test.au3 C:\Program Files (x86)\AutoIt3>echo %ERRORLEVEL% 0
  15. Renderer, Take a look at this thread - it might be just what you need. M23
  16. Bitmap351.bmp What function can be used to get icons from this bmp file?
  17. I just want to edit taskbar context menu which is in explorer.exe.mui (menu 205) to remove some context menu entries, i am not aware of any other way to remove them beside editing explorer.exe.mui. But cant edit explorer.exe.mui inside of installed language packs because they are in WindowsApps folder
  18. Hi, I'm starting with GDIPlus functions and I've got problem (of course 😑 ). Here is the code : #include <GDIPlus.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <WinAPISysWin.au3> #include <WinAPIGdi.au3> Opt("GUIOnEventMode", 1) Local $hGUI, $hGraphics, $hBackbuffer, $hBitmap Local Const $iX = Int(@DesktopWidth * 0.5), $iY = Int(@DesktopHeight * 0.5) ; Initialize GDI+ _GDIPlus_Startup() Local $GUI_title = "GDI+" $hGUI = GUICreate($GUI_title, $iX, $iY, -1, -1, BitOR($GUI_SS_DEFAULT_GUI,$WS_THICKFRAME,$WS_TABSTOP)) GUISetState() Local $Child_Gui1 = GUICreate("Child1", 200, 200, 50, 50) GUISetBkColor(0x99B4D1) GUISetState() _WinAPI_SetParent($Child_Gui1, $hGUI) Local $Child_Gui2 = GUICreate("Child2", 200, 200, 300, 300) GUISetBkColor(0x99B4D1) GUISetState() _WinAPI_SetParent($Child_Gui2, $hGUI) $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGUI) $hBitmap = _GDIPlus_BitmapCreateFromGraphics($iX, $iY, $hGraphics) $hBackbuffer = _GDIPlus_ImageGetGraphicsContext($hBitmap) ; Using antialiasing _GDIPlus_GraphicsSetSmoothingMode($hBackbuffer, 2) Local $hPen = _GDIPlus_PenCreate(0xFF000000, 2) GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") GUIRegisterMsg(0x0216, "WM_MOVING") While 1 Sleep(20) WEnd Func WM_MOVING($hWnd, $Msg, $wParam, $lParam) Local $trect ;~ typedef struct _RECT { ;~ LONG left; ;~ LONG top; ;~ LONG right; ;~ LONG bottom; ;~ } RECT, *PRECT; If $hWnd = $Child_Gui2 Then $winposChild1 = WinGetPos($Child_Gui1) ; absolute coord ; coord conversion absolute to relative for child1 $tPoint_parent = DllStructCreate("int X;int Y") DllStructSetData($tPoint_parent, "X", $winposChild1[0]) DllStructSetData($tPoint_parent, "Y", $winposChild1[1]) _WinAPI_ScreenToClient($hGUI, $tPoint_parent) $X_relative_child1 = DllStructGetData($tPoint_parent, "X") $Y_relative_child1 = DllStructGetData($tPoint_parent, "Y") $trect = DllStructCreate("struct;long left;long top;long right;long bottom;endstruct" ,$lParam) ; absolute ; coord conversion absolute to relative for child2 $tPoint_parent = DllStructCreate("int X;int Y") DllStructSetData($tPoint_parent, "X", DllStructGetData($trect, "left")) DllStructSetData($tPoint_parent, "Y", DllStructGetData($trect, "top")) _WinAPI_ScreenToClient($hGUI, $tPoint_parent) $X_relative_child2 = DllStructGetData($tPoint_parent, "X") $Y_relative_child2 = DllStructGetData($tPoint_parent, "Y") ; Drawing _GDIPlus_GraphicsClear($hBackbuffer, 0xFFFFFFFF) _GDIPlus_GraphicsDrawLine($hBackbuffer, $X_relative_child2, $Y_relative_child2, $X_relative_child1, $Y_relative_child1, $hPen) ; relative coord _GDIPlus_GraphicsDrawImageRect($hGraphics, $hBitmap, 0, 0, $iX, $iY) _WinAPI_RedrawWindow($hGUI) EndIf Return 0 EndFunc Func _Exit() ; Clean up _GDIPlus_BrushDispose($hPen) _GDIPlus_BitmapDispose($hBitmap) _GDIPlus_GraphicsDispose($hBackbuffer) _GDIPlus_GraphicsDispose($hGraphics) ; Uninitialize GDI+ _GDIPlus_Shutdown() Exit EndFunc Just move the Child2, you should see a line between the 2 childs and this line follow the movement of the child2. The repaint works but it flickers a lot. How can I handle that ? Thanks for your time.
  19. Your code in the above post is actually MSAA code. That's why you through the Select parameter can specify how the selection should take place, eg. with regard to control focus. Well done that you found out. When you perform a selection with pure UI Automation code as in the previous post, it's done as a user would do it manually. Ie. the control gets focus. With UI Automation code you can generally automate tasks that a user can also do manually. It usually does not include setting control styles. But if the control has a window handle then you may be able to set the control style with functions like SetWindowLongPtr and similar functions.
  20. Dear Danp2 , can you do a tool like Au3Info.exe In free time? through WYSIWYG mode,we can automatically get the Xpath and the attributes of the element when place the mouse in the location of the element of the page. It feels a little troublesome and not too convenient to use browser developer tools. Only a master like you can make such a tool.
  21. Thanks Danp2 ! I have solved this problem with the help of _WD_ExecuteScript and javascript.
  22. Hello guys, I've got a small problem. I want to create a selection rectangle within a GUI like in paint. Here's the code I've written, but it doesn't work, unfortunately: #include <misc.au3> global $hWin = GUICreate("Selection rectangle",650,550) GUISetState() while 1 Switch GUIGetMsg() case -3 exitloop endswitch if _IsPressed("1") then $mp = GUIGetCursorInfo($hWin) $dot = GUICtrlCreateGraphic($mp[0],$mp[1],2,2) GUICtrlSetBkColor($dot,0) while _IsPressed("01") $pos = GUIGetCursorInfo($hWin) ControlMove($hWin,"",$dot,$pos[0],$pos[1],$pos[2],$pos[3]) WEnd EndIf wend Have you got any idea about how to do this correctly? Thanks in advance.
  23. @zoel Take a look at Run, StdoutRead, and GUI* functions in the Help file. Post the script if you need any assistance
  24. Hi Melba23 thanks for your reply, I read the book you recommend, I want to built an app that runs some cmd commands and outputs the result in a GUI.
  25. zoel, Which AutoIt book did you read? I would recommend this one: Other than that, what would you like to do with AutoIt? If you have a specific goal in mind it is much easier to understand the limited number steps you need to do it, rather then facing the entire AutoIt function list and being completely bewildered. Over to you. M23
  1. Load more activity
×
×
  • Create New...