Sign in to follow this  
Followers 0
PaulusdeB2

Newbe can't control window.

6 posts in this topic

Hi,

I'm new to AutoIT. Today I spend a full day trying to built some scripts but I ran into problems controlling windows.

Some windows I can control perfectly (controlclick) and others don't respond to anything (i.e. winclose command and/or controlclick).

I know how to program them with help of the finder tool. Tried everything.

For instance I made a litle script which should uninstall a program called TeamViewer from windows.

Here's my script:

---

$sBase = "HKLMSOFTWAREMicrosoftWindowsCurrentVersionUninstall"
$iEval = 1
$sSearch = "teamviewer"
 
if ProcessExists("teamviewer.exe") Then
    ProcessClose("teamviewer.exe")
EndIf
 
 
While 1
    $sUninst = ""
    $sDisplay = ""
    $sCurrent = RegEnumKey($sBase, $iEval)
    If @Error Then ExitLoop
    $sKey = $sBase & $sCurrent
    $sDisplay = RegRead($sKey, "DisplayName")
 
    If StringRegExp($sDisplay, "(?i).*" & $sSearch & ".*") Then
        $sUninst = RegRead($sKey, "UninstallString")
        If $sUninst Then
            Runwait($sUninst)
        EndIf
    EndIf
    $iEval += 1
WEnd
 
; The above programlines were taken from a samplefile I found on internet. This works fine!
 
 
controlclick("TeamViewer 9 Uninstall", "&Uninstall", 1); This line gives no response on the activated window...
---
 
When I try different windows of different programmes my programming works fine. I use the Finder Tool to get the data from the window and copy/past the data into the script. I'm using Windows 8.1 on a Intel i7 notebook.
 
Could it be some sort of timing issue ?
 
Thanks in advance!
 
Paul
 

Share this post


Link to post
Share on other sites



How do I activate admin mode ?

Where to begin ?

Thanks.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

How do I activate admin mode ?

Where to begin ?

Thanks.

Sorry, I solved my problems....

Turned out a combination of not using #RequireAdmin AND I always  used the control ID number in the controlclick function.

I noticed the control ID number was different every with the problemprograms  so I tried the [CLASS:Button; INSTANCE:2] instead and this worked !!

Thanks a LOT !

Edited by PaulusdeB2

Share this post


Link to post
Share on other sites

try to compile to exe 64bit mode

Share this post


Link to post
Share on other sites

Also - see if your app supports command line. IF it does, you can GREATLY simply your scripts as well as make them MUCH more stable. For example teamviewer supports command line:

http://www.teamviewer.com/en/help/91-Are-there-parameters-to-start-TeamViewer.aspx

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