Jump to content

Autoit script for thick client


 Share

Recommended Posts

I have requirement like When ever user clicks on specific region (like DEV,UAT,UAT2,Live) based on that value it should double click on respective icon visble on left of attached image or select that value and right click to select icon. I tried few methods but not functioning properly. Could please anyone help on that. I am new to scripting and doest have knowledge.

Note: TAB key doesnt work on client and once cursor is moved "Session " then we can use down arrow key or if any other method is there please suggest.

Below is code i used

<<

#include <IE.au3>
#include <AutoItConstants.au3>
#include <GuiTreeView.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Global $CLIENT_EXECUTABLE                                  = "E:\Program Files (x86)\Sapiens\eMerge Client Tools\bin\SapFrame.exe " ; CHANGE_ME - change if installed in different path
Global Const $DISPATCHER_NAME                                    = "SQL Developer"
Global $TargetUsername = "CYACPM1"
Global $TargetPassword = "BNT67H6"
;Global $TargetAddress = "yyzpbs5001"
;Global $TargetPort = "8080"
Global $TargetApplication
Global $ApplicationName = "UAT2"
;Global $TargetDatabase = "IGW01T"
Global $ConnectionClientPID = 0
Global $sleep = 100

Sleep(3000)

      ; Run exe and activate
      ;Local $ConnectionClientPID = Run($CLIENT_EXECUTABLE, "", @SW_MAXIMIZE)

      $CLIENT_EXECUTABLE =  $CLIENT_EXECUTABLE & $TargetApplication
      Local $ConnectionClientPID = Run($CLIENT_EXECUTABLE, "")
      if ($ConnectionClientPID == 0) Then
         Error(StringFormat("Failed to execute process [%s]", $CLIENT_EXECUTABLE, @error))
      EndIf

; chANGES
Global $hWnd = ControlGetHandle("[CLASS:SAPIENSSapFrameWindow;TITLE:Sapiens eMerge Development Workbench]", "", "[CLASS:SysTreeView32; INSTANCE:1]")
ControlGetHandle (
$searchText = "UAT2"
$hItemFound = _GUICtrlTreeView_FindItem($hWnd, $searchText, True)
While $hItemFound
   _GUICtrlTreeView_SelectItem($hWnd, $hItemFound)

;~   If StringInStr(_GUICtrlTreeView_GetText($hWnd, $hItemFound), "UAT2") Then
;~      _GUICtrlTreeView_ClickItem ($hWnd, $hItemFound, "left", False, 2)
;~      EndIf
   $next = _GUICtrlTreeView_GetNextVisible($hWnd, $hItemFound)
   $hItemFound = _GUICtrlTreeView_FindItem($hWnd, $searchText, True, $next)
   Sleep(5000)
WEnd

;old changes
;   Local $hWnd
  ;$hWnd = WinActivate ( "SAPIENSSapFrameWindow")
;  sleep (5000)
;  $hWnd = WinActivate ("SysTreeView32", "Sessions")
  ;MouseMove (0, 50)
;  ToolTip ("Session Selected")


;BlockInput($BI_DISABLE)
;MouseClickDrag ( "$MOUSE_CLICK_LEFT", 232, 58, 0, 50 )
;   MouseClick ($MOUSE_CLICK_LEFT )
;Sleep (2000)
;ToolTip ("Got Text")

;~  ; If $ApplicationName = "UAT2" Then
;~   ;Sleep(1000)
;~    send("{DOWN}")
;~    send("{DOWN}")
;~    send("{DOWN}")
;~    send("{DOWN}")
;~    send("{DOWN}")
;~    send("{DOWN}")
;~    sleep(1000)
;~    MouseClick ("$MOUSE_CLICK_RIGHT")
;~    Sleep(1000)
;~   ; send("{DOWN}")
;~    send("{DOWN}")
;~    send("{DOWN}")
;~    send ("{ENTER}")
;~    ToolTip ("Clicked")
;~    Sleep(5000)
;~    $hWnd = WinActivate( "Logon")
;~    Tooltip ("logona activated")

;~    Send ($TargetUSername)
;~    Send ("{TAB}")
;~    Send ($Targetpassword)
;~    Send ("{TAB}")
;~    Send ("{TAB}")
;~    send ("{ENTER}")

>>

Summary

>>> Control <<<<
Class:    SysTreeView32
Instance:    1
ClassnameNN:    SysTreeView321
Name:    
Advanced (Class):    [CLASS:SysTreeView32; INSTANCE:1]
ID:    200
Text:    
Position:    0, 50
Size:    218, 734
ControlClick Coords:    170, 341
Style:    0x50810017
ExStyle:    0x00000000
Handle:    0x00000000000302A2

>>>> Mouse <<<<
Position:    170, 414
Cursor ID:    0
Color:    0xFFFFFF

>>>> StatusBar <<<<
1:    Ready
2:    
3:    
4:    
5:    OVR

>>>> ToolsBar <<<<

>>>> Visible Text <<<<
Start Page
xtpBarTop
Menu Bar
xtpBarBottom
xtpBarLeft
xtpBarRight
Ready
Splitter


>>>> Hidden Text <<<<
 

Thickclient.png

Edited by Jos
added CODEBOX <>
Link to comment
Share on other sites

I have requirement like When ever user clicks on specific region (like DEV,UAT,UAT2,Live) based on that value it should double click on respective icon visble on left of attached image or select that value and right click to select icon. I tried few methods but not functioning properly. Could please anyone help on that. I am new to scripting and doest have knowledge.

-snip- duplicate post in Dev

 

Edited by Jos
Merged the cross post from Dev... please don't cross post!
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...