sto ottenendo lo stesso risultato, puoi darci una descrizione più dettagliata di come lo hai risolto, per noi principianti. PowerShell nel campo Programma / script? dov'è esattamente? e dove si trova la cartella degli script PS ecc. Grazie

Fantastico, buono a sapersi. Grazie mille, Dan. :)

Ehi amico, sto ottenendo uno sfondo nero. qualche soluzione?

ts = New-TimeSpan -Hours -2 -Minutes -30 #Numero di ore e minuti da aggiungere / sottrarre alla data. Regola questo per compensare la data del tuo sistema a circa GMT (penso?)
$ now = ((Get-Date -Second 00) + $ ts)
$ ora = $ ora. AddMinutes (- ($ now.minute% 10))

$ larghezza = 550
$ level = "4d" #Level può essere 4d, 8d, 16d, 20d
$ numblocks = 4 # apparentemente corrisponde direttamente al livello, mantenerlo esattamente uguale al livello senza la 'd'
$ time = $ now. ToString ( "HHMMSS")
$ anno = $ ora. ToString ( "yyyy")
$ mese = $ ora. ToString ( "MM")
$ day = $ adesso. ToString ( "dd")

#Crea la cartella My Pictures \ Himawari \ se non esiste
$ outpath = [Environment]:: GetFolderPath ("MyPictures") + "\ Himawari \"

instagram viewer

if (! (Test-Path -Path $ outpath))
{
[void] (New-Item -ItemType directory -Path $ outpath)
}

# Il nome file che verrà salvato:
# Rimuovi il commento per fare in modo che i file si accumulino nella directory:
# $ outfile = "$ year $ month $ day" + "_" + $ time + ".jpg"
# Usare questo per fare in modo che lo script memorizzi solo l'ultimo file:
$ outfile = "latest.jpg"

$ url = " http://himawari8-dl.nict.go.jp/himawari8/img/D531106/$level/$width/$year/$month/$day/$time"

[Vuoto] [reflection.assembly]:: LoadWithPartialName ( "Sistema. Finestre. Forme")
[Vuoto] [reflection.assembly]:: LoadWithPartialName ( "Sistema. Disegno")

$ image = Sistema New-Object. Disegno. Bitmap (($ width * $ numblocks), ($ width * $ numblocks))
$ graphics = [Sistema. Disegno. Grafica]:: FromImage ($ image)
$ grafica. Cancella ([Sistema. Disegno. Colore nero)

per ($ y = 0; $ y -lt $ blocchi numerici; $ Y ++)
{
per ($ x = 0; $ x -lt $ blocchi numerici; $ X ++)
{
$ thisurl = $ url + "_" + [String] $ x + "_" + [String] $ y + ".png"
Scrittura-output "Download: $ thisurl"

provare
{

$ request = [Sistema. Netto. WebRequest]:: creare ($ thisurl)
$ response = $ request.getResponse ()
$ HTTP_Status = [int] $ response. StatusCode
If ($ HTTP_Status -eq 200)
{
$ imgblock = [Sistema. Disegno. Immagine]:: fromStream ($ response.getResponseStream ())
$ grafica. DrawImage ($ imgblock, ($ x * $ larghezza), ($ y * $ larghezza), $ larghezza, $ larghezza)
$ Imgblock.dispose ()
$ Response. Vicino()
}
}
Catturare
{
$ ErrorMessage = $ _. Eccezione. Messaggio
$ FailedItem = $ _. Eccezione. Nome dell'elemento
Scrittura-output "Fallito! $ ErrorMessage con $ FailedItem "
}
}
}

$ qualityEncoder = [Sistema. Disegno. Imaging. Encoder]:: Qualità
$ encoderParams = New-Object System. Disegno. Imaging. EncoderParameters (1)

# Imposta qui il livello di qualità JPEG: 0 - 100 (limiti inclusi)
$ encoderParams. Param [0] = New-Object System. Disegno. Imaging. EncoderParameter ($ qualityEncoder, 90)
$ jpegCodecInfo = [Sistema. Disegno. Imaging. ImageCodecInfo]:: GetImageEncoders () | dove {$ _. MimeType -eq 'image / jpeg'}

$ image.save (($ outpath + $ outfile), $ jpegCodecInfo, $ encoderParams)
$ Image. Dispose ()

Scrittura-output "Impostazione dello sfondo ..."
Set-ItemProperty -path "HKCU: Pannello di controllo \ Desktop" -name Wallpaper -value ($ outpath + $ outfile)
Set-ItemProperty -path "HKCU: Pannello di controllo \ Desktop" -name WallpaperStyle -value 6
Set-ItemProperty -path "HKCU: Pannello di controllo \ Desktop" -name TileWallpaper -value 0
Set-ItemProperty 'HKCU: \ Pannello di controllo \ Colori' -name Background -Value "0 0 0"
# rundll32.exe user32.dll, UpdatePerUserSystemParameters

$ setwallpapersource = @ "
utilizzando il sistema. Runtime. InteropServices;
carta da parati di classe pubblica
{
public const int SetDesktopWallpaper = 20;
public const int UpdateIniFile = 0x01;
public const int SendWinIniChange = 0x02;
[DllImport ("user32.dll", SetLastError = true, CharSet = CharSet. Auto)]
private static extern int SystemParametersInfo (int uAction, int uParam, string lpvParam, int fuWinIni);
vuoto statico pubblico SetWallpaper (percorso stringa)
{
SystemParametersInfo (SetDesktopWallpaper, 0, path, UpdateIniFile | SendWinIniChange);
}
}
"@
Add-Type -TypeDefinition $ setwallpapersource
[sfondo]:: SetWallpaper (($ outpath + $ outfile))

Scrittura-uscita "Fine"