square65

Copying selected text is causing my macro to go completely haywire

21 posts in this topic

So after hours of debugging I give up. I need help.

I have a function that moves the cursor to a specified spot. Left button down. Moves over. Left button up.

Then since Autoit literally has no way to copy selected text I send in:

Send("^c")

then I move elsewhere, click, and send that text into the program.

Here is my function:

func experimental()
   $edelay=50
   MouseMove(822, 606, 0)
   ;MouseMove(653, 604, 0)
   sleep($edelay)
   MouseDown("left")
   sleep($edelay)
   MouseMove(867, 606, 0)
   ;MouseMove(698, 604, 0)
   sleep($edelay)
   MouseUp("left")
   sleep($edelay)
   Send("^c")
   sleep($edelay)
   MouseMove(1873, 13, 0)
   sleep($edelay)
   MouseClick("left")
   sleep($edelay)
   Send(ClipGet())
EndFunc

Sometimes this works. Sometimes it completely spazzes out and starts endlessly looping and running itself over and over rapidly, ripping my desktop to shreds.

The hotkey for this is shift+c if that matters.

 

Share this post


Link to post
Share on other sites



What are you accomplishing by using this?

Just want to see if there is an easier way of interacting with whatever it is you are interacting with. ;)


Snips & Scripts


My Snips: graphCPUTemp ~ getENVvars
My Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4

Feel free to use any of my code for your own use.                                                                                                                                                           Forum FAQ

 

Share this post


Link to post
Share on other sites

what are you selecting text in (e.g. file, webpage, ...) ?


,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Share this post


Link to post
Share on other sites

I select some text out of a webpage, then go over to a desktop program and send the text in, which needs to go in character by character in the same order it is in the original text.

Btw I should also mention. When I run this function, it also screws up and changes the values of other variables in the program.

Yet as you can see there is literally nothing in this function that should be doing that.

Share this post


Link to post
Share on other sites

square65, there has to be a better way to accomplish what you're after. Can you share the webpage, or at least more info about the text you're copying (is it always the same, always has specific words in it, etc.). I'm sure we can save you some pain. :)


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

what webpage?  

if you do this (replacing URL with the actual url) can you see all the text?

$sSRC = _INetGetSource("URL")
msgbox(0, '' , $sSRC)

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Viewing the page source won't help since the text is dynamically updating.

All I can say is it needs to select and copy text from the page then Send() it into a program on my desktop.

I'd link to the page but I can't. I'm helping a fairly well known company automate this process before they launch the site and I'm under an NDA.

Edited by square65

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

I think I just figured out the problem.

Some of the characters in the text I am copying from were triggering another macro when they were sent with Send()

I suspected this from the start but the bug was so weirdly non-reproducible that it took me until now to figure it out.

Btw, is there a better way to copy text than:

mousedown

mousemove

mouseup

send("^c")

Edited by square65

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

every other way is better than that way.  But you are asking for help for something we are not allowed to see, on a subject that is forbidden in the forum, so I imagine the thread will end right......here.

Edited by boththose

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Share this post


Link to post
Share on other sites

I don't see why what I'm talking about is forbidden.

I'm not doing anything illegal. I'm testing and developing something for a company.

And could you please tell me a better way for copying text that I select on a web page?

Share this post


Link to post
Share on other sites

This is disheartening. I was loving this tool and language. Got a very friendly vibe from everyone.

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

For your issue on your "specific code":

MouseClick? MouseClickDrag? (sorry, I forgot the drag part when I wrote it)

ControlSend?

Other than that, I agree with the others, you've explained nothing other than "webpage".  Your answers suit the questions.

Webpage?

IE.au3

FF.au3

IUIAutomatoin

Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

#13 ·  Posted (edited)

One thing that may ease you copy operation is a little trick.

Instead of dragging and dropping with the mouse automation

Doubleclicking over a text will highlight the word your cursor is hovering

Triple clicking will highlight the entire line..

Edit:  I have built things like this before too for quick personal use but if you are going to be giving this to someone else to use you should know this is a pretty unstable way of doing it and may work different under different circumstances.

Bill

Edited by l3ill

Share this post


Link to post
Share on other sites

Meh. I've been reading the documentation while posting here. I am doing it the best way, given the constraints on my problem.

I found boththose's accusation extremely off-putting with regards to discussing things with people here though.

I will be back if/when I have more issues.

I appreciate your guys help, including his, up until he said I was breaking the rules when I wasn't.

Share this post


Link to post
Share on other sites

#15 ·  Posted (edited)

its not an accusation, it is fact you are breaking the rules.

  • Launching, automation or script interaction with games or game servers, regardless of the game.

http://www.autoitscript.com/forum/index.php?app=forums&module=extras&section=boardrules

 

 

its cute that you edited post #7 to remove that part about the connect-4 game and all, but the mods and admin can see the post pre-edit.  I am sure they will find that equally as off-putting.

Edited by boththose

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Share this post


Link to post
Share on other sites

#16 ·  Posted (edited)

 

Doubleclicking over a text will highlight the word your cursor is hovering

Triple clicking will highlight the entire line..

You should try this bro it s a good way... if you can only select text manualy you should try diferent script option about coord move ...

its not an accusation, it is fact you are breaking the rules.

  • Launching, automation or script interaction with games or game servers, regardless of the game.

http://www.autoitscript.com/forum/index.php?app=forums&module=extras&section=boardrules

 

 

its cute that you edited post #7 to remove that part about the connect-4 game and all, but the mods and admin can see the post pre-edit.  I am sure they will find that equally as off-putting.

the fact is your not a mod, stop that .... I mean coming in help section to do the police is just, squeechy*.

Edited by caramen

Share this post


Link to post
Share on other sites

 I definitely wont stop,  if you had read i came in to be helpful requesting basic info, and the OP revealed the intent was for automating a connect4 game, at which point I told him my thoughts. So if thats squeechy then I am the squeechiest person you will ever come across.


,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Share this post


Link to post
Share on other sites

Guy like you should show themselve in real life ... kidos. 

Share this post


Link to post
Share on other sites

caramen, how about you take your own advice? If a Mod deems it necessary to have a word with boththose, they will. It is not your place to pollute the thread.

Reported the thread, specifically altered post #7. Let's let it rest until a Mod weighs in.

1 person likes this

√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

caramen, how about you take your own advice? If a Mod deems it necessary to have a word with boththose, they will. It is not your place to pollute the thread.

Reported the thread, specifically altered post #7. Let's let it rest until a Mod weighs in.

I admit you are true.

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.