Adding Copy button to copy selected text

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
carno
Posts: 265
Joined: 20 Jun 2014, 16:48

Adding Copy button to copy selected text

11 Feb 2019, 00:17

I have a fully functioning code except for the Copy button that is not functioning as expected. Expected function is to copy any selected text in the "lower box" that currently contains this text (but could be any other text): En/Decrypted text appears here and is also copied to the clipboard! I would like to select some partial text in the lower box and then click on the Copy button to copy the selected text to clipboard.

Code: Select all

; http://autohotkey.com/board/topic/90702-encrypt-decrypt-text/
; https://www.autohotkey.com/boards/viewtopic.php?t=5838

; ===================================================================================
; AHK Version ...: AHK_L 1.1.11.01 x64 Unicode
; Win Version ...: Windows 7 Professional x64 SP1
; Author ........: Originated from jNizM, tweaked by Soft
; Script ........: EnCrypt_DeCrypt.ahk
; Description ...: Encrypt & Decrypt Data
; License .......: WTFPL
; ===================================================================================

; GLOBAL SETTINGS ===================================================================

#NoEnv
#SingleInstance force

#Include Crypt.ahk
#Include CryptConst.ahk
#Include CryptFoos.ahk

; SCRIPT ============================================================================

Gui, Margin, 10, 10
Gui, Font, s10, Segoe UI

Gui, Add, Edit, xm ym w300 h120 vStr hwndEditEnDecrypt, Enter text or drag file to en/decrypt here.

Gui, Add, Edit, xm y+5 w300 vStr2, Password
;Gui, Add, Edit, xm y+5 w300 vStr2 hwndEditPw,
;EM_SetCueBanner(EditPw, "Password")
Gui, Add, Edit, xm y+10 w300 h120 vEnDeCrypt ReadOnly, En/Decrypted text appears here and is also copied to the clipboard!

Gui, Add, DropDownList, xm y+5 w300 AltSubmit vEncryption, RC4 (Rivest Cipher)
    |RC2 (Rivest Cipher)
    |3DES (Data Encryption Standard)
    |3DES 112 (Data Encryption Standard)
    |AES 128 (Advanced Encryption Standard)
    |AES 192 (Advanced Encryption Standard)
    |AES 256 (Advanced Encryption Standard)||
Gui, Add, Button, xm-1 y+5 w100, Encrypt
Gui, Add, Button, xm+201 yp w100, Decrypt
Gui, +LastFound
Gui, Show,, En/Decrypt
WinSet, Redraw
Return

ButtonCopy:
    Gui, Submit, NoHide
    GuiControl,, Copy, Copy
    Send, ^c
Return

ButtonEncrypt:
    Gui, Submit, NoHide
    GuiControl,, EnDeCrypt, % Crypt.Encrypt.StrEncrypt(Str, Str2, Encryption, 1)
    Clipboard := % Crypt.Encrypt.StrEncrypt(Str, Str2, Encryption, 1)
Return

ButtonDecrypt:
    Gui, Submit, NoHide
    GuiControl,, EnDeCrypt, % Crypt.Encrypt.StrDecrypt(Str, Str2, Encryption, 1)
    Clipboard := % Crypt.Encrypt.StrDecrypt(Str, Str2, Encryption, 1)
Return

GuiDropFiles:
if A_GuiControl = Str
{
    Draged := FileOpen(A_GuiEvent, "r")
    GuiControl,, Str, % Draged.Read()
 
}
Return

; EXIT ==============================================================================

GuiClose:
GuiEscape:
ExitApp

EM_SetCueBanner(hWnd, Cue)
{
    Static EM_SETCUEBANNER := 0x1501
    Return DllCall("User32.dll\SendMessage", "Ptr", hWnd, "UInt", EM_SETCUEBANNER, "Ptr", True, "WStr", Cue)
}

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Google [Bot], Spawnova and 288 guests