Title

Message

Confirm

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

How to make a Macro paste a pinned item

Avatar from Gravatar.com
Leon André Bergman
49 discussion posts
I am in the process of setting up macros that navigate between text boxes.
Most of them I can use the BFS.Clipboard.PasteText for, but I have 1 field that changes, and it's a date/time field.
So I decided to set up a pinned item in the #1 slot, with the date and time I want to use every time the macro is run.
So if the date changes, I just change the pinned item, not the macro.

I assumed I could use one of the BFS.ClipboardFusion statements to do this, but if I use BFS.ClipboardFusion.GetLocalPinnedText(1); my current clipboard item is not updated. When I try to paste, it just pastes what ever I had copied before I ran the macro.

How can I make this work?

Alternatively, is there a way where I can just get the date, and set it to say 4 days from now, and paste that?
Jan 16, 2019  • #1
Keith Lammers (BFS)'s profile on WallpaperFusion.com
To get the pinned text in the first slot you need to use index 0, and you have to call BFS.Clipboard.SetText, like so:

BFS.Clipboard.SetText(BFS.ClipboardFusion.GetLocalPinnedText(0));


You can get the date in a macro as well. What format do you need the date to be in?
Jan 16, 2019  • #2
Avatar from Gravatar.com
Leon André Bergman
49 discussion posts
dd.mm.yy and if possible hh:mm:ss but not essential.
Jan 16, 2019  • #3
Keith Lammers (BFS)'s profile on WallpaperFusion.com
Ok, try this out:

Code

Jan 16, 2019  • #4
Avatar from Gravatar.com
Leon André Bergman
49 discussion posts
Nice. This works. Thank you for your help.
Jan 17, 2019  • #5
Keith Lammers (BFS)'s profile on WallpaperFusion.com
No worries, glad we could help!
Jan 17, 2019  • #6
Avatar from Gravatar.com
Leon André Bergman
49 discussion posts
Thanks again. This has been very helpfull. I want to make it skip weekends. Possibly holidays, I see some commands on stack overflow for AddBusinessDays, but that doesnt follow the syntax in use here. Is there a way to do it in the code you already made for me?
Mar 8, 2019  • #7
Keith Lammers (BFS)'s profile on WallpaperFusion.com
I'm not sure if this is the best way to do it, but it should work :)

Code

Mar 11, 2019  • #8
Avatar from Gravatar.com
Leon André Bergman
49 discussion posts
Maybe not, but it looks like it should work for me. Thanks a bunch.
Mar 12, 2019  • #9
Avatar from Gravatar.com
Leon André Bergman
49 discussion posts
Since it's friday, I've had a chance to try out your code, and I realized a limitation.
If I want to add 3 working days, it only adds 3 days, and sets monday, instead of seeing that its been a weekend, and adding another 2 days.
Mar 15, 2019  • #10
Thomas Malloch (BFS)'s profile on WallpaperFusion.com
I was able to put something together that should work for you. I've modified Keith's code a little to check for the weekend after each day, so the Macro should work if you run it on a weekend, or if the time you want to add spans for more than one week.

I hope this works for you!

Code

28 days ago (modified 28 days ago)  • #11
Was this helpful?  Login to Vote  Login to Vote
<< DiscussionsReply