senormiggy 0 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 Share this post Link to post Share on other sites
water 2,387 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 2020-10-10 - Version 1.5.2.1) - Download - General Help & Support - Example Scripts - WikiOutlookEX (NEW 2020-12-15 - Version 1.6.3.1) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2020-06-27 - Version 1.3.2.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsPowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & SupportExcel - Example Scripts - WikiWord - WikiTask Scheduler (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - WikiTutorials:ADO - Wiki, WebDriver - Wiki Share this post Link to post Share on other sites
Melba23 3,455 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 Share this post Link to post Share on other sites
senormiggy 0 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. Share this post Link to post Share on other sites
senormiggy 0 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. Share this post Link to post Share on other sites
water 2,387 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 2020-10-10 - Version 1.5.2.1) - Download - General Help & Support - Example Scripts - WikiOutlookEX (NEW 2020-12-15 - Version 1.6.3.1) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2020-06-27 - Version 1.3.2.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsPowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & SupportExcel - Example Scripts - WikiWord - WikiTask Scheduler (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - WikiTutorials:ADO - Wiki, WebDriver - Wiki Share this post Link to post Share on other sites
Melba23 3,455 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 Share this post Link to post Share on other sites
senormiggy 0 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 ) Share this post Link to post Share on other sites
senormiggy 0 Posted October 5, 2011 Ah, added the EndIf now it works, thanks everybody !! Share this post Link to post Share on other sites