DanGough / Nevergreen

This module is an alternative to Evergreen, and allows you to find the latest version and download URL for various Windows apps. Evergreen uses API queries to obtain its data whereas this module is more focussed on web scraping. This is more prone to breaking when websites are changed, hence the name.
The Unlicense
71 stars 16 forks source link

[New App Request] Alludo MindManager (On Proposals list) #88

Open AScott-WWF opened 2 days ago

AScott-WWF commented 2 days ago

Script:

# Get-AlludoMindManager.ps1

# Define AppName
$AppName = "Alludo MindManager"

# Annoyingly MindManager don't publish the latest full release version on a web page, they do however publish it within the latest release notes PDF
# At time of writing, this is here: https://download.mindjet.com/MindManager_23_Windows_Release_Notes_EN.pdf

$ReleaseUrl = "https://www.mindmanager.com/en/support/download-library/?alid=613268737.1719500031"

Write-Verbose "Obtaining $($AppName) Release Versions from $($ReleaseUrl)...`n"

# Main script to fetch and process links
$AppVersions = @(
    @{AppName = $($AppName); Type = 'exe'; Pattern = 'mm-win-exe'; VersionPattern = '<p class="h4">MindManager\sWindows\s(\d+)</p>'}
)

foreach ($AppVersion in $AppVersions) {
    $SearchCount = 1 # This may need increasing as future versions are released

    #Build each link with File Type specific versions
    $URL = (Resolve-Uri -Uri (Get-Link -Uri $ReleaseUrl -MatchProperty href -Pattern $AppVersion.Pattern -PrefixDomain)).Uri
    $Version = Get-Version -Uri $ReleaseUrl -Pattern $($AppVersion.VersionPattern)

    $InstallInstructionsUrl = "https://onlinehelp.mindjet.com/$($Version)/index.html?app=MindManager&lang=en#/l1TOC1"
    $ReleaseNotesUrl = "https://www.mindmanager.com/latest-release-notes-windows-english"
    Write-Verbose "$($AppName) (Version: $($Version)) Release notes are available here: $($ReleaseNotesUrl)"
    Write-Verbose "$($AppName) Install instructions are available here: $($InstallInstructionsUrl)"

    do {
        if ($URL) {
            New-NevergreenApp -Name $($AppVersion.AppName) -Version $($Version) -Uri $($URL) -Architecture 'x64' -Type $($AppVersion.Type)
            break
        }

        $SearchCount--
    } until ($SearchCount -eq 0)

    if ($SearchCount -eq 0) {
        Write-Warning "Could not find release for $($AppName) $($AppVersion.Type)"
    }
}