Jump to content
Estimize

Help with copying and pasting into variables

Recommended Posts

Estimize

The code below is intended to copy and paste highlighted text but I've been running into trouble.

The Text is already highlighted via the Mouseclicks and I've tried selecting text myself and then running code but I've no such luck. The issue is with the send("^C") part of the code I believe because ClipGet() works when I manually copy something. Any help is appreciated.

#include <Array.au3>
#include <MsgBoxConstants.au3>

   Sleep(1000)
   MouseClick("left",1162, 497,2,1)
      send("^C")
      sleep(2000)
      $Time = ClipGet()
      MsgBox(1,"",$Time,0)

 

Update : I've just ran Send("^c") on its own in blank page in autoit to see what it entered and the photo below shows just that.

dfua.png

Edited by Estimize

Share this post


Link to post
Share on other sites
SadBunny

Doesn't the mouseclick cancel the selection?


Roses are FF0000, violets are 0000FF... All my base are belong to you.

Share this post


Link to post
Share on other sites
Estimize
3 minutes ago, SadBunny said:

Doesn't the mouseclick cancel the selection?

They aren't the problem , I've tried it with and without the mouseclicks and it still doesnt work.

Share this post


Link to post
Share on other sites
l3ill

I just tested your code several times

doublelcick on sleep

and then run this code:

;~    Sleep(1000)
;~    MouseClick("left",1162, 497,2,1)
      send("^c")
      sleep(2000)
      $Time = ClipGet()
      MsgBox(1,"",$Time,0)

I get a message box with "sleep"

Share this post


Link to post
Share on other sites
Estimize
6 minutes ago, l3ill said:

Try using a small c

send("^c")

 

Just tried and it worked, thank you, this just makes me confused as to why it works with a small c and not a capital C now, any ideas?

Share this post


Link to post
Share on other sites
SadBunny

Good point, I missed that 2 there :) I was going to suggest lowercase c as well, but i tested it in notepad and there it works fine with ^C.

@Estimize Where are you copying from? Is it a default windows control or maybe some special gui? Try playing with SendKeyDownDelay by setting Opt("SendKeyDownDelay", 50) (or higher values) on top of your script, some interfaces need more time to register the keypress than the default 5 msec.


Roses are FF0000, violets are 0000FF... All my base are belong to you.

Share this post


Link to post
Share on other sites
SadBunny

The capital C implies pressing the shift key.

From the Send() help file:

Quote

N.B. Some programs are very choosy about capital letters and ALT keys, i.e., "!A" is different from "!a". The first says ALT+SHIFT+A, the second is ALT+a. If in doubt, use lowercase!

 


Roses are FF0000, violets are 0000FF... All my base are belong to you.

Share this post


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

  • Similar Content

    • santoshM
      By santoshM
      How can i exit from a procedure in auto
      Func test() if x=o then     return endif endFunc  
    • Valnurat
      By Valnurat
      Hi
      Small question.
      I trying to find all index in an array with value higher than 7.
      How can that be possible?
    • TrashBoat
      By TrashBoat
      Could someone help me create or give an idea of how to do a incrementing for loop that would do this: https://i.imgur.com/YFUt47H.gifv
      I'm having a hard time figuring it out :S
    • msd1994
      By msd1994
      I have a script that just adds some keyboard shortcuts for things like displaying the current song and artist, moving the window to the side so it won't pop up in my way, and play/pause, next song, previous song (these are the only 3 to still work since they don't need the window handle.)
      In some update recently, Spotify's window class swapped from "[CLASS:SpotifyMainWindow]" to "[CLASS:Chrome_WidgetWin_0]". Using the new class in my controls doesn't seem to work, I've tried getting the window handle from the process handle (_GetHwndFromPID($PID)) but that seems to fail as well.
      Does anybody have some idea of a way I could get this script working again?
       
      edit: seems like discord has the same window class name, so could be some issue with this? Still not sure of a way to solve the issue though, I added a function to get the handle of the active window and can just use that now, but it was able to find it on its own before on spotify startup or script startup which would be preferred.
       
      Thanks!
    • sumandevadiga
      By sumandevadiga
      Hello 
      I would like to Run Outlook macros from Autoit every 1 hour, below script unable to run macros.
      While 1 $Minute = Random(1,59,1) Do Sleep(1000) Until @Min = $Minute ; do whatever ; Since we want it to run randomly once an hour, we need to calculate how much time is left before the hour is up, and sleep that length of time. $s = ((60 - $Minute) * 60) * 1000 Sleep($s) $oOApp = ObjCreate("Outlook.Application") $oOApp.Run("SaveAttachments") ; Run Outlook Macros WEnd  
       
×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.