Script for returning week number

General Macro Scheduler discussion

Moderators: Dorian (MJT support), JRL

Post Reply
atapper
Newbie
Posts: 18
Joined: Wed Dec 17, 2008 2:10 pm
Location: Minnesota,USA

Script for returning week number

Post by atapper » Fri Dec 19, 2008 9:45 pm

Does anybody have a script or even a good idea on how to get the current week number? ie. this was posted during week 51.

I am hoping that my EU Macro Scheduler brethren have already solved this problem.

Thanks in advance.
Andrew Tapper
Engineering Manager
Forward Technology
Cokato, MN

User avatar
Marcus Tettmar
Site Admin
Posts: 7380
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Fri Dec 19, 2008 10:11 pm

VBSTART
VBEND

VBEval>datepart("ww",date()),weeknumber
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

conjure
Pro Scripter
Posts: 63
Joined: Thu Jan 12, 2012 3:05 pm

Re: Script for returning week number

Post by conjure » Wed Apr 06, 2016 7:12 am

i m trying to get the week number but i m getting
syntax error
line 5 column 6
any ideas why?i m using MS13

hagchr
Automation Wizard
Posts: 327
Joined: Mon Jul 05, 2010 7:53 am
Location: Stockholm, Sweden

Re: Script for returning week number

Post by hagchr » Wed Apr 06, 2016 7:43 am

Probably trailing spaces after VBSTART and VBEND that should not be there?

conjure
Pro Scripter
Posts: 63
Joined: Thu Jan 12, 2012 3:05 pm

Re: Script for returning week number

Post by conjure » Wed Apr 06, 2016 8:31 am

hehehehe :oops: thank you :)

User avatar
CyberCitizen
Automation Wizard
Posts: 721
Joined: Sun Jun 20, 2004 7:06 am
Location: Adelaide, South Australia

Re: Script for returning week number

Post by CyberCitizen » Tue Jun 07, 2016 4:27 am

I need a way of returning what the date would be on Sunday every week.

Eg so if I run the script today I need to know what Sunday's date would be.
FIREFIGHTER

hagchr
Automation Wizard
Posts: 327
Joined: Mon Jul 05, 2010 7:53 am
Location: Stockholm, Sweden

Re: Script for returning week number

Post by hagchr » Tue Jun 07, 2016 8:43 am

Hi, DayOfWeek> will give you which day it is today (Sun = 1). Today is Tue ie the weekday is 3, then you need to add 5 days (7-3+1) to today's date to get Sunday's date. Or do you need next Sunday's date given a specific date or week number?

User avatar
CyberCitizen
Automation Wizard
Posts: 721
Joined: Sun Jun 20, 2004 7:06 am
Location: Adelaide, South Australia

Re: Script for returning week number

Post by CyberCitizen » Tue Jun 07, 2016 10:14 am

I need to be able to open a file say today and know what the date is on Sunday.

I then need to be able to open it in 2 days and know the date for Sunday.
FIREFIGHTER

hagchr
Automation Wizard
Posts: 327
Joined: Mon Jul 05, 2010 7:53 am
Location: Stockholm, Sweden

Re: Script for returning week number

Post by hagchr » Tue Jun 07, 2016 1:28 pm

Will this work?

Code: Select all

DayOfWeek>daytoday
Let>DaystoSun={7-%daytoday%+1}

GetDate>currDate
DateAdd>currDate,D,DaystoSun,strSunDate
MDL>Next Sunday: %strSunDate%

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts