Jump to content

Copy/paste from InputBox


Recommended Posts

Hello people,im trying to use copy paste from imput box.

like that, if i do:

ctrl+1 (he send what i wrote on inputbox)

ctrl+2 (he send what i wrote on inputbox2)

but i dont "Send" but Paste!

can someone help me?

im new on autoit,and i cannot do that =(

Sorry my english and thanks for helping.

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=c:\documents and settings\reyzor\os meus documentos\form1.kxf


    
GUICreate("Form1", 335, 217, 192, 120)
$Nome = GUICtrlCreateLabel("NOME", 24, 24, 52, 17)
$NIF = GUICtrlCreateLabel("NIF", 24, 56, 37, 17)
$Servico = GUICtrlCreateLabel("SERVIÇO", 24, 88, 67, 17)
$SIMCARD = GUICtrlCreateLabel("SIMCARD", 24, 120, 69, 17)
$SimVDF = GUICtrlCreateLabel("SIMVDF", 24, 152, 60, 17)
$Input1 = GUICtrlCreateInput("Input1", 104, 24, 193, 21)
$Input2 = GUICtrlCreateInput("Input1", 104, 56, 193, 21)
$Input3 = GUICtrlCreateInput("Input1", 104, 120, 193, 21)
$Input4 = GUICtrlCreateInput("Input1", 104, 88, 193, 21)
$Input5 = GUICtrlCreateInput("Input1", 103, 149, 193, 21)
$Group1 = GUICtrlCreateGroup("Portabilidade", 0, 0, 329, 209)
$NOVO = GUICtrlCreateButton("Novo", 104, 176, 57, 25, $WS_GROUP)
;$Button2 = GUICtrlCreateButton("Fechar", 248, 176, 49, 25, $WS_GROUP)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)

#EndRegion ### END Koda GUI section ###

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
    Exit
Case $NOVO 
GUICtrlSetData($input1,"")
GUICtrlSetData($input2,"")
GUICtrlSetData($input3,"")
GUICtrlSetData($input4,"")
GUICtrlSetData($input5,"")

EndSwitch
WEnd
Link to comment
Share on other sites

  • Moderators

Reyzor,

You need some HotKeys that will react to Ctrl-1 and Ctrl-2: :mellow:

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

HotKeySet("^1", "_Send_1")
HotKeySet("^2", "_Send_2")

GUICreate("Form1", 335, 217, 192, 120)
$Nome = GUICtrlCreateLabel("NOME", 24, 24, 52, 17)
$NIF = GUICtrlCreateLabel("NIF", 24, 56, 37, 17)
$Servico = GUICtrlCreateLabel("SERVIÇO", 24, 88, 67, 17)
$SIMCARD = GUICtrlCreateLabel("SIMCARD", 24, 120, 69, 17)
$SimVDF = GUICtrlCreateLabel("SIMVDF", 24, 152, 60, 17)
$Input1 = GUICtrlCreateInput("Input1", 104, 24, 193, 21)
$Input2 = GUICtrlCreateInput("Input2", 104, 56, 193, 21)
$Input3 = GUICtrlCreateInput("Input3", 104, 120, 193, 21)
$Input4 = GUICtrlCreateInput("Input4", 104, 88, 193, 21)
$Input5 = GUICtrlCreateInput("Input5", 103, 149, 193, 21)
$Group1 = GUICtrlCreateGroup("Portabilidade", 0, 0, 329, 209)
$NOVO = GUICtrlCreateButton("Novo", 104, 176, 57, 25, $WS_GROUP)
;$Button2 = GUICtrlCreateButton("Fechar", 248, 176, 49, 25, $WS_GROUP)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $NOVO
            GUICtrlSetData($Input1, "")
            GUICtrlSetData($Input2, "")
            GUICtrlSetData($Input3, "")
            GUICtrlSetData($Input4, "")
            GUICtrlSetData($Input5, "")

    EndSwitch
WEnd

Func _Send_1()
    ConsoleWrite(GUICtrlRead($Input1) & @CRLF)
EndFunc

Func _Send_2()
    ConsoleWrite(GUICtrlRead($Input2) & @CRLF)
EndFunc

At the moment, the HotKeys just write to the SciTE console - you will need to use Send(GUICtrlRead($Input*)) in place of the ConsoleWrite lines. :(

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

At the moment, the HotKeys just write to the SciTE console - you will need to use Send(GUICtrlRead($Input*)) in place of the ConsoleWrite lines. :mellow:

M23

For example, this will paste the text while preserving the contents of the clipboard:

Func _Send_1()
    Local $sData = ClipGet()
    ClipPut(GUICtrlRead($Input1))
    Send("^v")
    ClipPut($sData)
EndFunc

Func _Send_2()
    Local $sData = ClipGet()
    ClipPut(GUICtrlRead($Input2))
    Send("^v")
    ClipPut($sData)
EndFunc

@Edit: Had an extra autoit tag

Edited by Skruge

[font="Tahoma"]"Tougher than the toughies and smarter than the smarties"[/font]

Link to comment
Share on other sites

Reyzor,

You need some HotKeys that will react to Ctrl-1 and Ctrl-2: :mellow:

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

HotKeySet("^1", "_Send_1")
HotKeySet("^2", "_Send_2")

GUICreate("Form1", 335, 217, 192, 120)
$Nome = GUICtrlCreateLabel("NOME", 24, 24, 52, 17)
$NIF = GUICtrlCreateLabel("NIF", 24, 56, 37, 17)
$Servico = GUICtrlCreateLabel("SERVIÇO", 24, 88, 67, 17)
$SIMCARD = GUICtrlCreateLabel("SIMCARD", 24, 120, 69, 17)
$SimVDF = GUICtrlCreateLabel("SIMVDF", 24, 152, 60, 17)
$Input1 = GUICtrlCreateInput("Input1", 104, 24, 193, 21)
$Input2 = GUICtrlCreateInput("Input2", 104, 56, 193, 21)
$Input3 = GUICtrlCreateInput("Input3", 104, 120, 193, 21)
$Input4 = GUICtrlCreateInput("Input4", 104, 88, 193, 21)
$Input5 = GUICtrlCreateInput("Input5", 103, 149, 193, 21)
$Group1 = GUICtrlCreateGroup("Portabilidade", 0, 0, 329, 209)
$NOVO = GUICtrlCreateButton("Novo", 104, 176, 57, 25, $WS_GROUP)
;$Button2 = GUICtrlCreateButton("Fechar", 248, 176, 49, 25, $WS_GROUP)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $NOVO
            GUICtrlSetData($Input1, "")
            GUICtrlSetData($Input2, "")
            GUICtrlSetData($Input3, "")
            GUICtrlSetData($Input4, "")
            GUICtrlSetData($Input5, "")

    EndSwitch
WEnd

Func _Send_1()
    ConsoleWrite(GUICtrlRead($Input1) & @CRLF)
EndFunc

Func _Send_2()
    ConsoleWrite(GUICtrlRead($Input2) & @CRLF)
EndFunc

At the moment, the HotKeys just write to the SciTE console - you will need to use Send(GUICtrlRead($Input*)) in place of the ConsoleWrite lines. :(

M23

im trying to use:

HotKeySet("{F4}", "conf123")

Func conf123()

Send(GUICtrlRead($Input1) & @CRLF)

EndFunc

and:

HotKeySet("{F4}", "conf123")

Func conf123()

ConsoleWrite(GUICtrlRead($Input2) & @CRLF)

EndFunc

just for test and still not working..its hard programming =S

thanks and im sorry if i dont understand.

i need to change Local $sdata for another $example?

Edited by Reyzor
Link to comment
Share on other sites

im trying to use:

HotKeySet("{F4}", "conf123")

Func conf123()

Send(GUICtrlRead($Input1) & @CRLF)

EndFunc

and:

HotKeySet("{F4}", "conf123")

Func conf123()

ConsoleWrite(GUICtrlRead($Input2) & @CRLF)

EndFunc

just for test and still not working..its hard programming =S

thanks and im sorry if i dont understand.

Are you running that as a test script by itself or in the main script?

If it's a script by itself it's because the script is ending before the Hotkey is pressed, so add a sleeping loop in there.

For those who are asking questions, look in the help file first. I'm tired of people asking stupid questions about how to do things when 10 seconds in the help file could solve their problem.[quote name='JRowe' date='24 January 2010 - 05:58 PM' timestamp='1264381100' post='766337'][quote name='beerman' date='24 January 2010 - 03:28 PM' timestamp='1264372082' post='766300']They already have a punishment system for abuse.[/quote]... and his his name is Valik.[/quote]www.minikori.com

Link to comment
Share on other sites

I just want use that for working in my job,but i think is a main script,i don´t know =S..

But i dont understand how i can do that, for copy(phrase inside inputbox) and paste in other document with a key..

Link to comment
Share on other sites

  • Moderators

Reyzor,

To what application are are you trying to Send the contents of the Inputs? If you let us know that, we can try and help a bit more. :mellow:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

I want to paste what i wrote in imputbox in programs like excell,word,wordpad,Webpages and more.

Example:

Inputbox1 = abcde

And using hotkey, when i click F2, he past the phrase(abcde) when i want and where i want in programs..But i want to past,not to send.. is possible?

Link to comment
Share on other sites

  • Moderators

Reyzor,

This script will put the text in the input into whatever is active when you press F2. I have tested it with Word, Excel, IE and a few others: :(

#include <GUIConstantsEx.au3>

HotKeySet("{F2}", "Paster")

$hGUI = GUICreate("Test", 500, 500)

$hInput = GUICtrlCreateInput("", 10, 10, 200, 20)

GUISetState()

While 1

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch

WEnd

Func Paster()

    $sText = GUICtrlRead($hInput)
    Send($sText)

EndFunc

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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...