Title

Message

Confirm

Want to earn a free ClipboardFusion Pro license? We're looking for ClipboardFusion translators!
<< DiscussionsReply

how to execute macros automatically?

Avatar from Gravatar.com
arubin
3 discussion posts
I have found this old (3.5 years ago) thread https://www.clipboardfusion.com/Discussions/View/running-a-macro-automatically/?ID=627d5b82-c5b5-46f0-b076-f31d0d1adfc4 that asked almost the same what I want to ask now.

So, now after 3 and a half years, is it possible to make a macro to be triggered automatically when some text is put into the clipboard?

Example: I have a macro that does a text transformation and it has a Alt+F9 hotkey. I have to do the following steps:
1) select the desired text
2) Ctrl+C
3) Alt+F9
4) Ctrl+V

Desired workflow:
1) select the desired text
2) Ctrl+C (an automated macro executes immediately after the text gets to clipboard)
3) Ctrl+V (the modified text is pasted)

As a suggestion, it would be very useful to have the following feature:
1) all the macros to be ordered (and maybe numbered) with an order from the top one decreasing to the bottom one
2) every macro to have a flag/checkbox that would enable/disable it for an automated execution when anything is put into clipboard
3) when something is put into clipboard, all the enabled macros are executed from top to bottom (as a chain, every next macro works with the output of the previous one)
4) every macro can have a hotkey as they have now, so it's enough to have a macro "disabled" with a set hotkey in order to have exactly the same behaviour as now
Dec 2, 2015  • #1
Keith Lammers (BFS)'s profile on WallpaperFusion.com
It's not possible to automatically trigger a macro with Ctrl + C, but you can actually automate steps 2, 3, and 4. I'm assuming you're selecting the text, transforming it, and replacing the text with the transformed text? If so, you can use these lines in the script to copy the text before the transform, and paste it back when it's done:

Code



This way you just need to highlight the text, then press the hotkey for your macro and it will replace the text with the transformed text.

Hope that helps!
Dec 3, 2015  • #2
Avatar from Gravatar.com
arubin
3 discussion posts
Thank you for your reply.

Yes, I tried to use this BFS.Clipboard.CopyText() method call, but it's not so good as I would to be.
There are several aspects that make ths workaround not so suitable:

1) the text is "moved" (and transformed) form one place to another one, so just highlighting the text and pressing a hotkey is not possible (but could work very well for other cases, so your solution is good for something slightly different)

2) it could seem to be a insignificant aspect, but it's not: the position of fingers and wrist is important when doing some work with the keyboard, so keeping the hand in one position and pressing Ctrl+C and Ctrl+V is easy and just the index finger moves a few millimeters left-rigt; assigning a hotkey to a macro basically means to have something located inconveniently compared to Ctrl+V and it make a big difference in productivity because there are hundreds or maybe thousands of these text movements

3) probably the most important one: it doesn't work consistently. Sometimes it works, sometimes it doesn't. I didn't analyze it in more details because I have found a workaround with a 3rd part tool that goes deep inside the system when working with hotkeys, so I had to assign a macro to Ctrl+C with that tool that does more than copy.

While it's possible to get the desired result, it's unnaturally to use a bunch of tools that goes deep into the system to achieve this while it could be possible to have it easely in one tool. So, if the propuct is still developed, maybe that suggestion with automatic macros could be added. It will not hurt for sure while adding something useful.

I'll try to have a reproducible scenario when this BFS.Clipboard.CopyText() call doesn't work. I'll be back.
Dec 4, 2015  • #3
Avatar from Gravatar.com
arubin
3 discussion posts
Ok, so here is my scenario:

1) start ClipboardFusion (there are no macros registered)
2) go to Macros tab (tray MRC -> Macros -> Manage Macros)
3) click "Add"
4) Name = "m1", Language = "C#", Description = "test1", HotKey = "Ctrl+F8", code =

Code


Note: while I'm in the code editor window, the macro works correctly: I select some portion of text, then I click "Test Macro" and I get the correct "[[.......]]" result in the gray result box
5) OK -> Apply -> OK
6) open "notepad" and write there some random text like "ahgskdagajsdg"
7) select any portion of text from there (for example "gskd") and press Ctrl+F8
8) go to another row or another notepad window and press Ctrl+V; result: "[[gskd]]" is pasted, so everything is OK now
9) select another portion of text (for example "ahg") and press Ctrl+F8
10) go to a position where the text can pe pasted, press Ctrl+V; result: the old "[[gskd]]" is pasted instead of the correct "ahg" - WRONG!
11) now open the Macros tab again (tray MRC -> Macros -> Manage Macros)
12) do nothing to the macro, just press the "Apply" button there and close the windows
13) go to the notepad text, select for example "sdg" and press Ctrl+F8
14) go to a position where the text can pe pasted, press Ctrl+V; result: "[[sdg]]" is pasted, CORRECT!
15) go to the notepad text, select any different text and press Ctrl+F8
16) go to a position where the text can pe pasted, press Ctrl+V; result: "[[sdg]]" is pasted, WRONG, the old text is pasted again

Conclusion: for some reasons the macro works correctly only for the first time and this behaviour can be reset by going to the Macros tab and pressing "Apply" or by normally copying a text to clipboard with the standard Ctrl+C.
Dec 4, 2015  • #4
Keith Lammers (BFS)'s profile on WallpaperFusion.com
Ok, thanks for the extra feedback on the usage case. It looks like we do have this on our feature request list still, so I've added your vote to it. We'll definitely let you know if we're able to implement it in a future version.

Regarding the other issue with the CopyText function, can you try enabling the "Allow Macros to be run multiple times" option on the Settings > Macros tab?
Dec 4, 2015  • #5
Avatar from Gravatar.com
jeanpaulruche
1 discussion post
I was needing this function and thought it was possible... can arudin guide me on the deep system way of doing this [if allowed] if this function will not be available soon... thanks... To apply a [selectable] chain of macros [preferably with ctrl+c as option] is a vital addition to your excellent product... also (a bit off topic) could the pre-made macros be downloadable as one file from the net? Thanks for a prompt reply! enjoying your product already!
JPr
Jul 31, 2016  • #6
Keith Lammers (BFS)'s profile on WallpaperFusion.com
The latest beta version of ClipboardFusion now has a "Triggers" tab in the Settings where you can setup rules for scrubbing text, and the rules can run multiple actions, including multiple macros :)

If you have a chance to try it out, please let us know if you run into any issues.

Thanks!
Jul 3, 2017  • #7
Was this helpful?  Login to Vote  Login to Vote
<< DiscussionsReply