Sign in to follow this  
Followers 0
Sani

Double-click and Multitab window

13 posts in this topic

Hello

I am very new in AutoIt so excuse my ignorance. I have atwo questions?

Question 1:

=======

How can I double-click a control Edit?

Example - in window "Display Properties", in tab "Screen Saver", there is a field Wait which has a Control ID 1306:

I run the following script while the window "Display Properties" is open with the current tab "Screen Saver":

WinActivate("Display Properties", "Screen Saver")

WinWait("Display Properties", "Screen Saver")

Sleep (2000)

ControlClick("Display Properties", "Screen Saver", 1306, "Left", 2)

The function ControlClick, just puts cursor at the first position in the field Wait, but does not highlight its existing value - this tells me that double-click was not performed.

Question 2:

=======

How can I switch between tabs in the window "Display Properties" if I do not want to use keyboard stroke Send("^{TAB}")?

Is is possible to change tab only by mouse clicking on some control?

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Will this work??

WinActivate("Display Properties", "Screen Saver")
WinWait("Display Properties", "Screen Saver")
Sleep (2000)
ControlClick("Display Properties", "Screen Saver", 1306, "Left", 1)
ControlClick("Display Properties", "Screen Saver", 1306, "Left", 1)

Autoit is very fast.... so those two click "should" be the same as a "double" click

2

can you use ControlSend( title, text, control ID, "^{TAB}") ; just the idea

8)

Edited by Valuater

NEWHeader1.png

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Hi Valuater

This code does not work for me, it does not send double-click:

ControlClick("Display Properties", "Screen Saver", 1306, "Left", 1)

ControlClick("Display Properties", "Screen Saver", 1306, "Left", 1)

The function ControlSend( title, text, control ID, "^{TAB}") does not work either, it does not specify a window tab.

The window tab does not have Control ID.

Anyway thanks for your reply.

Sani

Edited by Sani

Share this post


Link to post
Share on other sites

ok... i will try to make it work... hold the phone'

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

this worked for me

Local $RUNDLL32 = @SystemDir & "\rundll32.exe"
 Run($RUNDLL32 & " shell32.dll,Control_RunDLL desk.cpl")
 
 While WinActivate("Display Properties", "Screen Saver") <> 1
    ControlSend("Display Properties", "", "SysTabControl321", "{RIGHT}")
    Sleep(200)
WEnd

WinActivate("Display Properties", "Screen Saver")
WinWait("Display Properties", "Screen Saver")
Sleep (1000)
ControlClick("Display Properties", "Screen Saver", 1306, "Left", 2)
ControlSetText("Display Properties", "Screen Saver", 1306, "20")

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

Run("rundll32.exe shell32.dll,Control_RunDLL desk.cpl,,1")

Opens the "Display Properties" dialog with the tab set to "Screen Saver", no navigating to be done.

Credit goes to herewasplato for finding the reference site:

http://vbnet.mvps.org/index.html?code/system/controlpnl3.htm

Display Options (Standard Windows Display Property Page*) 
      
module:  DESK.CPL 
      
command:  rundll32.exe shell32.dll,Control_RunDLL desk.cpl,,0 
result:  displays the Background tab selected 
      
command:  rundll32.exe shell32.dll,Control_RunDLL desk.cpl,,1 
result:  displays the Screen Saver tab selected 
      
command:  rundll32.exe shell32.dll,Control_RunDLL desk.cpl,,2 
result:  displays the Appearance tab selected 
      
command:  rundll32.exe shell32.dll,Control_RunDLL desk.cpl,,3 
result:  displays the Settings tab selected 
      
comments:  Note: Your video adapter may install other property pages into DESK.CPL dynamically when selected with its own icon (i.e an ATI or Matrox control panel icon). Additionally, it also may invoke its own control panel applet mimicking the Windows display options.

[u]My UDFs[/u]Coroutine Multithreading UDF LibraryStringRegExp GuideRandom EncryptorArrayToDisplayString"The Brain, expecting disaster, fails to find the obvious solution." -- neogia

Share this post


Link to post
Share on other sites

i actually knew of that, however Sani wanted to move the tab "after" completing his task on the "Screen Saver" tab

so the controlSend(.. right) was to show navigation

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

Hello Valuater

Problem 1:

The suggested function really does some weard trick, however her result is not very well understood:

ControlSetText("Display Properties", "Screen Saver", 1306, "20")

Check this out - run this code:

===================

Run("notepad.exe")

WinWait("Untitled -")

ControlSetText("Untitled -", "", "Edit1", "New Text was writen to here")

When you try to close the Notepad you ARE NOT asked to save a written text.

The text IS NOT written to the control Edit!!

Now run this code:

============

Run("notepad.exe")

WinWait("Untitled -")

ControlSend("Untitled -", "", "Edit1", "New Text was writen to here")

When you try to close the Notepad you ARE asked to save a written text.

The text IS written to the control Edit!!

By the way I do not understand the fundamental difference between these two functions:

ControlSetText("Untitled -", "", "Edit1", "New Text was writen to here")

ControlSend("Untitled -", "", "Edit1", "New Text was writen to here")

I still do not know how to send mouse double-click.

Problem 2:

Any suggestions how to switch between window tabs, for example from tab "Screen Saver" to tab "Settings"

Edited by Sani

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

I tried the ControlSend() and the input was "2010" ( 10 originally on mine )

When i use the ControlSetText the input is "20"... Thus the SetText "Replaces the text"

I also noticed that with the ControlSetText()

before used, the "Apply" button is NOT Enabled, however after the SetText the "Apply" button is Enabled... thus the change is reconized by the input

if you notice in this script i made it changes to the tab you wanted and I thought you would see that... however i added the tab move again at the bottom of this code

Local $RUNDLL32 = @SystemDir & "\rundll32.exe"
Run($RUNDLL32 & " shell32.dll,Control_RunDLL desk.cpl")

While WinActivate("Display Properties", "Screen Saver") <> 1
    ControlSend("Display Properties", "", "SysTabControl321", "{RIGHT}")
    Sleep(200)
WEnd

WinActivate("Display Properties", "Screen Saver")
WinWait("Display Properties", "Screen Saver")
Sleep (1000)

ControlSetText("Display Properties", "Screen Saver", 1306, "20")

Sleep (1000)

While WinActivate("Display Properties", "Settings") <> 1
    ControlSend("Display Properties", "", "SysTabControl321", "{RIGHT}")
    Sleep(200)
WEnd

with all of the controlling we are doing here, why do you still need to send a "double" mouse click?

8)

Edited by Valuater

NEWHeader1.png

Share this post


Link to post
Share on other sites

Hello Valuater

I really appreciate your replies.

What regards my question on mouse double-click:

================================

Genuine mouse double-click highlights the existing value in the control Edit, then I would be able to use the the function ControlSend("Display Properties", "Screen Saver", "Edit1", "20").

May be AutoIt does not provide any way how to effectively send mouse double-click - which is not that bad, we can always find some way around.

What regards the ControlSentText I am still do not fully understand her effect, see my simple code with Notepad, and so I was reluctant to use it.

Enlighten me, what is the principal difference between:

ControlSetText("sometitle", "", "Edit1", "sometext")

ControlSend("sometitle", "", "Edit1", "sometext")

What regards my question on switching window tabs:

==================================

Your function ControlSend("Display Properties", "", "SysTabControl321", "{RIGHT}") works really well, even on windows which are not active.

Valuater, what other strings can be sent to control SysTabControl??

Share this post


Link to post
Share on other sites

;Check this out - run this code:
;===================
Run("notepad.exe")
WinWait("Untitled -")
Sleep(2000)
ControlSetText("Untitled -", "", "Edit1", "New Text was writen to here")
Sleep(2000)
ControlSetText("Untitled -", "", "Edit1", "New Text was writen to here")

Sleep(5000)
WinClose("Untitled -")

;Now run this code:
;============
Run("notepad.exe")
WinWait("Untitled -")
Sleep(2000)
ControlSend("Untitled -", "", "Edit1", "New Text was writen to here")
Sleep(2000)
ControlSend("Untitled -", "", "Edit1", "New Text was writen to here")

; i did notice that the first notepad with SetText DID NOT ask if i wanted to save

; but this should clarify the difference in ControlSetText and ControlSend

using ControlSend or ControlCommand or any of these type of "control commanders" will work on hidden windows... you need to see help on all of the different "control commanders" there are available

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

Hello Valuater

Yes I run similar test on notepad before. I noticed that the function ControlSetText kind of labels the control and just hides the content of the control.

Because the content is not changed, you do not get a prompt to save changes.

On the other hand, the function ControlSend adds to an existing contents of the control, so you are prompted for saving changes.

AutoIt Help does not provide any detailed information of those functions.

Am I correct?

Share this post


Link to post
Share on other sites

yes.. i believe you are correct

8)


NEWHeader1.png

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