Command/Icon to copy formatted (RTF) text from Preview/Sample pane to paste into other applications

Got a request? Post it here. Please do not post bug reports here.
Post Reply
cadudesun
Posts: 5
Joined: Mon Aug 24, 2020 11:07 pm

Command/Icon to copy formatted (RTF) text from Preview/Sample pane to paste into other applications

Post by cadudesun »

Hi,

As shared at the bottom of this thread, I developed an AutoHotkey script that "copy formatted Preview/Sample to paste into other applications".

This is a very convenient functionality since I can paste directly into third-party applications (e.g. image/video editors) the font already chosen in MainType.

I mean, I don't even need to touch the third-party font menu as shown in this screencast: https://bit.ly/2Fdl1FM

I'm suggesting that MainType provides this functionality natively, by adding an icon command on the "Main View toolbar" and on the "Sample Pane toolbar", also assigned the shortcut Ctrl+Shift+C to copy formatted (RTF) Preview/Sample text.

An interface draft - with the suggested icon command - is shown in the images below:
Preview.png
Preview.png (20.12 KiB) Viewed 7026 times
In my use case, 90% of the time I would copy the formatted text from the "Main View toolbar"


Sample.png
Sample.png (13.09 KiB) Viewed 7026 times
10% of the time I would copy from the Sample pane.



Because of that, I'm suggesting the command to be placed in both toolbars.

Regarding the AutoHotkey script, it is a workaround for now to emulate the functionality.
It performs the following by pressing the hotkey Ctrl+Shift+C:
1- If the focus is on the "Sample Pane", it will select all text and copy it to the clipboard.
2- If the focus is elsewhere, it will put the focus on the "Main View toolbar" text box, copy and paste the text from there to the "Sample Pane", since it is the only place you can copy RTF text out of MainType, which is performed in the last script step.
3- Then just open your preferred third-party application that accepts Formatted/RTF text and paste.

There are some heads-up with the script, though:
Initially, I was going to provide a compiled .exe file that could be run by any user without being necessary to know AutoHotkey script language.
However, depending on MainType's layout, its core controls - text box on Main View toolbar and the Sample pane - used by the script change their names automatically.
For instance, the Sample pane can be treated by MainType either as "TMemo1" or "TMemo2". What gets more confusing to be handled by the script because these same control classes (AHK terminology) can be assigned to the "Note Pane" as well.
And the preview text box on the Main View toolbar can be treated as Edit3, Edit4, Edit5, Edit6, as far I could observe.
So in order for the script to work properly, you need to check how these control classes are being shown in your MainType and adapt the script before using it.
For identify the control class, use the AutoHotkey in-built "Window Spy", as shown in the screencast: https://bit.ly/2Fdl1FM
Because of that unfortunately I couldn't create a compiled .exe script that would work for every situation.

I hope MainType developers can consider the implementation of the functionality natively.
Thank you,
Cadu

----------------------------------

Code: Select all

;AutoHotkey script to copy formatted (RTF) text from Preview/Sample pane
#IfWinActive, ahk_class TMainFormMainType
^+c::
ControlGetFocus, ControlName, ahk_class TMainFormMainType
    if (ControlName = "TMemo1") ; Sample Pane - Modify according your MainType
    {
        send, ^a
        sleep 50
        send, ^c
        sleep 50
        send, {right}        
    }
    else
    {
        ControlClick, Edit3 ; Preview text box in Main View toolbar - Modify according your MainType
        send, ^a
        sleep 50
        send, ^c
        sleep 50
        ControlClick, TMemo1 ; Sample Pane - Modify according your MainType
        send, ^a
        sleep 50
        send, ^v
        sleep 50
        send, ^a
        sleep 50
        send, ^c
        sleep 50
        send, {right}
    }
Return
#If
Post Reply