Jump to content

Recommended Posts

Posted (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.

Func 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 by Ryuji5864
Posted (edited)

I dont see anywhere u are sending text to notepad from the clipboard

Its because what I posted above is a separate function. Below is only a portion of my code.

; 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 by Ryuji5864
Posted (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 by Ryuji5864
Posted

have you tried to check if $sLastname or whatever is what u are looking for after reading the text from the clipboard?

Posted

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.

Posted

I think u havent understood my question... try this:

; 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

Posted (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]:

; 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 by Ryuji5864
Posted

I fixed my problem. Moved the _ClipBoard_GetData() outside of the Banner() function and it worked. Thanks for all the help and support.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...