Jump to content

Copying selected text is causing my macro to go completely haywire


square65
 Share

Recommended Posts

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.

 

Link to comment
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

 

Link to comment
Share on other sites

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

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

Link to comment
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.

Link to comment
Share on other sites

  • Moderators

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. :)

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
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)

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

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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
Link to comment
Share on other sites

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

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

Link to comment
Share on other sites

  • Moderators

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.

Link to comment
Share on other sites

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
Link to comment
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.

Link to comment
Share on other sites

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

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

Link to comment
Share on other sites

 

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

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Link to comment
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.

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

Link to comment
Share on other sites

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

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Link to comment
Share on other sites

  • Moderators

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.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
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.

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

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