Sign in to follow this  
Followers 0
ssubirias3

ControlClick & ControlFocus not working consistently

2 posts in this topic

In one of my first scripts created with AU3Recorder I am able to control PSPad with MouseClicks and Send commands and works perfectly. I've since learned about Control commands and am trying to update this PSPad script. I thought this would be a very easy process, however am running into some road blocks. In a nutshell, this script logs into my FTP account and navigates to the correct folders to update files. Basically the end goal is to replace Sleeps with PixelChecksums and MouseClicks with ControlClicks. All works well until the first file is opened within PSPad which moves the focus from [Class:TListView] to [Class:TPSSynEdit]. So it makes sense that I would need to refocus [Class:TListView] before continuing, but this does not work. Here's the code section giving me a problem:

; ---------------------------------------------------------------------------- 
; waits for area to change after login was successful
; ----------------------------------------------------------------------------
_PixelChk()
ControlClick("PSPad - [New1.txt]", "", "[Class:TListView]", "left", 2, 50, 132)  ;// navigates to 1st folder

_PixelChk()
ControlClick("PSPad - [New1.txt]", "", "[Class:TListView]", "left", 2, 50, 46)  ;// opens 1st file
WinWaitActive("PSPad - [C:\DOCUME~1\Master\LOCALS~1\Temp\PSpad\ftpid\1stFolder\1stFile.ext]", "")
Sleep(5000)

_GetKeyState()  ;; <== gafrost's function http://www.autoitscript.com/forum/index.ph...ost&p=96980 for checking keystates
ControlFocus("PSPad - [New1.txt]", "", "[Class:TListView]")
ControlClick("PSPad - [New1.txt]", "", "[Class:TListView]", "left", 2, 50, 82) ;// open 2nd file 
WinWaitActive("PSPad - [C:\DOCUME~1\Master\LOCALS~1\Temp\PSpad\ftpid\1stFolder\2ndFile.ext]", "")
Sleep(1000)
MsgBox(0,"success", "yes")

Func _PixelChk()
    $checksum = PixelChecksum(15, 190, 70, 210)
    While $checksum = PixelChecksum(15, 190, 70, 210)
        Sleep(500)
    WEnd
    ControlFocus("PSPad - [New1.txt]", "", "[Class:TListView]")
EndFunc   ;==>_PixelChkoÝ÷ Ù8^±Êâ¦ØZ0j+bè¯iÝ~)^¶ÞriËb½ãhµëaÇ(uè¬iû^¬ý½ëÖ¢{k¢Qhrë-¢·¡Ë¬¶¢ºÞr×(Úè©Ýiû^®Ø^
í®B'$«yéìz{m¢^Ø^Úw_WçèZ0x«ÞvÞÂ+a¯j)T±çVuÖ§uh§Y¨­Ëb½æ¬²è zË^v)íáÞâꮢ×Eé®K?m*&yÊ'¶º%³¥·¬Ë'$x.W¬²Ø^ɪ޶rد{§v±ëayh§Ëb½«^~éܶ*'¶è­Ç­ç(ÚèlÂ)Ý£h¶­¢Þ~޺ȧ*'¶º%
Xú®¢×®'v'ßz·§¶ö¥¹ë®¹Ó]4çM"êmªê-IéÝ)ìzV²ªê-çM²Ë ë-¢{aËa­æ¶+eyÕ·i®åzl"¶¨Úè'­Mìmü*'¶º%Iéݺ¹

So I'm not sure what to try next. Hopefully this is something so simple its evading my discovery. For those that don't know, PSPad is free... in case anyone wants to download it try to recreate my problem. Maybe you'll come up with a suggestion I can use. Thanks in advance!

Share this post


Link to post
Share on other sites

#2 ·  Posted (edited)

;) Don't I feel like an :) (idiot)!!

Sometimes its the simplest things that are overlooked. I'm just glad I figured it out before it was pointed out to me by someone else! Watch out for those changing window titles or they'll get you every time! ;) Fixed by changing the code

FROM:

WinWaitActive("PSPad - [C:\DOCUME~1\Master\LOCALS~1\Temp\PSpad\ftpid\1stFolder\1stFile.ext]", "")
Sleep(5000)

_GetKeyState()  ;; <== gafrost's function http://www.autoitscript.com/forum/index.ph...ost&p=96980 for checking keystates
ControlFocus("PSPad - [New1.txt]", "", "[Class:TListView]")
ControlClick("PSPad - [New1.txt]", "", "[Class:TListView]", "left", 2, 50, 82) ;// open 2nd file
Edited by ssubirias3

Share this post


Link to post
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
Sign in to follow this  
Followers 0