Jump to content

Copy - paste with hotkeys


erikson
 Share

Recommended Posts

You already found the solution :)

Open the AutoIt help and search for "Hotkey". If you need example scripts please search the forum for "hotkey" or even "hotkey copy paste".

This will get you started.

If you then have some code and still have questions please post question and code and we will try to help.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Ok, to get you started. I use the following code in my scripts to mimic Ctrl+A (mark all) and Ctrl+C (copy to clipboard):

; Set two Dummy fields in the GUI
Global $hButtonStrgA = GUICtrlCreateDummy()
Global $hButtonStrgC = GUICtrlCreateDummy()

; Set accelerators for Strg+a and Strg+c
Global $asAccelKeys[2][2] = [["^a", $hButtonStrgA],["^c", $hButtonStrgC]]
GUISetAccelerators($asAccelKeys)

While 1
    $vMsg = GUIGetMsg(1)
        Case $vMsg[0] = $hButtonStrgA
            _SelectAll()
        Case $vMsg[0] = $hButtonStrgC
            _Clipboard()
    EndSelect
WEnd

Func _SelectAll()

    ; Mark all Entries in SysListView
    If ControlGetFocus($hForm1) = "SysListView321" Then
        _GUICtrlListView_SetItemSelected($hGUIUserList, -1, True)
    EndIf

EndFunc ;==>_SelectAll

Func _Clipboard()

    ; Copy selected items to clipboard
    $vZf = _GetSelectedItems()
    If $vZf = "" Then
        MsgBox(16, $sFormTitle, "Sie haben keine Datensätze ausgewählt!")
        Return
    EndIf

    ClipPut(StringStripWS($vZf, 2))

EndFunc ;==>_Clipboard

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

So i figured out a little bit

hotkeyset ("{ESC}", "copy")
sleep (100)

func copy()
Send("{LCTRL}") ;Holds the A key down
send ("{c}" )
Send("{LCTRL}") ;Releases the A key

endfunc
$bak = ClipGet()
MsgBox(0, "Clipboard contains:", $bak)


$file= "G:\1.txt"
fileopen ($file, 1)
filewrite ($file , $bak )
fileclose ($file)

the question is , how do i make to run function only when i press ESC key

Link to comment
Share on other sites

Yes, this is just a code snipped and no complete solution for your problem.

The snipped shows how to establish CTRL+A and CTRL+C in a GUI. The functions _SelectAll and _Clipboard are tailored to my needs. They definitely have to be adapted by you.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

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