Clipboard Code Issue / Help  SOLVED

User-to-User discussion about the PhraseExpress macro programming.
Post Reply
Posts: 2
Joined: 16 Sep 20, 09:38

Clipboard Code Issue / Help

Post by Yam » 16 Sep 20, 10:48

Hello there!

I am trying to port my all in one clipboard solution from C# to Phrase Express which allows one keyboard key to act as a copy, and paste tool; Copy if text is highlighted, and paste if text is not highlighted.

The concept is generally easy, and allows you to scale to multiple keys to make auto populating forms, data, or even variable phrases a breeze.
  • Backup the clipboard.
  • Clear the clipboard.
  • Send Ctrl C
  • If the clipboard returns with nothing: (That would indicate no text was selected) - Paste previously assigned variable, else store the captured text to an assigned variable.
  • Restore clipboard from backup.

However, I've been caught on a snag. Clearing the clipboard clears all variables attached to it. The Clipboard Backup is always deleted if it is AFTER {#setclipboard}.

I have tried waits and nested statements with no luck. Hope one of you experts might have the answer.

Any help is deeply appreciated!

Hotkey: Num1
Use: Highlight some text in a notepad, Press the hotkey, It will process the sample code below. Then remove "{#setclipboard}"

Code: Select all

{#clipboard -copy}{#set -name clipbkup -content {#clipboard -paste}}{#setclipboard}

Bkup:  {#gettemp clipbkup} <--- The Value to restore to the clipboard after execution
Clip:  {#clipboard -paste} <--- The clipboard after the completion

(Rest of code to execute with those variables here)

Peter Stotz
PhraseExpress Expert
Posts: 897
Joined: 27 Feb 08, 15:07

Post by Peter Stotz » 16 Sep 20, 20:21

Hi Yam,
for your information:
1. some very useful applications for PhraseExpress are available as „free add ons“

2. the attached file „Direktwahltasten CTRL+0 bis CTRL+9.pxp“ is an example of a direct key application
The macro program set works with the hotkeys CTRL+0 to CTRL+9.
Test it and adapt it if necessary.
Direktwahltasten CTRL+0 bis CTRL+9.pxp
Windows 10 - PhraseExpress v15.0.66RC
You do not have the required permissions to view the files attached to this post.

Posts: 2
Joined: 16 Sep 20, 09:38

Post by Yam » 17 Sep 20, 01:00

Hi Peter,

That is a perfect example of what I'm trying to build. Thank you for your reply and that exceptional insight!

All the best for the rest of 2020!

Post Reply