Jump to content

Why won't my stupid copy paste function work!!!!


Recommended Posts

For some reason, my clipboard keeps showing up as empty after copying something, yet I know it's there since I'm able to paste stuff just fine after I close the program. I think the ClipPut() is interrupting somehow, but don't know why.

$num = 11110

While(1)
    Main()
WEnd

Func Main()
Sleep(5000)
    MouseClickDrag("left", 750, 62, 140, 62) ;highlights address bar
Sleep(200)
    ClipPut("http://forums.worldofwarcraft.com/board.html?forumId=")
    Send("^v" & $num)
    ;Send("http://forums.worldofwarcraft.com/board.html?forumId=" & $num) ;this one works for some reason, yet the above two don't
Sleep(200)
    Send("{Enter}")
Sleep(5000)
    MouseClickDrag("left", 205, 485, 310, 485)
Sleep(200)
    Send("^c")
    msgbox(0, "", ClipGet()) ;msgbox shows my clipboard as empty, yet I can paste w/e I copied before from the clipboard
    $num = $num + 1
EndFunc
Link to comment
Share on other sites

Hi mate,

Just tried your script on my laptop. It copys & pastes http://forums.worldofwarcraft.com/board.html?forumId=11110 into the address bar of firefox, waits a few seconds then shows the message box, waits a few more seconds then goes to the next page ($i + 1)

What does it do on your PC? Have you tried clearing the clipboard?

Works fine on mine!

Link to comment
Share on other sites

And you're sure that you want it to loop infinitely?

Main question is this: are you building some kind of automation or flood bot?

Edited by jaberwocky6669
Link to comment
Share on other sites

Hi mate,

Just tried your script on my laptop. It copys & pastes http://forums.worldofwarcraft.com/board.html?forumId=11110 into the address bar of firefox, waits a few seconds then shows the message box, waits a few more seconds then goes to the next page ($i + 1)

What does it do on your PC? Have you tried clearing the clipboard?

Works fine on mine!

You do know that right before the msgbox I have Send("^c") right? It's supposed to copy the text that it highlights to the clipboard, and it does so successfully, but msgbox with clipget shows the clipboard as blank.

And you're sure that you want it to loop infinitely?

Main question is this: are you building some kind of automation or flood bot?

Yes I want it to loop. It's for another site, I just used wow as a placeholder.

It's for making a database on every user's account on the site.

I have it write to a txt file which I'll import to excel later, but excluded that section of the code since it's irrelevant.

Right now I'm just concerned as to why the clipboard wont show in clipget(). Remember, it shows up as blank even though there's text on the clipboard.

Someone who knows what they're doing, please help.

Edited by Vadoff
Link to comment
Share on other sites

  • Moderators

Vadoff,

First, please do not bump your posts within 24 hours. :blink:

Remember this is not a 24/7 support forum - those who answer are only here because they like helping others and have some time to spare. You just have to wait until someone who knows something about your particular problem, and is willing to help, comes online. Be patient and someone will answer eventually. :

Second:

Someone who knows what they're doing, please help

That attitude is not goimng to win you many friends around here - I suggest you change it rapidly. And if I do not meet your criterion of "knowing what I am doing" then you can stop reading now. :P

Your code works fine for me as it did for 3mustgetbeers. I can paste the original url and the MsgBox shows whatever is highlighted (highlit?) by the second MouseClickDrag, which is also what I get when I try pasting again.

Are you sure there is nothing else in your code which might interfere? What exactly are you trying to copy? Are you sure it is copiable? Have you tried manually? Because if it is not copiable, that would explain why you get an empty clipboard. ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Try this: (untested)

$num = 11110

While (1)
    Main()
WEnd

Func Main()

    Sleep(5000)

    MouseClickDrag("left", 750, 62, 140, 62) ;highlights address bar

    Sleep(200)

    ClipPut("http://forums.worldofwarcraft.com/board.html?forumId=" & $num)

    _Send("^v")

    ;_Send("http://forums.worldofwarcraft.com/board.html?forumId=" & $num) ;this one works for some reason, yet the above two don't

    Sleep(200)

    _Send("{Enter}")

    Sleep(5000)

    MouseClickDrag("left", 205, 485, 310, 485)

    Sleep(200)

    _Send("^c")

    $clipboard = ClipGet()

    Switch @error
        Case 0
            ; msgbox shows my clipboard as empty, yet I can paste w/e I copied before from the clipboard
            MsgBox(0, "", $clipboard)

        Case 1
            MsgBox(48, "Notice", "Clipboard is empty.")
            Exit

        Case 2
            MsgBox(48, "Notice", "Clipboard contains a non-text entry.")
            Exit

        Case 3, 4
            MsgBox(48, "Notice", "Clipboard cannot be accessed at the moment.")
            Exit

    EndSwitch


    $num = $num + 1
EndFunc ;==>Main

Func _Send(Const $sendString)
    Local Const $windowTitle = "The name of the browser window goes here" ; EX: "Firefox" or "Internet Explorer"

    If Not WinActive($windowTitle) Then

        WinActivate($windowTitle)
    EndIf

    BlockInput(1)

    Send($sendString)

    BlockInput(0)
EndFunc ;==>_Send
Edited by jaberwocky6669
Link to comment
Share on other sites

Vadoff,

First, please do not bump your posts within 24 hours. :blink:

Remember this is not a 24/7 support forum - those who answer are only here because they like helping others and have some time to spare. You just have to wait until someone who knows something about your particular problem, and is willing to help, comes online. Be patient and someone will answer eventually. :

Second:

That attitude is not goimng to win you many friends around here - I suggest you change it rapidly. And if I do not meet your criterion of "knowing what I am doing" then you can stop reading now. :P

Your code works fine for me as it did for 3mustgetbeers. I can paste the original url and the MsgBox shows whatever is highlighted (highlit?) by the second MouseClickDrag, which is also what I get when I try pasting again.

Are you sure there is nothing else in your code which might interfere? What exactly are you trying to copy? Are you sure it is copiable? Have you tried manually? Because if it is not copiable, that would explain why you get an empty clipboard. ;)

M23

Sorry I was just a bit frustrated, I should've read the forum rules about the bump rule. I won't do it again.

I've reduced the code down to the bare minimum you see above, and it still has a problem. The text I'm trying to copy is like in the code, just title of a thread so it's copiable.

For some reason the first copy paste has a 50% chance of showing the clipboard in the msgbox, but sequential ones often show the msgbox as blank. It's not a problem of the copy function since once I press esc and close the program, I can paste what was on the clipboard just fine. So the problem is it shows the clipboard as empty when it's really not.

Try this: (untested)

$num = 11110

While (1)
    Main()
WEnd

Func Main()

    Sleep(5000)

    MouseClickDrag("left", 750, 62, 140, 62) ;highlights address bar

    Sleep(200)

    ClipPut("http://forums.worldofwarcraft.com/board.html?forumId=" & $num)

    _Send("^v")

    ;_Send("http://forums.worldofwarcraft.com/board.html?forumId=" & $num) ;this one works for some reason, yet the above two don't

    Sleep(200)

    _Send("{Enter}")

    Sleep(5000)

    MouseClickDrag("left", 205, 485, 310, 485)

    Sleep(200)

    _Send("^c")

    $clipboard = ClipGet()

    Switch @error
        Case 0
            ; msgbox shows my clipboard as empty, yet I can paste w/e I copied before from the clipboard
            MsgBox(0, "", $clipboard)

        Case 1
            MsgBox(48, "Notice", "Clipboard is empty.")
            Exit

        Case 2
            MsgBox(48, "Notice", "Clipboard contains a non-text entry.")
            Exit

        Case 3, 4
            MsgBox(48, "Notice", "Clipboard cannot be accessed at the moment.")
            Exit

    EndSwitch


    $num = $num + 1
EndFunc ;==>Main

Func _Send(Const $sendString)
    Local Const $windowTitle = "The name of the browser window goes here" ; EX: "Firefox" or "Internet Explorer"

    If Not WinActive($windowTitle) Then

        WinActivate($windowTitle)
    EndIf

    BlockInput(1)

    Send($sendString)

    BlockInput(0)
EndFunc ;==>_Send

Thanks for the help, but I'm still experiencing the same problems. The first time I ran it, it successfully copied and showed the correct text in the msgbox, then once it looped and went onto the second page it said "clipboard empty" and crashed. After the program ended, I immediately pasted onto the url bar and it showed that the correct text for the second page had been copied and was on the clipboard.

Hmm, maybe I'll make a fraps video showing what it's like for me.

Link to comment
Share on other sites

 I've had similar problems in the past.

The solution that has always worked for me is to put a short sleep between copying data to the clipboard and trying to past if.

example

send("^c")
Sleep(1000)
Send("^v")

Sleep(1000) is probably longer than is required, so experiment with different values until you find the value that reliably works for you.  

Edited by Bowmore

"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook

Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...