-
Posts
10 -
Joined
-
Last visited
About r0ash
- Birthday 10/28/1976
Profile Information
-
Location
Karachi, Pakistan
-
WWW
http://blog.teemya.com
Recent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
r0ash's Achievements

Seeker (1/7)
0
Reputation
-
r0ash reacted to a post in a topic: Windows Desktop Applications Automation using AutoIt
-
Windows Desktop Applications Automation using AutoIt
r0ash replied to r0ash's topic in AutoIt Example Scripts
Apart from word touting, you and others who responded are really appreciated. Just for your information there was none *my* way, I learned this approach here on AutoIt forums, implemented at my job, the piece of software runs in production, helped my company grab couple more clients, so I tried to share it with community. Even the write-up clearly says who is my target audience. As I said earlier, I've never claimed that its a definitive guide, so I think I've covered myself. However the valuable inputs from experienced members here, helped to make it more clear to those readers who are new to AutoIt that my writeup is just an encouragement to strive for best practices. -
IUIAutomation MS framework automate chrome, FF, IE, ....
r0ash replied to junkew's topic in AutoIt Example Scripts
Skype 8 (on Windows 8.1) use Chrome (Chrome_WidgetWin_1) Some time its able to select the Sign In button and sometime it dont. The following screenshot depicts when it do not select the individual item Not Sign in nor Create Account etc. I suspect Skype is somehow changing the DOM, but still, its visible, manually its possible to click the Sign in button, when it do not highlight the control (and do not display the code), the following code do not work #include "UIAWrappers.au3" AutoItSetOption("MustDeclareVars", 1) Local $oP2=_UIA_getObjectByFindAll($UIA_oDesktop, "Title:=Skype;controltype:=UIA_WindowControlTypeId;class:=Chrome_WidgetWin_1", $treescope_children) _UIA_Action($oP2,"setfocus") Local $oP1=_UIA_getObjectByFindAll($oP2, "Title:=Skype Preview;controltype:=UIA_DocumentControlTypeId;class:=Chrome_RenderWidgetHostHWND", $treescope_children) _UIA_Action($oP1,"setfocus") 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("SigninwithMicrosoft.mainwindow", "title:=Sign in with Microsoft;ControlType:=UIA_ButtonControlTypeId", $treescope_subtree) Local $oUIElement=_UIA_getObjectByFindAll($oP0, "title:=Sign in;ControlType:=UIA_ButtonControlTypeId", $treescope_subtree) ;_UIA_action($oUIElement,"highlight") _UIA_action($oUIElement,"click") Is there any way to find the exact reason and solution? Thanks. Update I realized that whenever I am running simplespy in parallel, it identifies the control, therefore I copied _EventProc() from simplespy.au3 and added into my script, tested couple of times, its working everytime. Trying to understand why Chrome Accessibility has its effect on finding the control. Would still appreciate expert opinion here. -
Windows Desktop Applications Automation using AutoIt
r0ash replied to r0ash's topic in AutoIt Example Scripts
Yeah completely agree, however the intent of write-up was not to come up with definite list of best practices nor we can place everything on a small image. But error-checking is a must, managing code is definitely 1+. Thanks for your critical analysis, really appreciated. -
r0ash reacted to a post in a topic: Windows Desktop Applications Automation using AutoIt
-
r0ash reacted to a post in a topic: Windows Desktop Applications Automation using AutoIt
-
Windows Desktop Applications Automation using AutoIt
r0ash replied to r0ash's topic in AutoIt Example Scripts
The intent of write-up is to highlight key areas (as depicted in first image), I completely agree that I should have referred to Best Practices wiki & specifically mentioned error-checking as one of best practices, thank you for that, will keep that in mind next time. -
Windows Desktop Applications Automation using AutoIt
r0ash replied to r0ash's topic in AutoIt Example Scripts
Hey @qwert Thanks for liking. I've used Inspect tool (https://github.com/blackrosezy/gui-inspect-tool). Though AutoIt Window Info Tool can be used to get Automation ID (or just ID) for majority of controls, but for sub-menus it do not display it. While Inspect tool can show you the Automation ID very easily; -
This write up target developers who want to automate Windows Desktop Applications but either do not know the right tool or want to enhance their skills using AutoIt. Just like with any thing, there is either informed or amateur approach towards solving a problem. Developers who have never written Windows GUI applications will write AutoIt code that will depend too much on interactions with active GUI. While we can get maximum out of AutoIt when we rely less over such interactions. This amateur approach creates real issue when we have to interact with multiple desktop applications within same AutoIt script. One solution to address these issues is to use _WinAPI_PostMessage function, where applicable. We will primarily use this function to interact with menus, otherwise our interactions may occur on wrong window. Intent: Want to automate Notepad; change display font write some text and save file Downloads: AutoIt Full Installation AutoIt Script Editor GUI Inspection Tools: AutoIt Window Info (part of AutoIt Full Installation) Inspect GUI Inspection: In order to control GUI elements we will need the Windows Name, Controls ClassNameNN & Automation Ids of Notepad application. If you dont know how to find them using AutoIt Window Info and Inspect tools, watch this video (enable captions, if you want). Windows GUI Inspection using AutoIt Window Info & Inspect Tools #include "WinAPI.au3" #include "WindowsConstants.au3" ; #INDEX# ======================================================================================================================= ; Title .........: Windows Desktop Applications Automation using AutoIt ; AutoIt Version : 3.3.14.2 ; Description ...: Automate Notepad for changing display font, writing some text and save file ; Author(s) .....: Ahmed Shaikh Memon (ahmedshaikhm) ; =============================================================================================================================== ; #VARIABLES# =================================================================================================================== Local $hWnd, $hWndFont, $hWndSaveAs Global $sFontName = "Arial" Global $sFileName = "tutorial_1" ; #CONSTANTS# =================================================================================================================== Global Const $__IDM_FONT = 33 Global Const $__IDM_SAVE = 3 Global Const $__IDC_FONT_NAME = 1001 ; Open Notepad Run("notepad.exe") Sleep(1000) ; Get Notepad's handle $hWnd = WinGetHandle("[Class:Notepad]") ; ; Display Font Change ; ; Click Format > Font menu _WinAPI_PostMessage($hWnd, $WM_COMMAND, $__IDM_FONT, 0) Sleep(1000) ; Handle Font window $hFontWin = WinGetHandle("Font") Sleep(1000) ; Select display font ControlSend($hFontWin,"", $__IDC_FONT_NAME, $sFontName) Sleep(2000) ; Save display font ControlClick($hFontWin, "", "Button5") Sleep(1000) ; ; Write text in Notepad ; ControlSend($hWnd, "", "Edit1","This is informed approach towards solving a problem") ; ; Save file ; ; Click File > Save menu _WinAPI_PostMessage($hWnd, $WM_COMMAND, $__IDM_SAVE, 0) Sleep(1000) ; Enter file name in the file open dialog box $hWndSaveAs = WinGetHandle("Save As") ControlSend($hWndSaveAs, "", "Edit1", $sFileName) Sleep(1000) ; Press the Save button on Save As prompt ControlClick($hWndSaveAs, "", "Button1") Sleep(1000) The complete blog post can be found at Teemya Blog.
-
IDMs for WM_COMMAND with _WinAPI_PostMessage
r0ash replied to r0ash's topic in AutoIt General Help and Support
Thanks a bunch @junkew I am using Spy++ tool for the first time, I am unable to log messages, watch, do you think I am missing something? Unable to display content. Adobe Flash is required.- 2 replies
-
- winapi
- wm_command
-
(and 2 more)
Tagged with:
-
r0ash reacted to a post in a topic: IDMs for WM_COMMAND with _WinAPI_PostMessage
-
IDMs for WM_COMMAND with _WinAPI_PostMessage
r0ash posted a topic in AutoIt General Help and Support
Hey guys, MattDiesel over Stackoverflow mentioned this beautiful piece of code #include <WindowsConstants.au3> #include <WinAPI.au3> Local $IDM_FONT = 33 Local $hWindow = WinGetHandle("Untitled - Notepad") _WinAPI_PostMessage($hWindow, $WM_COMMAND, $IDM_FONT, 0) Local $hFontWin = WinWait("Font") $select = ControlCommand($hFontWin, "", "ComboBox1", "GetCurrentSelection", "") WinClose($hFontWin) MsgBox(0,"", $select) I realized that _WinAPI_PostMessage can trigger menu click event, even if Notepad is minimized. How do we know what is the decimal value of *any menu item or sub-menu item*? How we know "Format > Font" menu-item is 33 as wParam to _WinAPI_PostMessage()? Have a look at snapshot. Regards.- 2 replies
-
- winapi
- wm_command
-
(and 2 more)
Tagged with:
-
r0ash reacted to a post in a topic: Skype Contacts Backup
-
Thanks a bunch mate @Neutro Thanks a bunch mate My employer have comparatively large list of contacts (5000+) contacts in his list keep adding & blocking, he wants to accept new contacts automatically, thats why. Neat! Thanks a bunch As posted under FAQs; Does this mean, its outdated? or the @Zedna got covered because he said *may*?
-
r0ash reacted to a post in a topic: Skype Contacts Backup
-
r0ash changed their profile photo
-
Hi guys, I am trying to backup Skype contacts when the Skype window is minimized or machine is locked. But ControlSend is not working. However when I run program, when Skype is active & focused, same program works. #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_UseX64=n #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** $pid = Run("skype.exe") $hWnd = WinWait("[CLASS:tSkMainForm]", "", 10) WinSetState($hWnd, "", @SW_SHOW) Sleep( 1000 ) ControlSend($hWnd,"","TConversationsControl1", "!cdb") If I change WinSetState($hWnd, "", @SW_SHOW) to WinSetState($hWnd, "", @SW_MINIMIZE) The file dialog to save contact as file will never appear. Where FAQs says ControlSend() instead of Send() will work even computer is locked. Thanks for your time. P.S: I've tried to find if backing up Skype contacts violate any EULA but do not find anything. Kindly enlighten me if this post is against forum rules in any sense.