Jump to content

GUI's private clipboard shared to aother application


AU3Newbie
 Share

Recommended Posts

HOW to share the GUI-form's information to another programs?

e.g.

#include <GUIConstants.au3>


$Form1 = GUICreate("testGUI", 186, 174, 193, 115)
$testcontent = GUICtrlCreateEdit("", 9, 8, 167, 113)
GUICtrlSetData(-1, "testcontent")
$Button1 = GUICtrlCreateButton("test clipborad", 56, 136, 75, 25, 0)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $button1
            ClipPut(GUICtrlRead($testcontent))
            run("notepad.exe")
            Sleep(100)
            send("^V")

    EndSwitch
WEnd

AS the example above,why the notepad cannot recieve the clipboard's content?

Link to comment
Share on other sites

Works for me


Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Link to comment
Share on other sites

Without changing anything?

Just copied and pasted it


Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Link to comment
Share on other sites

I have a feeling that notepad didn't get time to become active before Send was executed. Try this :

#include <GUIConstants.au3>

Opt("WinTitleMatchMode", 4) ; added

$Form1 = GUICreate("testGUI", 186, 174, 193, 115)
$testcontent = GUICtrlCreateEdit("", 9, 8, 167, 113)
GUICtrlSetData(-1, "testcontent")
$Button1 = GUICtrlCreateButton("test clipborad", 56, 136, 75, 25, 0)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $button1
            ClipPut(GUICtrlRead($testcontent))
            run("notepad.exe")
            WinWaitActive("classname=Notepad") ; replaced with sleep
            send("^V")

    EndSwitch
WEnd
Link to comment
Share on other sites

thank you very much.

Maybe the problem is ACTIVE problem or my OS isn't stable.

here's another,it works well.

thank you.

#include <GUIConstants.au3>

Opt("WinTitleMatchMode", 4); added

$Form1 = GUICreate("testGUI", 186, 174, 193, 115)
$testcontent = GUICtrlCreateEdit("", 9, 8, 167, 113)
GUICtrlSetData(-1, "testcontent")
$Button1 = GUICtrlCreateButton("test clipborad", 56, 136, 75, 25, 0)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $button1
                        $content=GUICtrlRead($testcontent)
            run("notepad.exe")

                        for $i=1 to StringLen($content) step 1
ClipPut(Stringleft($content,$i)&@CRLF)
      
            WinActivate("classname=Notepad"); replaced with sleep
            send("^V")
next
    EndSwitch
WEnd
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...