hollow Posted May 24, 2011 Posted May 24, 2011 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.
Moderators Melba23 Posted May 24, 2011 Moderators Posted May 24, 2011 hollow,Welcome to the AutoIt forum. Please help me clarify thisPerhaps if you clarified your question we might be able to help. 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? 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. M23 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
hollow Posted May 24, 2011 Author Posted May 24, 2011 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.
Moderators Melba23 Posted May 24, 2011 Moderators Posted May 24, 2011 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. 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 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
hollow Posted May 24, 2011 Author Posted May 24, 2011 So nice. Your explanation made me brilliant. 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 ?
Moderators Melba23 Posted May 24, 2011 Moderators Posted May 24, 2011 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! 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 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
hollow Posted May 24, 2011 Author Posted May 24, 2011 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.
Moderators Melba23 Posted May 24, 2011 Moderators Posted May 24, 2011 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. 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 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
hollow Posted May 24, 2011 Author Posted May 24, 2011 (edited) 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 May 24, 2011 by hollow
Moderators Melba23 Posted May 24, 2011 Moderators Posted May 24, 2011 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! M23 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
hollow Posted May 24, 2011 Author Posted May 24, 2011 (edited) When I run this code it gave me error...that variable used without declaration... Hence, I guess you want to play with me 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 May 24, 2011 by hollow
Moderators Melba23 Posted May 24, 2011 Moderators Posted May 24, 2011 hollow, What a stubborn brain!Do not get discouraged - we all started at the same point. 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. 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: #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 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
kaotkbliss Posted May 24, 2011 Posted May 24, 2011 ConsoleWrite sends the text to the bottom portion of the SciTE editor, not to the application 010101000110100001101001011100110010000001101001011100110010000 001101101011110010010000001110011011010010110011100100001 My Android cat and mouse gamehttps://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek We're gonna need another Timmy!
hollow Posted May 25, 2011 Author Posted May 25, 2011 M23, Thank for your explain and help. I'm alert to read about tutorial now. Thank all.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now