Copy Text from edit fields to clipboard.

Get help with using AutoHotkey and its commands and hotkeys
reboot689
Posts: 10
Joined: 10 Apr 2017, 14:49

Copy Text from edit fields to clipboard.

20 Apr 2017, 21:26

I am trying to create a Gui that lets me enter a phone number, order number and due date variable set along with some text, and have it copy to the clipboard for me to paste elsewhere. I have searched various forums and tried the manual but reading coding manuals have never got me anywhere. heres the code i have that isnt working.

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus



when i try to paste it i get nothing. with other tweaks i at least got "Due Needs Dispatch"

Can someone help figure out what ive got wrong?
A_AhkUser
Posts: 163
Joined: 06 Mar 2017, 16:18
Location: France

Re: Copy Text from edit fields to clipboard.

20 Apr 2017, 22:11

See GuiControlGet documentation remarks - especially:

To operate upon a window other than the default (see below), include its name or number followed by a colon in front of the sub-command (...)


For example:

Code: [Select all] [Download] GeSHi © Codebox Plus

GuiControlGet, BTN, 3:
GuiControlGet, Checked, 3:, Dispatch



Reboot689 wrote:when i try to paste it i get nothing. with other tweaks i at least got "Due Needs Dispatch"


You also better off set a g-label instead of using the syntax buttonCopy, not sure but, for the same reason as above, this maybe could not work.

Code: [Select all] [Download] GeSHi © Codebox Plus

Gui, 3:Add, Button, gMyLabel, Copy
return

MyLabel:
; ...

Hope this helps.
reboot689
Posts: 10
Joined: 10 Apr 2017, 14:49

Re: Copy Text from edit fields to clipboard.

21 Apr 2017, 13:36

I did originally have a g-label in there. Ill try your suggestion and see what happens
reboot689
Posts: 10
Joined: 10 Apr 2017, 14:49

Re: Copy Text from edit fields to clipboard.

21 Apr 2017, 13:46

alright so i made the change:

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus



I tried versions with adding ClipWait above and below the clipboard line. no change in behavior. now upon use i get:

"BTN SO# Due Due Date Dispatch Needed"

Also, if i copy something else to the clipboard, pressing the copy button no longer copies the information from the gui back to the clipboard. How do i fix this?
wolf_II
Posts: 1244
Joined: 08 Feb 2015, 20:55

Re: Copy Text from edit fields to clipboard.

21 Apr 2017, 14:02

There are several points here, that can be improved:
1 - The repeated use of Ctrl+Alt+Num1 will cause trouble with assigning the same variable to multiple controls.
2 - The ButtonCopy syntax works for Gui #1, if you have Gui #3, you need 3ButtonCopy.
3 - Check out Gui, Submit

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus

reboot689
Posts: 10
Joined: 10 Apr 2017, 14:49

Re: Copy Text from edit fields to clipboard.

21 Apr 2017, 15:11

This worked perfectly! thank you!

Though I am not sure what you mean by

wolf_II wrote:1 - The repeated use of Ctrl+Alt+Num1 will cause trouble with assigning the same variable to multiple controls.


I had only used it once i DID however have to move your placement of the ^!Numpad1:: Gui, 3: Show, w200 h200, OpsDeland to above the GUI, Add block of text in order for the Gui to show more than just a blank GUI.
reboot689
Posts: 10
Joined: 10 Apr 2017, 14:49

Re: Copy Text from edit fields to clipboard.

21 Apr 2017, 15:14

But how do I keep the Gui open and have it retain my entered info, in case i end up copying something else to the clipboard before i paste what i wanted from the gui?
wolf_II
Posts: 1244
Joined: 08 Feb 2015, 20:55

Re: Copy Text from edit fields to clipboard.

21 Apr 2017, 15:45

Try this, or check out the docs for Gui, Submit:

Code: [Select all] [Download] GeSHi © Codebox Plus

Gui, Submit, NoHide
I hope that helps.



Try with this:

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus

and see the problem of repeated hotkey presses.
wolf_II
Posts: 1244
Joined: 08 Feb 2015, 20:55

Re: Copy Text from edit fields to clipboard.

21 Apr 2017, 16:08

Additionally, I realized just now that your script may be larger than the snippet you posted.
Look at this slightly verbose script, and see if you can use that in your real script:

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus


Note: I spotted a reference to %SO#% and replaced that with %SO%

Return to “Ask For Help”

Who is online

Users browsing this forum: aandf, Bing [Bot], need4speed, Rohwedder, Ruevil2, smbs and 36 guests