Jump to content

Declaring a Variable


Maite
 Share

Recommended Posts

WinActivate("[CLASS:Notepad]")
ControlSend("[CLASS:Notepad]", "", "Edit1", "^a")
Sleep(100)
ControlSend("[CLASS:Notepad]", "", "Edit1", "^c")
Sleep(100)
$var=ClipGet()
MsgBox(0,"",$var)

When testing this, ^c would not work unless Notepad was activated first (brought to the front and active)

010101000110100001101001011100110010000001101001011100110010000

001101101011110010010000001110011011010010110011100100001

My Android cat and mouse game
https://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek

We're gonna need another Timmy!

Link to comment
Share on other sites

When testing this, ^c would not work unless Notepad was activated first (brought to the front and active)

It kinda makes sense... But at the same time doesn't :mellow: , Is something else stealing the focus and trying to handle the ^c? if you are going to be working with an edit control then you can send the message directly using _SendMessage:

#Include <WindowsConstants.au3>
#Include <SendMessage.au3>
_SendMessage(ControlGetHandle("[CLASS:Notepad]", "", "Edit1"), $WM_COPY, 0, 0)

Code hasn't been tested though, but I think thats what It should be.

If its a different control then it depends what it is, WM_COPY will work with most of the windows controls, but if its for a game or someone just making a slightly weird control and handling the ^c themselves you'll have to lool for another alternative.

Link to comment
Share on other sites

Funny thing is ^a selects all the text in notepad no matter it's state. I had excel open to see what gets copied to clipboard when ^c fires off and if notepad was not on top, then nothing would get copied.

010101000110100001101001011100110010000001101001011100110010000

001101101011110010010000001110011011010010110011100100001

My Android cat and mouse game
https://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek

We're gonna need another Timmy!

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