Jump to content
Paxman

Immitate double click No Mouse Movement

Recommended Posts

Paxman

Just seem to have hit a bit of a hurdle.

I am trying to get Autoit to tick a box in a dialogue box. However no windows shortcut works (eg. spacebar etc.).

So having moved to the tick box (how can i produce a double click of the mouse (which ticks the box) without moving the mouse each time. I will need to do this many times in a tall dialogue box you need to scroll through if trying to use the mouse to do it?

Can i map a keyboard shortcut or something?

Thanks

Neil

 

Share this post


Link to post
Share on other sites
careca

what does the au3 window tool says about that checkbox?


Spoiler

Paster - Main function is to paste text, but has more functions. (No longer mantained, switched to String Trigger)

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Firefox Profile Backup - Backup/restore previously saved profile.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Share this post


Link to post
Share on other sites
Paxman

Did not know of this tool but found it.

Clicking the tick box gives me this.

Not sure if it helps.

Thanks

Neil

>>>> Window <<<<
Title:    GridTrader
Class:    #32770
Position:    613, 20
Size:    626, 754
Style:    0x94CC20C4
ExStyle:    0x00010501
Handle:    0x004F0B3C

>>>> Control <<<<
Class:    SysListView32
Instance:    1
ClassnameNN:    SysListView321
Name:    
Advanced (Class):    [CLASS:SysListView32; INSTANCE:1]
ID:    1357
Text:    List1
Position:    18, 37
Size:    577, 601
ControlClick Coords:    47, 177
Style:    0x5021940D
ExStyle:    0x00000204
Handle:    0x00C70BF6

>>>> Mouse <<<<
Position:    686, 265
Cursor ID:    0
Color:    0xDBEAEC

>>>> StatusBar <<<<

>>>> ToolsBar <<<<

>>>> Visible Text <<<<
Inputs
List1
&Load
&Save
OK
Cancel
Reset


>>>> Hidden Text <<<<
1
false
None
2018.06.14 20:37:00

Share this post


Link to post
Share on other sites
Paxman

Not sure what to do with this as my knowledge of this scripting language is elementary.

Do i somehow modify the function to retrieve the Handle of the control and then somehow use the SetItemChecked function to check the control?

If so can you help with an example or give a few more pointers?

Thanks for your help.

Share this post


Link to post
Share on other sites
Zedna
Posted (edited)

Try this:

#include <GuiListView.au3>

$hLV = ControlGetHandle("GridTrader", "", "SysListView321")
_GUICtrlListView_SetItemChecked($hLV, 0)

It should set checked state for the first row in your ListView.

If it will work, you can easily accomodate it to set checked state to desired rows ...

Edited by Zedna

Share this post


Link to post
Share on other sites
Paxman

Ok that seems to make some sense to me now. I will give it a go. Thanks for your help here :)

Share this post


Link to post
Share on other sites
Paxman
Posted (edited)

Am i right in thinking that i can use the info in au3 window info (as below) to click a button.

Like

ControlClick($hWnd, "", "[Class:Button;Instance:1]")

Or is it better to use an ID?

>>>> Window <<<<
Title:  OANDA - MetaTrader - [EURGBP,M5]
Class:    MetaQuotes::MetaTrader::4.00
 

>>>> Control <<<<
Class:    Button
Instance:    1
ClassnameNN:    Button1
Name:    
Advanced (Class):    [CLASS:Button; INSTANCE:1]
ID:    1025
Text:    Expert properties
 

Edited by Paxman

Share this post


Link to post
Share on other sites
Paxman
Posted (edited)

I created a simple script to test this and it errors.

#include <MsgBoxConstants.au3>

; This is my first script
MsgBox($MB_SYSTEMMODAL, "My First Script!", "Hello World!")

ControlClick($hWnd, "", "Button1")  err $hWnd possibly used before declaration and err undeclared global variable.

So in VBA i would know where to look but i am stumped here.

Also once it has errored how can i get back to a screen without the error codes on please.

thanks

Neil

Edited by Paxman

Share this post


Link to post
Share on other sites
Paxman
Posted (edited)

After some googling i added global $hwnd to start and error went. However i think i need something before the button click to tell it what window to go to?

can i use this function i found in the recorder

Func _WinWaitActivate($title,$text,$timeout=0)
    WinWait($title,$text,$timeout)
    If Not WinActive($title,$text) Then WinActivate($title,$text)
    WinWaitActive($title,$text,$timeout)
EndFunc

and then use

_WinWaitActivate("9762353: OANDA - MetaTrader - [EURGBP,M5]","")

Or is that not the way to do it?

 

Edited by Paxman

Share this post


Link to post
Share on other sites
JLogan3o13

$hWnd is the variable that refers to the window. Look at the example for ControlClick in the help file; it shows you everything you need to know.


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites
Paxman

ok will do

 

Share this post


Link to post
Share on other sites
Paxman

Got it worked perfectly!

Help is good, knowing where to look is the thing :)

Share this post


Link to post
Share on other sites
JLogan3o13
21 minutes ago, Paxman said:

Help is good, knowing where to look is the thing :)

Every function in AutoIt has a page in the help file, many with not one but multiple examples...


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites
Paxman
15 hours ago, Zedna said:

Try this:

#include <GuiListView.au3>

$hLV = ControlGetHandle("GridTrader", "", "SysListView321")
_GUICtrlListView_SetItemChecked($hLV, 0)

It should set checked state for the first row in your ListView.

If it will work, you can easily accomodate it to set checked state to desired rows ...

Hi i got the code to run but it does not tick the control. I tried 0,1 and 2 to be sure.

Is there another way to do this? As mentioned before, in use you can only use the mouse with a left click or double click. No Keyboard shortcut exists.

Thanks

Neil

Share this post


Link to post
Share on other sites
Paxman

Did that to show a message  but no error.

Share this post


Link to post
Share on other sites
Paxman

i have set windows Ease of use to use the + key on the numeric keypad as a double click so we could just navigate to each line using {down} and then setting or unsetting? Is this a possible method?

Share this post


Link to post
Share on other sites
Paxman

mmm seems to only work if cursor is on the required line. Back to scripting it if possible.

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

  • Similar Content

    • Pike
      By Pike
      Hello Everyone,
      New Guy here. This is a two-part question, hopefully easy enough though. I know it's ugly coding, this is because I have only a couple hours worth of coding experience and could really use some help.
      1) When I single click the button I want one action (like playing a sound clip) and when I double click the button I want a different action (such as opening dialogue box to ask for soundclip directory address). At the bottom of the script I made a comment which one I would like single click versus double click.
      2) I can not get the FileOpenDialogue to save the file address to the config.ini file at the 'One' position on the .ini.
      #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <MsgBoxConstants.au3> #include <FileConstants.au3> #include <AutoItConstants.au3> #include <Sound.au3> Opt('MustDeclareVars', 1) Opt("GUIOnEventMode", 1) Global $OneID _Main() Func _Main() GUICreate("Form1", 156, 86, 281, 276) $OneID = GUICtrlCreateButton("Button", 15, 17, 122, 37) GUICtrlSetOnEvent($OneID, "OnOne") GUISetOnEvent($GUI_EVENT_CLOSE, "OnExit") GUISetState() While 1 While 1 Sleep(1000) WEnd WEnd EndFunc ;---------------Functions------------- While 1 Sleep(100) WEnd Func OnOne() ; ******************Single Click for this action**************** $OneID = IniRead("config.ini", "Config", "One", $OneID) If $OneID = True Then SoundPlay($OneID, @HotKeyPressed) Else ; *******Double Click for this action*****And Help Saving File Address to config.ini 'One'*********** $OneID = FileOpenDialog("Select file", @WorkingDir, "All (*.*)") IniWrite("config.ini", "Config", "One", $OneID) $OneID = InputBox("Enter Information", "Short Name for File?", "") IniWrite("config.ini", "Config", "NameOne", $OneID) EndIf EndFunc Any help would be greatly appreciated, and if you need anymore clarity as to what exactly I'm trying to do, please do not hesitate to ask. Thanks so much!
      Pike
    • PoojaKrishna
      By PoojaKrishna
      Hi friends,
      Is there any way to detect the left double clicks like we get the primary clicks  using _IsPressed("01").
      We can detect double clicks by initiating a timer and finding the delay between left clicks on same coordinates but still want to if there is a better direct way.
      Thank you friends.
       
      #Include <Misc.au3> ; Used for the _IsPressed HotKeySet("{ESC}", "_ExitScript") ;Hot key Esc to Exit script $nCountClick = 0 ;Click Count While 1 ; Loop until user presses ESc to exit the Recorder If _IsPressed("01") then ; If left mouse is pushed. While (_IsPressed("01")) ;Wait until user releases button Sleep(100) WEnd $pos = MouseGetPos() ; Get the position. $nCountClick = $nCountClick + 1 ;Add click count ToolTip($nCountClick & ") " & 'Left Clicked X: ' & $pos[0] & ', Y: ' & $pos[1]) ;Show the click count with position EndIf WEnd Func _ExitScript() ;HotKet method to Exit script Exit EndFunc ;=> _ExitScript  
    • Simpel
      By Simpel
      Hi,
      I'm wondering why my code snippet isn't working. I copied most of it from a script where it work's. Here is the code:
      #include <Constants.au3> Opt("TrayAutoPause", 0) ; no pause while click Opt("TrayMenuMode", 1) ; no exit and pause Opt("TrayOnEventMode", 1); While 1 Sleep(100) WEnd Exit #Region ### START Tray section Global $hIni = TrayCreateItem("open INI") TrayItemSetOnEvent (-1, "_INI") TrayCreateItem("") Global $hExit = TrayCreateItem("Exit") TrayItemSetOnEvent (-1, "_Quit") TraySetState(1) TraySetClick(16); INI and Exit with secondary click TraySetOnEvent( $TRAY_EVENT_PRIMARYDOUBLE, "_OpenPath" ); _OpenPath with primary double click #EndRegion ### END Tray section Func _OpenPath() $sPfad = @ScriptDir ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $sPfad = ' & $sPfad & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console $iDelimiterPfad = StringInStr($sPfad, "\", 0, -1) ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $iDelimiterPfad = ' & $iDelimiterPfad & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console $sPfadHoeher = StringLeft($sPfad, $iDelimiterPfad) ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $sPfadHoeher = ' & $sPfadHoeher & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console ShellExecute($sPfadHoeher) EndFunc Func _INI() ConsoleWrite("_INI" & @CRLF) Sleep(10) EndFunc Func _Quit() Exit EndFunc I can see the trayicon but there is nothing happening neither primary double click nor secondary click. What's wrong?
      Regards, Conrad
    • bustasnipe
      By bustasnipe
      Hello I have been going to this forum regularly for a couple weeks, getting all sorts of good info from you people.
      So first off thanks, you are all gentlemen/women and scholars.
      I just wanted to point out that I think it would be neat if you could double click either side of the quotation marks in the Scite editor to select the string of text within. Instead of having to manually select all the text within, which is not hard, but u may sometimes miss a extra character or something. Just like how you can select variables and single words by double clicking. Thanks to all those who have worked on and continue to work on Autoit, I love it.
       
    • XuxinhaKill
      By XuxinhaKill
      Well that is what I need... Identify a double click on a GUI label

      Something like this:

      #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> $n1 = "Null" $n2 = "Null" GUICreate("Teste",200,200) $Name1 = GUICtrlCreateLabel($n1,0,0,100,100,$SS_CENTER) $Name2 = GUICtrlCreateLabel($n2,0,100,100,100,$SS_CENTER) GUISetState(@SW_SHOW) While 1 ; If the label Name1 is double clicked then it pops up a inputbox If DoubleClick($Name1) Then $n1 = InputBox("Name","Name") GUICtrlSetData($Name1,$n1) EndIf WEnd
×