Jump to content

Autoit Window Info & Autoit3 Window Spy


Recommended Posts

Hi all,

I'm kinda new to the forum. I like Autoit. But I don't have good talent to do with it anyway. However, I always research mostly with Autohotkey which have function similar to Autoit. One feature of autohotkey is Autoit window spy that can catch exact coordinate of the application and game while autoit window info seem weird. Does anyone have any idea on this ?

Please help me clarify this.

Link to comment
Share on other sites

  • Moderators

hollow,

Welcome to the AutoIt forum. ;)

Please help me clarify this

Perhaps if you clarified your question we might be able to help. :ph34r:

One feature of autohotkey is Autoit window spy that can catch exact coordinate of the application and game while autoit window info seem weird.

The AutoIt Window Info tool (C:\Program Files\AutoIt3\Au3Info.exe if you have a standard install) will tell you control and GUI coordinates - in what way do you find it weird? :huh2:

And a word of warning since you used the "G" word in your very first post: Please read the forum rules and do not post about forbidden subjects. :alien:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Oh I'm sorry Melba23. I have no intention to post about forbidden subject.

Anyway, the way that I find Autoit window info tool weird is that, When I use Autoit3 window spy (comes with Autohotkey) I use mouse click on e.g: MS Excel, it gives me an exact mouse click coordinate. Even if I move Excel to anywhere on screen, when I run the script mouse click on the same coordinate, while Autoit window info did not.

Link to comment
Share on other sites

  • Moderators

hollow,

Look at Opt("MouseCoordMode") in the Help file - setting this will allow you to use mouse coordinates relative to the GUI client area when required. :huh2:

Do not forget to set the Window Info tool to <Options - Coord Mode - Client> when you locate the point you require or you will not get the correct values to use - and of course you need to select the Mouse tab to see the coordinates in the first place. ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

So nice. Your explanation made me brilliant. :huh2:

If WinActivate ("Microsoft Excel - Test") Then
    Opt ("MouseCoordMode", 2)
    MouseClick ("left", 1015, 103)
    Send ("175{tab}187{Enter}")
    EndIf

And I got one more question ;)

I generated a form koda.

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 144, 98, 192, 124)
$Input1 = GUICtrlCreateInput("Input1", 16, 16, 105, 21)
$Button1 = GUICtrlCreateButton("Button1", 32, 48, 73, 33)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd

My intention is to let user write anything in the Input box, and when they click on $Button1 it should send the same text on an application screen. What the code should be ?

Link to comment
Share on other sites

  • Moderators

hollow,

What the code should be ?

It does not work like that here - even if you flatter us, we still expect you to do most of the work! :huh2:

Look in the Help file at:

- <GUI Reference - MessageLoop Mode> and <GUI Reference - OnEvent Mode> to see how to get the button to action

- GUICtrlRead and Send to see how to find out what is in the input and pass it to your app.

As a newcomer to AutoIt, reading some of the Help file (at least the first few sections - Using AutoIt, Tutorials and the first couple of References) will help you enormously. You might also look at the excellent tutorials that you will find here and here - you will find other tutorials in the Wiki (the link is at the top of the page). There are even video tutorials on YouTube if you prefer watching to reading.

Have fun! ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

It does not work like that here - even if you flatter us, we still expect you to do most of the work! ;)

What did you mean ? It is not possible to run this code, or you won't tell me if I don't write any code ? I'm blind. :huh2:

Link to comment
Share on other sites

  • Moderators

hollow,

What did you mean ?

I have given you the location to look in the Help file to find out how to detect when your button is pressed - and the functions you will need to read and then do something with the content of the input. :huh2:

I now expect you to at least make an attempt to code this very simple script yourself. If you run into problems, you know where I am - but you need to show a bit of effort first. Think of the old saying: "Give a man a fish, you feed him for a day; give a man a net and you feed him forever". We try to be net makers and repairers, not fishmongers. ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

I think I got crazy end up with this:

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 144, 98, 192, 124)
$Input1 = GUICtrlCreateInput("Input1", 16, 16, 105, 21)
$Button1 = GUICtrlCreateButton("Button1", 32, 48, 73, 33)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Input1
            GUICtrlRead ("Input1", 0)
            GUICtrlSendMsg ("Button1")
        Case $Button1 = Input1

    EndSwitch
WEnd

I know I'm stupid. Perhaps if you can help me just out, I can follow and then reverse it to the lesson!

Edited by hollow
Link to comment
Share on other sites

  • Moderators

hollow,

#include <GUIConstantsEx.au3>

$Form1 = GUICreate("Form1", 144, 98, 192, 124)
$Input1 = GUICtrlCreateInput("Enter text here", 16, 16, 105, 21)
$Button1 = GUICtrlCreateButton("Read", 32, 48, 73, 33)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg() ; This gives the ControlID if the actioned control
    Switch $nMsg
        Case $GUI_EVENT_CLOSE ; Look for the [X] being pressed
            Exit
        Case $Button1 ; Look for the button being pressed
            $sInput = GUICtrlRead ($Input1) ; Read the input
            ConsoleWrite("The input reads: " & $sInput & @CRLF) ; Write the content to the console
    EndSwitch
WEnd

Now go and read those tutorials! :huh2:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

When I run this code it gave me error...that variable used without declaration...

Hence, I guess you want to play with me :huh2: so I add something:

#include <GUIConstantsEx.au3>

$Form1 = GUICreate("Form1", 144, 98, 192, 124)
$Input1 = GUICtrlCreateInput("Enter text here", 16, 16, 105, 21)
$Button1 = GUICtrlCreateButton("Read", 32, 48, 73, 33)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg() ; This gives the ControlID if the actioned control
    Switch $nMsg
        Case $GUI_EVENT_CLOSE ; Look for the [X] being pressed
            Exit
        Case $Button1 ; Look for the button being pressed
            $Input1 = GUICtrlRead ($Input1) ; Read the input
            Local $var = "Enter text here"
            If WinActivate ("Microsoft Excel - Book1") Then
                MouseClick ("left", 1015, 103)
                ConsoleWrite("Enter text here" & $Input & @CRLF) ; Write the content to the console
            EndIf
    EndSwitch
WEnd

However, 0 result, nothing send to Excel but error. Still the same. And but I don't see any GUICtrlRead or Send.

Even this very simple script, I can't do. What a stubborn brain!

Edited by hollow
Link to comment
Share on other sites

  • Moderators

hollow,

What a stubborn brain!

Do not get discouraged - we all started at the same point. :alien:

Your script gives you the "variable used without declaration" error because you use $Input1 early and then use $Input at the end - attention to detail is important in coding. :huh2:

I also suggested using Send if you wanted to pass the value to your app - if you want help you might at least listen to it: :ph34r:

#include <GUIConstantsEx.au3>

$Form1 = GUICreate("Form1", 144, 98, 192, 124)
$Input1 = GUICtrlCreateInput("Enter text here", 16, 16, 105, 21)
$Button1 = GUICtrlCreateButton("Read", 32, 48, 73, 33)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg() ; This gives the ControlID if the actioned control
    Switch $nMsg
        Case $GUI_EVENT_CLOSE ; Look for the [X] being pressed
            Exit
        Case $Button1                                            ; Look for the button being pressed
            $sContent = GUICtrlRead ($Input1)                    ; Read the input
            WinActivate ("Microsoft Excel - Book1")              ; Activate Excel
            WinWaitActive ("Microsoft Excel - Book1")            ; And wait for it to become active
            MouseClick ("left", 1015, 103)
            Sleep(100)                                           ; Give everything a moment to settle
            Send($sContent)                                      ; Send the content to Excel
    EndSwitch
WEnd

Try that and see if it works.

Have you looked at those tutorials yet? You will find life much less frustrating if you take the time to learn a bit more about Autoit before trying to script. I know you want to start coding NOW, but a bit of study will pay dividends later, believe me. ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

ConsoleWrite sends the text to the bottom portion of the SciTE editor, not to the application

010101000110100001101001011100110010000001101001011100110010000

001101101011110010010000001110011011010010110011100100001

My Android cat and mouse game
https://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek

We're gonna need another Timmy!

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...