CarlKing Posted January 2, 2007 Share Posted January 2, 2007 How do I send the contents of a string variable to Notepad? Yes I am a total newbie to AutoIt. $answer = MsgBox(4, "Split Text", "This script will run Notepad type in some text and then quit. Run?") If $answer = 7 Then MsgBox(0, "AutoIt", "OK. Bye!") Exit EndIf Run("notepad.exe") WinWaitActive("Untitled - Notepad") $days = StringSplit(" Sun Mon Tue Wed Thu Fri Sat", " ") send, $days[0] send, $days[1] send ("{enter}") for $i=0 to $days[0] $i += 1 send($i) if $days[$i] <> "" Then if $days[$i] <> " " Then send("{$days[$i]}{enter} {enter}") EndIf endif Next Link to comment Share on other sites More sharing options...
James Posted January 2, 2007 Share Posted January 2, 2007 #include <GuiConstants.au3> GuiCreate("MyGUI", 235, 190,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS)) $Input = GuiCtrlCreateInput("", 20, 30, 200, 20) $copy = GuiCtrlCreateButton("Copy", 20, 150, 60, 30) $exit = GuiCtrlCreateButton("Exit", 160, 150, 60, 30) GuiSetState() While 1 $msg = GuiGetMsg() Select Case $msg = $exit Exit Case $msg = $copy $readme = GuiCtrlRead($Input) run("notepad.exe") WinActivate("Untitled - Notepad") Sleep(1000) Send($readme) Case $msg = $GUI_EVENT_CLOSE ExitLoop Case Else ;;; EndSelect WEnd Exit Secure Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
_Kurt Posted January 2, 2007 Share Posted January 2, 2007 Also, look up Control in the helpfile, there are various examples .. ControlSend, ControlClick, etc. Awaiting Diablo III.. Link to comment Share on other sites More sharing options...
seandisanti Posted January 2, 2007 Share Posted January 2, 2007 (edited) Also, look up Control in the helpfile, there are various examples .. ControlSend, ControlClick, etc.yes, i typically use controlsettext("Untitled - Notepad","",15,$var) for notepad, because then i don't have to worry about other keystrokes affecting the string to be set, and i don't have to have the notepad as the active window, etc etc etc. Edited January 2, 2007 by cameronsdad Link to comment Share on other sites More sharing options...
CarlKing Posted January 3, 2007 Author Share Posted January 3, 2007 Thank you all. I really appreciate your help! I can see I will be writing a bunch of functions to simplify things to the level I am used to (mainframe assembler). Link to comment Share on other sites More sharing options...
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