Ryuji5864 Posted May 5, 2009 Share Posted May 5, 2009 (edited) I want to store three values from the clipboard as separate data types [i know Clipget() does that]. After I store the values as data types, I need to be able to send the variables with the data over to notepad at any point in time. However, when I attempt to send a variable over to notepad I am receiving the last value stored into the clipboard. In other words, its not sending the clipboard value I want assigned to the variable. expandcollapse popupFunc Banner() ; Goatpad Send("GOATPAD{ENTER}") Sleep(500) Send($CID) Sleep(250) Send("{ALTDOWN}b") Sleep(250) Send("n") Sleep(250) Send("in") Sleep(250) Send("in") Sleep(250) Send("in") Sleep(250) Send("in") Sleep(250) Send("ec") $sUsername = StringStripWS(ClipGet(), 8) Sleep(250) Send("fx{ALTUP}") Sleep(500) ; Spaiden Send("SPAIDEN{ENTER}") Sleep(250) Send("{ALTDOWN}b") Sleep(250) Send("n") Sleep(250) Send("in") Sleep(250) Send("in") Sleep(250) Send("ec") $sLastname = StringStripWS(ClipGet(), 8) Sleep(250) Send("in") Send("ec{ALTUP}") $sFirstname = StringStripWS(ClipGet(), 8) EndFunc Edited May 5, 2009 by Ryuji5864 Link to comment Share on other sites More sharing options...
oMBRa Posted May 5, 2009 Share Posted May 5, 2009 check out _ClipBoard function in the help file Link to comment Share on other sites More sharing options...
Ryuji5864 Posted May 5, 2009 Author Share Posted May 5, 2009 check out _ClipBoard function in the help fileWhich one? Link to comment Share on other sites More sharing options...
oMBRa Posted May 5, 2009 Share Posted May 5, 2009 what type of data are u trying to get from the clipboard? btw use: _ClipBoard_GetData() Link to comment Share on other sites More sharing options...
Ryuji5864 Posted May 5, 2009 Author Share Posted May 5, 2009 what type of data are u trying to get from the clipboard?I am retrieving a string from the clipboard. Link to comment Share on other sites More sharing options...
oMBRa Posted May 5, 2009 Share Posted May 5, 2009 I dont see anywhere u are sending text to notepad from the clipboard Link to comment Share on other sites More sharing options...
Ryuji5864 Posted May 5, 2009 Author Share Posted May 5, 2009 (edited) I dont see anywhere u are sending text to notepad from the clipboardIts because what I posted above is a separate function. Below is only a portion of my code. expandcollapse popup; Libraries #Include <Clipboard.au3> #Include <Array.au3> $CID = "" $sUsername = "" $sLastname = "" $sFirstname = "" CID() OpenRun() Firefox() Banner() sleep(500) OpenNotepad() Send($sUsername) OpenRun() ActiveDirectory() Func Banner() Send("GOATPAD{ENTER}") Sleep(500) Send($CID) Sleep(250) Send("{ALTDOWN}b") Sleep(250) Send("n") Sleep(250) Send("in") Sleep(250) Send("in") Sleep(250) Send("in") Sleep(250) Send("in") Sleep(250) Send("ec") $sUsername = StringStripWS(_ClipBoard_GetData(), 8) Sleep(250) Send("fx{ALTUP}") Sleep(500) ; Spaiden Send("SPAIDEN{ENTER}") Sleep(250) Send("{ALTDOWN}b") Sleep(250) Send("n") Sleep(250) Send("in") Sleep(250) Send("in") Sleep(250) Send("ec") $sLastname = StringStripWS(_ClipBoard_GetData(), 8) Sleep(250) Send("in") Send("ec{ALTUP}") $sFirstname = StringStripWS(_ClipBoard_GetData(), 8) EndFunc Func CID() $LoopB = 1 While $LoopB = 1 $CID = InputBox("PW Changer", "Please type in the student's campus ID number and click, 'OK'") If @error = 1 Then Exit Else If $CID > 80000000 AND $CID < 89999999 Then $LoopB = 0 Else MsgBox(4096, "Error", "The campus ID number you entered is not in range - try again!") EndIf EndIf WEnd EndFunc Func CloseNotepad() Send("!f") Send("x") EndFunc Func OpenNotepad() Run("notepad.exe") WinWaitActive("Untitled - Notepad") Send("!{SPACE}x") EndFunc Func OpenRun() Send("#r") Sleep(250) Send("{DEL}") EndFunc Edited May 5, 2009 by Ryuji5864 Link to comment Share on other sites More sharing options...
oMBRa Posted May 5, 2009 Share Posted May 5, 2009 try ControlSend('[Class:Notepad]', '', 'Edit1', $sUsername) instead of Send($sUsername) Link to comment Share on other sites More sharing options...
Ryuji5864 Posted May 5, 2009 Author Share Posted May 5, 2009 (edited) try ControlSend('[Class:Notepad]', '', 'Edit1', $sUsername) instead of Send($sUsername) Received the actual user name in the output, but if I try to output the last name or first name it prints the user name again Edited May 5, 2009 by Ryuji5864 Link to comment Share on other sites More sharing options...
oMBRa Posted May 5, 2009 Share Posted May 5, 2009 have you tried to check if $sLastname or whatever is what u are looking for after reading the text from the clipboard? Link to comment Share on other sites More sharing options...
Ryuji5864 Posted May 6, 2009 Author Share Posted May 6, 2009 have you tried to check if $sLastname or whatever is what u are looking for after reading the text from the clipboard?All I am trying to do is store the previous value from the clipboard as a variable and print the variable later. Link to comment Share on other sites More sharing options...
oMBRa Posted May 6, 2009 Share Posted May 6, 2009 I think u havent understood my question... try this: expandcollapse popup; Libraries #Include <Clipboard.au3> #Include <Array.au3> $CID = "" $sUsername = "" $sLastname = "" $sFirstname = "" CID() OpenRun() Firefox() Banner() sleep(500) OpenNotepad() Send($sUsername) OpenRun() ActiveDirectory() Func Banner() Send("GOATPAD{ENTER}") Sleep(500) Send($CID) Sleep(250) Send("{ALTDOWN}b") Sleep(250) Send("n") Sleep(250) Send("in") Sleep(250) Send("in") Sleep(250) Send("in") Sleep(250) Send("in") Sleep(250) Send("ec") $sUsername = StringStripWS(_ClipBoard_GetData(), 8) msgbox(0, '', $susername) Sleep(250) Send("fx{ALTUP}") Sleep(500) ; Spaiden Send("SPAIDEN{ENTER}") Sleep(250) Send("{ALTDOWN}b") Sleep(250) Send("n") Sleep(250) Send("in") Sleep(250) Send("in") Sleep(250) Send("ec") $sLastname = StringStripWS(_ClipBoard_GetData(), 8) msgbox(0, '', $slastname) Sleep(250) Send("in") Send("ec{ALTUP}") $sFirstname = StringStripWS(_ClipBoard_GetData(), 8) EndFunc Func CID() $LoopB = 1 While $LoopB = 1 $CID = InputBox("PW Changer", "Please type in the student's campus ID number and click, 'OK'") If @error = 1 Then Exit Else If $CID > 80000000 AND $CID < 89999999 Then $LoopB = 0 Else MsgBox(4096, "Error", "The campus ID number you entered is not in range - try again!") EndIf EndIf WEnd EndFunc Func CloseNotepad() Send("!f") Send("x") EndFunc Func OpenNotepad() Run("notepad.exe") WinWaitActive("Untitled - Notepad") Send("!{SPACE}x") EndFunc Func OpenRun() Send("#r") Sleep(250) Send("{DEL}") EndFunc run the script and tell me if in the msgbox there is the text u want Link to comment Share on other sites More sharing options...
Ryuji5864 Posted May 8, 2009 Author Share Posted May 8, 2009 (edited) I think u havent understood my question... try this: run the script and tell me if in the msgbox there is the text u want Yes, the text displayed in the message box is the text that I want. However, I want to display the test later on in my program. Here is an example program of what I am trying to accomplish [However, the program below works perfectly]: expandcollapse popup; Example code #Include <Clipboard.au3> OpenNotepad() Sleep(500) Send("jdoe ") Sleep(500) Send("{END}+{HOME}^x") $sUsername = StringStripWS(_ClipBoard_GetData(), 8) Send("John ") Sleep(500) Send("{END}+{HOME}^x") $sFirstname = StringStripWS(_ClipBoard_GetData(), 8) Send("Doe ") Sleep(500) Send("{END}+{HOME}^x") $sLastname = StringStripWS(_ClipBoard_GetData(), 8) CloseNotepad() OpenNotepad() Send($sUsername) Send("{ENTER}") Send($sFirstname & " " & $sLastname) Sleep(5000) Send("^a{DEL}") Func OpenNotepad() Run("notepad.exe") WinWaitActive("Untitled - Notepad") Send("!{SPACE}x") EndFunc Func CloseNotepad() ; Close Notepad Send("!f") Send("x") EndFunc Edited May 8, 2009 by Ryuji5864 Link to comment Share on other sites More sharing options...
Ryuji5864 Posted May 8, 2009 Author Share Posted May 8, 2009 I fixed my problem. Moved the _ClipBoard_GetData() outside of the Banner() function and it worked. Thanks for all the help and support. 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