Search found 277 matches

by hagchr
Thu Jun 09, 2016 7:07 am
Forum: Beginners
Topic: list certain extensions only
Replies: 5
Views: 4928

Re: list certain extensions only

Overkill here, but I was just curious how one could do it in the DOS world. From strList one can easily extract the file info. IfFileExists>%TEMP_DIR%tmplist.txt DeleteFile>%TEMP_DIR%tmplist.txt Endif Let>string=*.exe *.bat *.com ChangeDirectory>c:\temp\ Let>RP_WAIT=1 Run>cmd /C dir %string% >> "%TE...
by hagchr
Thu Jun 09, 2016 5:29 am
Forum: Beginners
Topic: list certain extensions only
Replies: 5
Views: 4928

Re: list certain extensions only

Hi, my solution was very similar, however kept the ; as delimiter. For a general solution one could put the extensions into a string, eg Let>str=exe;bat;com... , then parse with Separate> and loop. Alternative put it into a SRT> with desirable extensions as parameter. Let>path=c:\temp\ GetFileList>%...
by hagchr
Wed Jun 08, 2016 8:22 am
Forum: Beginners
Topic: PivotTable Values problem (VB-related)
Replies: 9
Views: 7104

Re: PivotTable Values problem (VB-related)

You need to add this: For Each pf In PTWorkSheet.PivotTables(PTName).DataFields If Not pf Is Nothing Then With pf .Function = xlSum End With End If Next So all in all, something like this: VBSTART Sub CreatePivotTable(File,MaxRows) xlMaxRows="M"+MaxRows SourceRange="A13:"+xlMaxRows xlRowField=1 xlCo...
by hagchr
Tue Jun 07, 2016 1:45 pm
Forum: Technical / Scripting
Topic: XLSET Date Issue (American Format)
Replies: 4
Views: 2415

Re: XLSET Date Issue (American Format)

I originally had the same problem as you, but with the code above, if I choose eg dd/mm/yy as format in excel then that is the way the data is presented after the script has run. Have you changed the cell format in excel since you ran it before? Otherwise you possibly still have the American format ...
by hagchr
Tue Jun 07, 2016 1:28 pm
Forum: General Discussion
Topic: Script for returning week number
Replies: 8
Views: 9880

Re: Script for returning week number

Will this work?

Code: Select all

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

GetDate>currDate
DateAdd>currDate,D,DaystoSun,strSunDate
MDL>Next Sunday: %strSunDate%
by hagchr
Tue Jun 07, 2016 8:43 am
Forum: General Discussion
Topic: Script for returning week number
Replies: 8
Views: 9880

Re: Script for returning week number

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?
by hagchr
Tue Jun 07, 2016 8:32 am
Forum: Technical / Scripting
Topic: XLSET Date Issue (American Format)
Replies: 4
Views: 2415

Re: XLSET Date Issue (American Format)

Hi, probably something relating to the regional settings? For me this would usually work: GetDate>vTodaysDate DateAdd>vTodaysDate,D,5,vSundayDate DatePart>vSundayDate,Y,yyyy DatePart>vSundayDate,M,mm DatePart>vSundayDate,D,dd Let>date=%yyyy%-%mm%-%dd% XLOpen>C:\Workspace\USG Timesheet.xls,1,xlBook S...
by hagchr
Mon Jun 06, 2016 10:37 am
Forum: Beginners
Topic: PivotTable Values problem (VB-related)
Replies: 9
Views: 7104

Re: PivotTable Values problem (VB-related)

If the data are all numbers then it should default to SUM, so you need to check the actual/budget data, to ensure not formatted as text and also check there ar no non-numbers, eg text or spaces etc. If you highlight/select the actual/budget data you can easily check at the bottom right on the screen...
by hagchr
Sun Jun 05, 2016 3:19 pm
Forum: Technical / Scripting
Topic: VBScripting Problem
Replies: 4
Views: 2771

Re: VBScripting Problem

Hi, I was curious to see if I get a problem when looping through the temperatures, so came up with this code, which seems to work w/o problems. Not sure if an issue but the date/time stamp you are using only shows a date for midnight (time=0). If you instead split it using DateValue and TimeValue an...
by hagchr
Sun Jun 05, 2016 10:29 am
Forum: Technical / Scripting
Topic: VBScripting Problem
Replies: 4
Views: 2771

Re: VBScripting Problem

Hi, should not be a problem with the date change, eg Let>startdatetime_new=2016-05-31 23:59:58 VBSTART VBEND VBEval>CDate("%startdatetime_new%"),d VBEval>DateAdd("s",4,"%d%"),enddate_endtime MDL>enddate_endtime IsDate can be used to check if valid date or not. Problem somewhere else in the script? H...
by hagchr
Fri Jun 03, 2016 9:04 pm
Forum: Beginners
Topic: Count time spent in a repeat cycle.
Replies: 2
Views: 3125

Re: Count time spent in a repeat cycle.

Hi, If I understand it correctly then you want to loop 5 times and than wait until 40 minutes have passed since the process started, and then start again? In that case you do not have to keep track of the time in each loop, just the time since the process started (I assume the 5 loops finish within ...
by hagchr
Fri Jun 03, 2016 11:27 am
Forum: Technical / Scripting
Topic: mirror folders
Replies: 3
Views: 2702

Re: mirror folders

Hi, on my machine, something like this would also work.

Code: Select all

Let>dir1=Z:\PLAYqueued
Let>dir2=X:\PLAYqueued
RunProgram>C:\Windows\System32\robocopy.exe %dir1% %dir2% /MIR
by hagchr
Sun May 29, 2016 7:01 pm
Forum: Technical / Scripting
Topic: find the position of the last pixel in the image
Replies: 3
Views: 2841

Re: find the position of the last pixel in the image

Hi, one approach could be to define a rectangle from the top to the bottom of the chart and let it be narrow eg 5 pixels. Then you start from the right side of the chart and loop to the left and in each iteration use GetRectCheckSum> to check if there is any change in the rectangle. Once it changes ...
by hagchr
Thu May 26, 2016 8:44 am
Forum: Beginners
Topic: PivotTable Values problem (VB-related)
Replies: 9
Views: 7104

Re: PivotTable Values problem (VB-related)

I guess you don't have a sheet called Sheet1, so there is a problem to paste the pivot table? I have changed the code slightly so that the pivot table is always placed in a new sheet in cell A1, then you should never have a problem that the sheet is either missing or there is already a pivot table a...
by hagchr
Wed May 25, 2016 1:03 pm
Forum: Beginners
Topic: PivotTable Values problem (VB-related)
Replies: 9
Views: 7104

Re: PivotTable Values problem (VB-related)

Hi, I am in a hurry today so I just threw your data into one of my old pivot scripts. It creates a new pivot table into Sheet1 (can be changed in the script). Problem is if the pivot table already exists you will get an error message - so if you want to update an existing table then it needs to be m...
Sign up to our newsletter for free automation tips, tricks & discounts