Quantcast
Channel: PowerShell General
Viewing all articles
Browse latest Browse all 10624

Powershell save as and name as variable

$
0
0

Hello,

I recently discovered powershell and I am quite impressed with what I can do with it. I found this code online (from this site actually) and need some manipulation to it.

 

$code ='$helper = New-Object -comobject WScript.Shell; $helper.AppActivate(''Save HTML Document'', $true); $helper.SendKeys(''{ENTER}'')'

$ie = New-Object -ComObject InternetExplorer.Application
$ie.Navigate("
https://chart.googleapis.com/chart?chs=250x250&cht=qr&chl=1")
while ($ie.ReadyState -ne 4) { Start-Sleep -Milliseconds 200}
Start-Process powershell.exe -argument ('-version 2.0 -noprofile -windowstyle hidden -command "{0}"' -f $code)
$ie.ExecWB(4,2,"page.png",[ref]$null)

 

 

basically google has a website that generates codes off the url. 

https://chart.googleapis.com/chart?chs=250x250&cht=qr&chl=1             --will generate 1

https://chart.googleapis.com/chart?chs=250x250&cht=qr&chl=22           --will generate 22

https://chart.googleapis.com/chart?chs=250x250&cht=qr&chl=4             --will generate 4 

etc..

 

I want to automate this and "save as" 1.png, 22.png, 4.png

and save them to my C:\Test\ folder

 

 

The current code opens the "save as" screen but doesn't automatically save for me. Any help on this would be amazing, sorry I am very new to powershell.


Viewing all articles
Browse latest Browse all 10624

Trending Articles