senormiggy Posted October 5, 2011 Posted October 5, 2011 Hello, I am totally new to Autoit. I want to know how to preform a simple script: $value = InputBox("Test", "Input", 0) sleep(500) Run(@WindowsDir & "\Notepad.exe", "", @SW_MAXIMIZE) WinActivate("Untitled - Notepad") SEND("{$VALUE}") Except it doesn't send what i typed in the input box. How can i change this? Thanks in advance, Mick
water Posted October 5, 2011 Posted October 5, 2011 This works for me: $value = InputBox("Test", "Input", 0) Sleep(500) Run(@WindowsDir & "\Notepad.exe", "", @SW_MAXIMIZE) WinActivate("Untitled - Notepad") WinWaitActive("Untitled - Notepad") Send($value) My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
Moderators Melba23 Posted October 5, 2011 Moderators Posted October 5, 2011 senormiggy,Welcome to the AutoIt forum. You need to wait until NotePad is open - like this:$value = InputBox("Test", "Input") sleep(500) Run(@WindowsDir & "\Notepad.exe", "", @SW_MAXIMIZE) WinWaitActive("Untitled - Notepad") ; Wait for NotePad to open SEND($value) ; You only need the "{ }" for literal textAll clear? Please ask if not. M23P.S. When you post code please use Code tags. Put [autoit] before and [/autoit] after your posted code. 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
senormiggy Posted October 5, 2011 Author Posted October 5, 2011 Thanks that works !! Could you help me with the following: $test = MsgBox(2,"OK", "OK", 0) if $test = 1 then Send("OK") Endif $test = 2 then Send("CANCEL") Thanks , this also doesn't work.
senormiggy Posted October 5, 2011 Author Posted October 5, 2011 $test = MsgBox(2,"OK", "OK", 0) WinActivate("Untitled - Notepad") if $test = 1 then Send("OK") Endif $test = 2 then Send("CANCEL") This should be it sorry.
water Posted October 5, 2011 Posted October 5, 2011 (edited) You use flag = 2 in your MsgBox. This displays buttons Abort, Retry, and Ignore. Abort, Retry, and Ignore set $test to values 3, 4 and 5. Please check the help file. Edited October 5, 2011 by water My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
Moderators Melba23 Posted October 5, 2011 Moderators Posted October 5, 2011 senormiggy,Go and look in the Help file at what MsgBox returns as values. In this case the 3 buttons return 3,4 or 5, so your code would need to look like this:$test = MsgBox(2, "OK", "OK", 0) If $test = 3 Then Send("Abort") ElseIf $test = 4 Then Send("Retry") ElseIf $test = 5 Then Send("Ignore") EndIfBut you need to learn some more about AutoIt. Reading the Help file (at least the first few sections - Using AutoIt, Tutorials and the first couple of References) will help you enormously. You should 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. I know you want to start coding NOW, but a little study will save you a lot of trouble later on, believe me. Good luck. 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
senormiggy Posted October 5, 2011 Author Posted October 5, 2011 Still a error Endif $test = 0 then Endif ^ ERROR Error: Illegal text at the end of statement ( one statement per line )
senormiggy Posted October 5, 2011 Author Posted October 5, 2011 Ah, added the EndIf now it works, thanks everybody !!
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