Title

Message

Confirm

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

Stringing macros together based on copied text

Avatar from Gravatar.com
Leon André Bergman
49 discussion posts
Hi. I'm looking for a way to make my macros a bit smarter.
I would like to make a macro copy a text from a field in a form (I already have this set up) and use this text to decide what macro to run.

So say I copy text A, the macro will run the next macro named A.
If the text is B, then it will run Macro B, and so on.

Is this possible?
Aug 15, 2019  • #1
Keith Lammers (BFS)'s profile on WallpaperFusion.com
Sure! There are a couple of ways you could do this. You could create Trigger rules that look for the specific text and then run the appropriate Macro.

Alternatively, you could do it in a Macro, like this:

Code

Aug 15, 2019 (modified Aug 15, 2019)  • #2
Avatar from Gravatar.com
Leon André Bergman
49 discussion posts
I'm sorry for the late reply. That seems to work perfectly. Thank you very much.
Aug 21, 2019  • #3
Keith Lammers (BFS)'s profile on WallpaperFusion.com
No worries, glad to hear it!
Aug 21, 2019  • #4
Avatar from Gravatar.com
Leon André Bergman
49 discussion posts
I've finaly had time to try and implement this into my workflow, but it's not actually working now.

I've set it up like this.

Code



It is able to move the mouse to the correct position, mark the text, and copy it(i assume), but it's not running the macro, even though the copied text contains "ping"
It's not doing anything. It just ends without any errors.
Aug 30, 2019  • #5
Thomas Malloch (BFS)'s profile on WallpaperFusion.com
I put together something that should work for you. All I did was modify your code a little.

The reason your Macro wasn't working is because when a Macro is run, the "text" variable contains the text that was in the Clipboard at the time when the Macro first runs. It doesn't change again automatically, unless you change it yourself :).

So the only real change I made to your Macro was on line 12. I change the

Code


to

Code



Anyways, here's the code!

Code

Sep 3, 2019  • #6
Avatar from Gravatar.com
Leon André Bergman
49 discussion posts
Oh. I see. That makes sense then. I'll try this one out. Thank you.
Sep 30, 2019  • #7
Avatar from Gravatar.com
Leon André Bergman
49 discussion posts
Yep. That seems to work. But I've just realized I need to actually check for if text contains, not if it equals. I guess I can add a scrubbing of the text it copies, but is there maybe an easier way of implementing into the if statement?
Sep 30, 2019  • #8
Keith Lammers (BFS)'s profile on WallpaperFusion.com
You can change it from:
if (text == "ping")


to:
if (text.Contains("ping"))


Hope that helps!
Oct 1, 2019  • #9
Was this helpful?  Login to Vote  Login to Vote
<< DiscussionsReply