jonathanmedd / blog-comments

0 stars 0 forks source link

2016/12/powershell-brickset-module-part-2-downloading-instructions #7

Open utterances-bot opened 1 year ago

utterances-bot commented 1 year ago

PowerShell Brickset Module – Part 2: Downloading Instructions - Jonathan Medd's Blog

https://www.jonathanmedd.net/2016/12/powershell-brickset-module-part-2-downloading-instructions.html

enone commented 1 year ago

Interesting, Do You Think That It's Possible Also To Have The -Theme 'Indiana Jones' Name As A Variable And Traverse All Themes To Have PDF Downloaded On Separate Folders For Theme?

jonathanmedd commented 1 year ago

For sure. You could do something like this:

$themes = 'Indiana Jones','Harry Potter'

foreach ($theme in $themes){

    if (! (Test-Path $theme)){

        $null = New-Item -Path $theme -ItemType Directory
    }

    Get-BricksetSet -Theme $theme | Get-BricksetSetInstructions | Select-Object -First 2 | Select-Object -ExpandProperty url | ForEach-Object {$file = ($_.split('/'))[-1]; Start-BitsTransfer -Source $_ -Destination "C:\Test\$theme\$file"}
}
enone commented 1 year ago

Thanks For The Tips... This Worked For A While But Now I Get This Error:

$instructionsUrls = $_ | Get-BricksetSetInstructions | Select …


     The input object cannot be bound to any parameters for the command either because the command does not take pipeline input or the input and its properties do not match any of the
      parameters that take pipeline input.
enone commented 1 year ago

Ok All Fine I've Discovered That API Key Is Blocked If You Download Tons Of PDF In A Short Period Of Time So I've Added A Random Delay To The Script