Skip to content

Commit 3460b80

Browse files
committed
Fix Thorlabs installers and add Thorlabs ThorImageCAM
1 parent 7396ec9 commit 3460b80

2 files changed

Lines changed: 79 additions & 43 deletions

File tree

Install-Software.ps1

Lines changed: 76 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -624,79 +624,111 @@ function Install-ThorCam ([string]$Version = "3.7.0.6") {
624624
.SYNOPSIS
625625
Install ThorLabs ThorCam
626626
.LINK
627-
https://www.thorlabs.com/software_pages/ViewSoftwarePage.cfm?Code=ThorCam
627+
https://www.thorlabs.com/software-pages/thorcam
628628
#>
629-
Show-Output "Downloading Thorlabs ThorCam. The web server has strict bot detection and the download may therefore fail, producing an invalid file."
630629
$Arch = Get-InstallBitness -x86 "x86" -x86_64 "x64"
631-
$FilenameRemote = "Thorlabs%20Scientific%20Imaging%20Software%20${Arch}.exe"
632-
$FilenameLocal = "Thorlabs Scientific Imaging Software ${Arch}.exe"
633-
# The "FireFox" typo is by Microsoft itself.
634-
# $UserAgent = [Microsoft.PowerShell.Commands.PSUserAgent]::FireFox
635-
Invoke-WebRequestFast -Uri "https://www.thorlabs.com/software/THO/ThorCam/ThorCam_V${Version}/${FilenameRemote}" -OutFile "${Downloads}\${FilenameLocal}" # -UserAgent $UserAgent
636-
Show-Output "https://www.thorlabs.com/software/THO/ThorCam/ThorCam_V${Version}/${FilenameRemote}"
637-
Show-Output "Installing Thorlabs ThorCam"
638-
$Process = Start-Process -NoNewWindow -Wait -PassThru "${Downloads}\${FilenameLocal}"
639-
if ($Process.ExitCode -ne 0) {
640-
Show-Output -ForegroundColor Red "ThorCam installation seems to have failed. Probably the server detected that this is a script, resulting in a corrupted download. Please download ThorCam manually from the Thorlabs website."
630+
$Filename = "thorlabs-scientific-imaging-software-${Arch}.exe"
631+
if ("${Arch}" -eq "x86") {
632+
$Uri = "https://media.thorlabs.com/contentassets/766069a3302a46a48e6534be6b332b42/${Filename}?v=1116040429"
633+
$SHA256 = "042505509c0546d9e6c8ea16befb70997e363c235b38a02df6251a18ebb19c78"
634+
} else {
635+
$Uri = "https://media.thorlabs.com/contentassets/9f7e1f0b3cff4e9a8c18a3dfa4a0bc0a/${Filename}?v=1116040439"
636+
$SHA256 = "a98f58e484920fc31795b8bd5d65529bb6ee7d296424c496aa659c2bafb4861c"
641637
}
638+
Install-FromUri `
639+
-Name "Thorlabs ThorCam" `
640+
-Uri "${Uri}" `
641+
-Filename "${Filename}" `
642+
-SHA256 "${SHA256}"
643+
}
644+
645+
function Install-ThorImageCAM {
646+
<#
647+
.SYNOPSIS
648+
Install ThorLabs ThorImageCAM
649+
.LINK
650+
https://www.thorlabs.com/software-pages/thorcam
651+
#>
652+
param(
653+
[string]$Version = "1.2.17",
654+
[string]$SHA256 = "1379ea68f248cd32e99e6a69a961d8494f2ff9258c81fe9cefbebd681eb6a800"
655+
)
656+
$Filename = "thorimagecam_v${Version}_setup.exe"
657+
Install-FromUri `
658+
-Name "Thorlabs ThorImageCAM" `
659+
-Uri "https://media.thorlabs.com/contentassets/be3cd1548455438293b1611d70ccb6da/${Filename}?v=1116040425" `
660+
-Filename "${Filename}" `
661+
-SHA256 "${SHA256}"
642662
}
643663

644-
function Install-ThorlabsBeam ([string]$Version = "8.2.5232.395") {
664+
function Install-ThorlabsBeam {
645665
<#
646666
.SYNOPSIS
647667
Install Thorlabs Beam
648668
.LINK
649-
https://www.thorlabs.com/software_pages/ViewSoftwarePage.cfm?Code=Beam
669+
https://www.thorlabs.com/en/software-pages/beam
650670
#>
651-
Show-Output "Downloading Thorlabs Beam. The web server has strict bot detection and the download may therefore fail, producing an invalid file."
652-
$Folder = "Thorlabs_Beam_${Version}"
653-
$Filename = "Thorlabs_Beam_${Version}.zip"
654-
Invoke-WebRequestFast -Uri "https://www.thorlabs.com/software/MUC/Beam/Software/Beam_${version}/${filename}" -OutFile "${Downloads}\${Filename}"
655-
Show-Output "Installing Thorlabs Beam"
656-
Expand-Archive -Path "${Downloads}\${Filename}" -DestinationPath "${Downloads}\${Folder}"
657-
$Process = Start-Process -NoNewWindow -Wait -PassThru "${Downloads}\${Folder}\Thorlabs Beam Setup.exe"
658-
if ($Process.ExitCode -ne 0) {
659-
Show-Output -ForegroundColor Red "Thorlabs Beam installation seems to have failed. Probably the server detected that this is a script, resulting in a corrupted download. Please download Thorlabs Beam manually from the Thorlabs website."
660-
}
671+
param(
672+
[string]$Version = "9.3.6304.790",
673+
[string]$SHA256 = "bb4e77c82bf5f227f2e3c6b6a8de43f3821826c2aa4900789282ee14c3367220"
674+
)
675+
$Filename = "thorlabs.thorlabsbeamsetup-release.${Version}_nsis.zip"
676+
Install-FromUri `
677+
-Name "Thorlabs Beam" `
678+
-Uri "https://media.thorlabs.com/contentassets/bcb47aa2aa704177b02ee0c293d15f1a/${Filename}?v=1118090216" `
679+
-Filename "${Filename}" `
680+
-UnzippedFilePath "Thorlabs Beam Setup.exe" `
681+
-SHA256 "${SHA256}"
661682
}
662683

663-
function Install-ThorlabsElliptec ([string]$Version = "1.6.4") {
684+
function Install-ThorlabsElliptec ([string]$Version = "1.6.6") {
664685
<#
665686
.SYNOPSIS
666687
Install Thorlabs Elliptec software
667688
.LINK
668-
https://www.thorlabs.com/software_pages/ViewSoftwarePage.cfm?Code=ELL
689+
https://www.thorlabs.com/software-pages/ell
669690
#>
670-
Show-Output "Downloading Thorlabs Beam. The web server has strict bot detection and the download may therefore fail, producing an invalid file."
671-
$Filename = "Thorlabs_Elliptec_${Version}.exe"
672-
Invoke-WebRequestFast -Uri "https://www.thorlabs.com/Software/Elliptec/Application/V${Version}/ELLO%20Install%20x64/setup.exe" -OutFile "${Downloads}\${Filename}"
673-
$Process = Start-Process -NoNewWindow -Wait -PassThru "${Downloads}\${Filename}"
674-
if ($Process.ExitCode -ne 0) {
675-
Show-Output -ForegroundColor Red "Thorlabs Elliptec installation seems to have failed. Probably the server detected that this is a script, resulting in a corrupted download. Please download Thorlabs Elliptec manually from the Thorlabs website."
691+
$Arch = Get-InstallBitness -x86 "x86" -x86_64 "x64"
692+
if ("${Arch}" -eq "x86") {
693+
$Uri = "https://media.thorlabs.com/contentassets/d42094d0a1ff4b39a2cc2a61543c7481/setup.exe?v=1116040935"
694+
$SHA256 = "9f371175c22bb96d64370ea4854d64296ff7326b608e09103af3ddf658b9a4c0"
695+
} else {
696+
$Uri = "https://media.thorlabs.com/contentassets/65384a0c619f4a17a721930570bcae87/setup.exe?v=1116040938"
697+
$SHA256 = "dd095269ed5fb7bc5676f5ba86a1f37b3db6e133480f8d29099863fdf90b9299"
676698
}
699+
Install-FromUri `
700+
-Name "Thorlabs Elliptec" `
701+
-Filename "Thorlabs Elliptec setup ${Arch}.exe" `
702+
-Uri "${Uri}" `
703+
-SHA256 "${SHA256}"
677704
}
678705

679706
function Install-ThorlabsKinesis {
680707
<#
681708
.SYNOPSIS
682709
Install Thorlabs Kinesis
683710
.LINK
684-
https://www.thorlabs.com/software_pages/ViewSoftwarePage.cfm?Code=Motion_Control&viewtab=0
711+
https://www.thorlabs.com/software-pages/motion_control/
685712
#>
686713
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseSingularNouns", "", Justification="Thorlabs Kinesis is a singular noun")]
687714
param(
688-
[string]$Version = "1.14.36",
689-
[string]$Version2 = "20973"
715+
[string]$Version = "1.14.59",
716+
[string]$Version2 = "26708"
690717
)
691-
Show-Output "Downloading Thorlabs Kinesis. The web server has strict bot detection and the download may therefore fail, producing an invalid file."
692718
$Arch = Get-InstallBitness -x86 "x86" -x86_64 "x64"
693-
$Filename = "kinesis_${Version2}_setup_${Arch}.exe"
694-
Invoke-WebRequestFast -Uri "https://www.thorlabs.com/Software/Motion%20Control/KINESIS/Application/v${Version}/${Filename}" -OutFile "${Downloads}\${Filename}"
695-
Show-Output "Installing Thorlabs Kinesis"
696-
$Process = Start-Process -NoNewWindow -Wait -PassThru "${Downloads}\${Filename}"
697-
if ($Process.ExitCode -ne 0) {
698-
Show-Output -ForegroundColor Red "Thorlabs Kinesis installation seems to have failed. Probably the server detected that this is a script, resulting in a corrupted download. Please download Thorlabs Kinesis manually from the Thorlabs website."
719+
$Filename = "thorlabs_kinesis_setup_${Version2}_${Arch}.exe"
720+
if ("${Arch}" -eq "x86") {
721+
$Uri = "https://media.thorlabs.com/contentassets/fb56e416e2b248f5a7888aae3fcf71d3/${Filename}?v=0126103520"
722+
$SHA256 = "fe073773316e6ca472eeeb47cafaada8324303c6d9a1e25788875fcafd27d888"
723+
} else {
724+
$Uri = "https://media.thorlabs.com/contentassets/98b8893ed3ff41cc8b1794e39e81e6fe/${Filename}?v=0126103405"
725+
$SHA256 = "12240a38699d2fa9a0974daccb52a0f66867b394963e52fcc964f2d42ba6b88e"
699726
}
727+
Install-FromUri `
728+
-Name "Thorlabs Kinesis" `
729+
-Filename "${Filename}" `
730+
-Uri "${Uri}" `
731+
-SHA256 "${SHA256}"
700732
}
701733

702734
function Install-VCU {
@@ -811,7 +843,8 @@ $OtherOperations = [ordered]@{
811843
"SMC ThermoChiller" = ${function:Install-SMCThermoChiller}, "Monitoring software for SMC ThermoChillers, especially the HRR series";
812844
"SNLO" = ${function:Install-SNLO}, "Crystal nonlinear optics simulator";
813845
"SSMbe (NOTE!)" = ${function:Install-SSMbe}, "Control software for the SS10-1 MBE reactor. NOTE! Also install the LabVIEW Runtime and NI-VISA dependencies.";
814-
"Thorlabs ThorCam (NOTE!)" = ${function:Install-ThorCam}, "Driver for Thorlabs cameras. NOTE! Use IDS Peak instead for old cameras.";
846+
"Thorlabs ThorCam" = ${function:Install-ThorCam}, "Driver for old Thorlabs cameras. NOTE! Use IDS Peak instead for the oldest cameras.";
847+
"Thorlabs ThorImageCAM" = ${function:Install-ThorImageCAM}, "Driver for Thorlabs cameras.";
815848
"Thorlabs Beam" = ${function:Install-ThorlabsBeam}, "Driver for Thorlabs beam profilers and M2 measurement systems";
816849
"Thorlabs Elliptec" = ${function:Install-ThorlabsElliptec}, "Driver for Thorlabs Elliptec stages and mounts";
817850
"Thorlabs Kinesis" = ${function:Install-ThorlabsKinesis}, "Driver for Thorlabs motors and stages";

Utils.ps1

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -434,6 +434,9 @@ function Install-FromUri {
434434
# Download the file
435435
if ($IsRemote -and (-not $FileAlreadyOK)) {
436436
Show-Output "Downloading ${Name}"
437+
# If the download fails, then something like this may be tried as a fix:
438+
# $UserAgent = [Microsoft.PowerShell.Commands.PSUserAgent]::FireFox
439+
# The "FireFox" typo is by Microsoft itself.
437440
Invoke-WebRequestFast -Uri "${Uri}" -OutFile "${Path}"
438441
}
439442

0 commit comments

Comments
 (0)