Jump to content
Macro Express Forums

Lookup only business days


Recommended Posts

Hey Eveyrone,

I tried to find something on this, i found a few peaces here n there but nothing that has worked so far.

Is there a simple way of just looking for business days? I just want my macro to go back but use business days so search for a date and if it falls on a saturday/sunday then go forward 2 days and use that date instead.

Thanks in advance,

ali

 

 

Link to comment
Share on other sites

Actually never mind guys lol it was pretty easy, I create a date variable, then I subtract 31 days from that date variable and make a 1 month old date variable. I then if an IF statement that if the days are Sat/sunday then add 2 extra days. I could also theoretically do the same for holidays too.

 

Sharing with everyone just incase anyone else had this issue. f

Link to comment
Share on other sites

I usually convert the date to integer, add an offset, and divide by 7. The remainder indicates the day of the week. I can't remember the offset. Just write the macro, set the offset to zero, and then see how many days you have to count into the future to be right. That's your offset.

Link to comment
Share on other sites

Hey Cory,

Thanks for responding, I kinda did a ghetto job lol it works; http://i.imgur.com/9ubu1lR.pngsee screenshot

I didn't think something as simple as business days would be so much work around. They should have it built in so I am not manually copy pasting this for every time my macro needs to save files based on dates and to factor in business.

Link to comment
Share on other sites

I started writing macros to do short little things on my computer. Then I started using it more like a programming language. Eventually almost all of them were very complex and running on a VM invisibly. I was constantly writing things like this. At one point I had a whole web page of things I had done. (I only have a few of them ported over now to the new website.) It was all a silly waste of time. When you start pushing something like that you're using the wrong tool. A screwdriver is a great tool and technically you can hang drywall with it but when your wrist starts getting sore in 10 minutes you will realize you should be using a screw gun. And don't get me wrong. I have and use screwdrivers all the time. And they have a lot of benefits. They're compact, simple to use and require no training, no moving parts so they never break, they don't require batteries. In modern programming languages just about every thing anyone ever wants to do is already done. .NET Framework for instance has thousands of ready to use chunks of code that one can access with a simple function. I have demonstrated here how to write a bubble sort routine for arrays but it's costly. In .NET it's a simple function. MEP is based on a language that has these capabilities but it could never compete and I wouldn't want to see it get more complex. But it's natural that when you start using such a capable tool like MEP to want to push it. And you can a little. Just know there's a better tool out there.

Link to comment
Share on other sites

I started writing macros to do short little things on my computer. Then I started using it more like a programming language. Eventually almost all of them were very complex and running on a VM invisibly. I was constantly writing things like this. At one point I had a whole web page of things I had done. (I only have a few of them ported over now to the new website.) It was all a silly waste of time. When you start pushing something like that you're using the wrong tool. A screwdriver is a great tool and technically you can hang drywall with it but when your wrist starts getting sore in 10 minutes you will realize you should be using a screw gun. And don't get me wrong. I have and use screwdrivers all the time. And they have a lot of benefits. They're compact, simple to use and require no training, no moving parts so they never break, they don't require batteries. In modern programming languages just about every thing anyone ever wants to do is already done. .NET Framework for instance has thousands of ready to use chunks of code that one can access with a simple function. I have demonstrated here how to write a bubble sort routine for arrays but it's costly. In .NET it's a simple function. MEP is based on a language that has these capabilities but it could never compete and I wouldn't want to see it get more complex. But it's natural that when you start using such a capable tool like MEP to want to push it. And you can a little. Just know there's a better tool out there.

Hi Cory,

 

I agree MEP has it's limitations and great as a starter macro because it's easy to use and functional. It's like a personal macro maker without the need to dive into hardcore code, kinda like wordpress for websites minus the themes/plugins. It could still improve and expand it's reach by providing more collaboration for plugins, addons, and creating a market to make it deeper/richer like .NET. Everybody wins with that outcome.

Link to comment
Share on other sites

I didn't think something as simple as business days would be so much work around. They should have it built in so I am not manually copy pasting this for every time my macro needs to save files based on dates and to factor in business.

If it's something you have to do often, write a generalized macro that you can call ("run") whenever another macro needs the functionality. In the long run, it's easier than finding and copying the code every time you need it. Plus when you inevitably :P find a bug in your code, you only have to fix it in the one spot.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...