Sign in to follow this  
Followers 0
IvanCodin

Copy input to clipboard

5 posts in this topic

I am attempting to get the script below working correctly. When I press the Copy Notes button I would like it to copy the content of my_notes to the clipboard. I then open up the application I want to store my information in and press CTRL-C to paste the clipboard into the document. The information typed in the window is not copied only the digit 3.

CODE

#Include <GUIConstants.au3>

#Include <Misc.au3>

#include <Process.au3>

$Form1 = GUICreate("My Tool Box", 499, 447, 270, 98)

$my_notes = GUICtrlCreateEdit("", 32, 40, 337, 377)

$Button0 = GUICtrlCreateButton("Copy Notes", 30, 5, 89, 33, 0)

$Button1 = GUICtrlCreateButton("RAS", 392, 40, 89, 33, 0)

$Button2 = GUICtrlCreateButton("Putty", 392, 88, 89, 33, 0)

$Button3 = GUICtrlCreateButton("Telnet", 392, 136, 91, 33, 0)

$Button4 = GUICtrlCreateButton("VNC", 392, 184, 89, 33, 0)

$Button5 = GUICtrlCreateButton("Console 2", 392, 232, 89, 33, 0)

$Button6 = GUICtrlCreateButton("KeePass", 392, 280, 89, 33, 0)

$Button7 = GUICtrlCreateButton("Timer", 392, 328, 89, 33, 0)

$Button8 = GUICtrlCreateButton("Spare", 392, 376, 89, 33, 0)

GUISetState(@SW_SHOW)

While 1

$msg = GUIGetMsg()

Select

Case $msg = -3

Exit

Case $msg = $Button1

Run("C:\windows\system32\rasdial C2")

Case $msg = $Button2

$ssh = InputBox("IP", "Enter IP to connect to", @IPAddress1)

Putty()

Case $msg = $Button3

$ip = InputBox("IP", "Enter IP to connect to", @IPAddress1)

Telnet()

Case $msg = $Button4

Run("C:\Program Files\UltraVNC\vncviewer.exe")

Case $msg = $Button5

Run("Console.exe")

Case $msg = $Button6

Run("C:\Program Files\KeePass Password Safe\KeePass.exe")

Case $msg = $Button7

Run("stopwtch.exe")

Case $msg = $Button0

ClipPut($my_notes)

EndSelect

WEnd

Func Telnet()

$ip = InputBox("IP", "Enter IP to connect to", @IPAddress1)

run("telnet " & $ip)

EndFunc

Func Putty()

$ssh = InputBox("IP", "Enter IP to connect to", @IPAddress1)

run("putty " & $ssh)

EndFunc

Thanks

CC

Share this post


Link to post
Share on other sites

This will only put the identifier (controlID) of the control on the clipboard. (That's what the GuiCtrlCreate... functions return.)

You need don't need that; you need to retrieve the contents and put those in the clipboard. Something like ClipPut(GuiCtrlRead($someInputControl)) should work better.


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

Share this post


Link to post
Share on other sites

Thanks

I'll give it a try.

CC

Share this post


Link to post
Share on other sites

Worked like a charm.

I changed ClipPut($my_notes) to ClipPut(GuiCtrlread($my_notes)) and it worked perfectly. I had forgotten this is required to read the actual input.

:)

Thanks!

CC

Share this post


Link to post
Share on other sites

Nice! Glad to be of help. Tnx for the feedback.


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
Sign in to follow this  
Followers 0