Jump to content
Sign in to follow this  

A simple text pasting GUI application

Recommended Posts

I am trying to develop a simple application which will accept text in a text box as input, stay on top and paste the same text to an application to another which can be switched the focus to. Essentially it is a variant of On-Screen-Keyboard type application. Below is my code. It is not working in a sense that the "Paste" function not working properly. Can someone please point out my mistake?

#include <GUIConstantsEx.au3>
#include <GUIConstants.au3>
#include <MsgBoxConstants.au3>

Opt("GUIOnEventMode", 1)

Local $hMainGUI = GUICreate("Text Paste", 700, 300, -1, -1, -1, BitOR($WS_EX_TOOLWINDOW, $WS_EX_TOPMOST, $WS_EX_NOACTIVATE))
;WinSetOnTop($hMainGUI, "", 1)
Local $btnPasteButton = GUICtrlCreateButton("Paste", 300, 250, 100)
$txtText = GUICtrlCreateEdit("", 50, 30, 600, 200)

GUICtrlSetOnEvent($btnPasteButton, "PasteButton")
GUISetOnEvent($GUI_EVENT_CLOSE, "CloseButton")
GUISetState(@SW_SHOW, $hMainGUI)

While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop

Func PasteButton()
    Local $txtData = ControlGetText("", "", $txtText)
    ;$txtData = "Dip"
    Send($txtData, 0)
    MsgBox($MB_SYSTEMMODAL, "Pasted!!!", $txtData)

Func CloseButton()

[size="2"][font="arial, verdana, tahoma, sans-serif"]ProtectData - A Data Protection software for floppies[/font][/size] [size="2"][hr][/size][size="2"]Sessionchange - A Windows service capable of tracking session change events[/size][size="2"][b][/b][/size]

Share this post

Link to post
Share on other sites

Why not try



Snips & Scripts

My Snips: graphCPUTemp ~ getENVvars
My Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4

Feel free to use any of my code for your own use.                                                                                                                                                           Forum FAQ


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  

  • Create New...