Example scripts and tips (replaces Old Scripts & Tips archive)
Moderators: Dorian (MJT support), JRL, Phil Pendlebury
-
Grovkillen
- Automation Wizard
- Posts: 1131
- Joined: Fri Aug 10, 2012 2:38 pm
- Location: Bräcke, Sweden
-
Contact:
Post
by Grovkillen » Mon Apr 26, 2021 3:30 pm
You may need to know which Chrome version that is currently installed, especially if you're planning on automate it using the ChromeDriver.exe. Here's a snippet that will fetch that info for your:
Code: Select all
Let>CHROME_EXE=C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
Let>RP_WINDOWMODE=0
RunProgram>cmd /c powershell (Get-Item '%CHROME_EXE%').VersionInfo | clip
GetClipBoard>RESPONSE,0
Let>REGEX_PATTERN=\b(?:[0-9]{1,5}\.){3}[0-9]{1,5}\b
RegEx>REGEX_PATTERN,RESPONSE,0,FOUND_VERSION,FOUND_MATCHES,0,,,
If>FOUND_MATCHES>0
Separate>FOUND_VERSION_1,.,VERSION
Let>CHROME_major=VERSION_1
Let>CHROME_minor=VERSION_2
Let>CHROME_build=VERSION_3
Let>CHROME_revision=VERSION_4
Let>CHROME_release=FOUND_VERSION_1
Endif>
Only "problem" with this approach is the use of the clipboard. If you have more than one script using the clipboard you may get some hard to track bugs when they cross path's. Hopefully we can get a RP_STDOUT variable populated with the result. Fingers crossed!
-
Enricoys
- Junior Coder
- Posts: 27
- Joined: Mon Jan 06, 2014 1:18 pm
Post
by Enricoys » Fri Jul 23, 2021 12:22 pm
Works great, thanks. I only needed to add 'Let>RP_WAIT=1' somewhere before the 'RunProgram' line. This makes the script waiting for the RunProgram line to be finished. This is important because otherwise I observed sometimes that Clipboard was empty because it was checked to early.
-
Grovkillen
- Automation Wizard
- Posts: 1131
- Joined: Fri Aug 10, 2012 2:38 pm
- Location: Bräcke, Sweden
-
Contact:
Post
by Grovkillen » Fri Jul 23, 2021 8:08 pm
Thanks for the feedback. Good to know!