conditional help

Share your favorite FastKeys commands
Post Reply
abg0201
Posts: 11
Joined: Dec 25th, ’23, 09:00

Post by abg0201 » Mar 22nd, ’24, 08:22

I am struggling to achieve something that I feel is very do-able but I appear to be somewhat inept! Hoping for some guidance please.

I have a start menu item that writes the text 'The medication we discussed today and is available to buy over the counter was' and the I have a checkbox listing about 30 items as a %SELECT_drugs%.

I would like to change to final word of the text string based on the number of items checked, eg 'was' for one drug, and 'are' for more than one.

Please can someone be kind enough to handhold me through writing this?

Thanks

Andy.
User avatar
Tom
Posts: 897
Joined: Nov 24th, ’15, 23:39

Post by Tom » Mar 23rd, ’24, 14:49

You can use "Insert Command Code" macro to have the full flexibility:

The medication we discussed today and is available to buy over the counter %CODE_Condition%: %SELECT_Drugs%

If you are using comma as selection delimiter then the CODE_Condition can check if the selection contains comma or word "and":

Code: Select all

if InStr(SELECT_Drugs, ",") or InStr(SELECT_Drugs, " and ")
	Send, are
else
	Send, was
abg0201
Posts: 11
Joined: Dec 25th, ’23, 09:00

Post by abg0201 » Mar 25th, ’24, 07:05

Fantastic thanks Tom, that’s just what I was looking for!

Andy.
Post Reply