Jump to content

Recommended Posts

Posted

I have a GUI with a textbox.

I want to make a button with "copy to clipboard and Exit"

How to realize to mark all text and copy to clipboard?

Thanks

Posted (edited)

Something like this?

#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

$hGui = GUICreate("Form1", 299, 184, 192, 114)
$hEdit = GUICtrlCreateEdit("", 8, 8, 281, 137, BitOR($ES_AUTOVSCROLL,$ES_AUTOHSCROLL,$ES_NOHIDESEL,$ES_WANTRETURN,$WS_VSCROLL))
GUICtrlSetData(-1, "This is a text. Press the button to put to Clipboard...")
$hButton = GUICtrlCreateButton("Put to Clipboard", 184, 152, 107, 25, $WS_GROUP)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $hButton
            ClipPut(GUICtrlRead($hEdit))

            MsgBox(0,"Done!","Your data is in the Clipboard.")


           Exit

    EndSwitch
WEnd
Edited by taietel

Things you should know first...In the beginning there was only ONE! And zero...

Progs:

  Reveal hidden contents
Create PDF(TXT2PDF,IMG2PDF) 3D Bar Graph DeskGadget Menu INI Photo Mosaic 3D Text
Posted

  On 4/14/2011 at 9:43 AM, 'taietel said:

Something like this?

#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

$hGui = GUICreate("Form1", 299, 184, 192, 114)
$hEdit = GUICtrlCreateEdit("", 8, 8, 281, 137, BitOR($ES_AUTOVSCROLL,$ES_AUTOHSCROLL,$ES_NOHIDESEL,$ES_WANTRETURN,$WS_VSCROLL))
GUICtrlSetData(-1, "This is a text. Press the button to put to Clipboard...")
$hButton = GUICtrlCreateButton("Put to Clipboard", 184, 152, 107, 25, $WS_GROUP)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $hButton
            ClipPut(GUICtrlRead($hEdit))

            MsgBox(0,"Done!","Your data is in the Clipboard.")


           Exit

    EndSwitch
WEnd

Yes, that is perfect.

Thanks

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
  • Recently Browsing   0 members

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