Search found 327 matches
- Sat Aug 09, 2014 6:31 am
- Forum: Technical / Scripting
- Topic: RegEx Pattern - Variable - Text Insert - Pattern
- Replies: 6
- Views: 4643
Re: RegEx Pattern - Variable - Text Insert - Pattern
Maybe something like this: (For anyone new to RegEx, * is a special character in RegEx so to search for it you need to escape it with \, ie use \*. \d means one digit. The + means one or more so \d+ means one or more digits in the match. The brackets () are also special characters and defines a grou...
- Fri Aug 08, 2014 6:36 pm
- Forum: Technical / Scripting
- Topic: Determining the variable name
- Replies: 3
- Views: 3190
Re: Determining the variable name
Not sure if this would work for you but one way could be to pull the variable names and values into a string and then use RegEx to search for the variable name. //Assign variables Let>alarm_green=http Let>alarm_orange=xyz Let>alarm_red=ssh //Create reference string to search Let>refstring=alarm_gree...
- Tue Aug 05, 2014 7:02 pm
- Forum: Technical / Scripting
- Topic: What cell am I in?
- Replies: 3
- Views: 3096
Re: What cell am I in?
Sorry, I was too quick to submit, the previous one gives the workbook and cell. If you want the sheet name you just need to change ActiveWorkbook to ActiveSheet, ie. VBSTART Dim objExcel Sub GetExcel Set objExcel = GetObject( , "Excel.Application") End Sub VBEND VBRun>GetExcel VBEval>objExcel.Active...
- Tue Aug 05, 2014 6:03 pm
- Forum: Technical / Scripting
- Topic: What cell am I in?
- Replies: 3
- Views: 3096
- Thu Jul 24, 2014 8:52 pm
- Forum: The Water Cooler
- Topic: Puzzler Of the Week?
- Replies: 4
- Views: 9098
Re: Puzzler Of the Week?
With risk of being the first with something that can be improved.... Looking at the pseudo code provided, it seems that if you adjust the hash number (subtract 37^9 if you are looking at 9 letters) then what remains is to find the number (ie the digits) that with base 37 gives the adjusted hash numb...
- Tue Jul 22, 2014 5:33 pm
- Forum: Technical / Scripting
- Topic: Writeln With Variable File name
- Replies: 1
- Views: 2257
Re: Writeln With Variable File name
Hi, Not sure if you have tried the Debugger in MS. If you step through the program by pressing F8 for each line you can see the variable values in the left pane. There are a couple of problems with the code, eg. in line 2, date is not yet defined in line 4 result goes into the variable the_year, but...
- Mon Jul 21, 2014 10:54 am
- Forum: Beginners
- Topic: Returning Day of Week based on Date
- Replies: 3
- Views: 4288
Re: Returning Day of Week based on Date
In case it was not clear, when you set Monday as start of week then, the the formula will return a 1 for Monday, 2 for Tuesday, etc. There is also a function WeekdayName which gives the day name in clear text. VBEval>Weekday("2014-07-21",2),res VBEval>WeekdayName(%res%,,2),res2 MessageModal>%res%, %...
- Mon Jul 21, 2014 10:43 am
- Forum: Beginners
- Topic: Returning Day of Week based on Date
- Replies: 3
- Views: 4288
Re: Returning Day of Week based on Date
Hi, try the following (where the second argument, 2, says that first day of week is Monday. You can select any weekday as start of week)
View Snippet Page
View Snippet Page
- Tue Jul 15, 2014 6:30 pm
- Forum: Beginners
- Topic: Help with complex expression
- Replies: 2
- Views: 3784
Re: Help with complex expression
Hi, I moved the Endif statements (from the end) to the end to each If section, and removed some spaces. GetClipBoard>feno,0 If>%feno%<21 Let>results=The exhaled nitric oxide level was %feno% ppb, demonstrating a low level of eosinophilic airway inflammation. Endif If>{(%feno%>20) AND (%feno%<35)} Le...
- Thu Jun 19, 2014 11:09 am
- Forum: Scripts and Tips
- Topic: SRT to Join array elements
- Replies: 0
- Views: 8238
SRT to Join array elements
I frequently need to combine array results (eg from RegEx) back into a string with some delimiter between the items. There is a Join function in VBS but I have not been able to figure out how (if at all possible) to make it work with <array> variables. Instead I ended up solving it with an SRT, whic...
- Tue Jun 17, 2014 4:50 pm
- Forum: Scripts and Tips
- Topic: "Pass" Array to SRT
- Replies: 2
- Views: 8724
"Pass" Array to SRT
Hi, I frequently end up with results (eg from RegEx etc) in the form of <array> and have had some problem writing generic SRT or VBS where I can "pass" the array and resulting variable name as input and getting the result assigned to the variable name given in the call. If I understand it correctly ...
- Wed Jun 11, 2014 9:20 am
- Forum: Technical / Scripting
- Topic: String Replace Issues
- Replies: 11
- Views: 8236
Re: String Replace Issues
Just for completeness. To remove any trailing spaces or line breaks you can add one more RegEx line. I also changed the first line to avoid some special cases potentially breaking it. //Read your raw file into variable ReadFile>C:\...\test.txt,strFile //Remove multiple rows and spaces RegEx>(?<=[\n]...
- Tue Jun 10, 2014 3:51 pm
- Forum: Technical / Scripting
- Topic: RegEx Replacement
- Replies: 2
- Views: 3820
Re: RegEx Replacement
Thanks. Out of curiosity I just tried the RegEx engine in VBS and there it seems to work. So that could also be an alternative. VBSTART Sub Test Set objRegEx = CreateObject("VBScript.RegExp") objRegEx.Pattern = "(?=test)" strSearchString = "This is a test" strNewString = objRegEx.Replace (strSearchS...
- Tue Jun 10, 2014 11:57 am
- Forum: Technical / Scripting
- Topic: RegEx Replacement
- Replies: 2
- Views: 3820
RegEx Replacement
Hi, I have some cases where I want to insert a string into another based on a RegEx match of position (ie no characters selected for replacement, just a position). I put in a simple example below to illustrate it. For example if I want to insert the text "small" before the word "test", I cannot get ...
- Tue Jun 10, 2014 11:38 am
- Forum: Technical / Scripting
- Topic: String Replace Issues
- Replies: 11
- Views: 8236
Re: String Replace Issues
I adjusted the first RegEx slightly (the previous version would also remove any initial "non-letter", "non-number" characters of a line which is probably ok most of the time. However, if you happen to have a row that starts with a quotation mark then that character would be removed which I guess is ...