var page = new WebPage(), address, output, size; if (phantom.args.length < 2 || phantom.args.length > 3) { console.log('Usage: rasterize.js URL filename [paperwidth*paperheight|paperformat]'); console.log(' paper (pdf output) examples: "5in*7.5in", "10cm*20cm", "A4", "Letter"'); phantom.exit(); } else { address = phantom.args[0]; output = phantom.args[1]; page.viewportSize = { width: 600, height: 600 }; if (phantom.args.length === 3 && phantom.args[1].substr(-4) === ".pdf") { size = phantom.args[2].split('*'); page.paperSize = size.length === 2 ? { width: size[0], height: size[1], border: '0px' } : { format: phantom.args[2], orientation: 'portrait', border: '1cm' }; }/* xrays add */ else if(phantom.args.length === 3){ size = phantom.args[2].split('*'); page.viewportSize = { width: size[0], height: size[1] }; };/* end */ page.open(address, function (status) { if (status !== 'success') { console.log('Unable to load the address!'); } else { window.setTimeout(function () { page.render(output); phantom.exit(); }, 200); } }); }
Dim WshShell Set WshShell = WScript.CreateObject("Wscript.Shell") Dim url, history, logon ' url = "http://www.artmeteo.ru/4335/" ' history = 1 ' logon = 1 ' Windows
' Dim obj, monSize Set obj = CreateObject("htmlfile") monSize = obj.parentWindow.screen.width & "*" & obj.parentWindow.screen.height
' ' Dim toolsPath, path Set obj = CreateObject("Scripting.FileSystemObject") ' obj toolsPath = obj.GetParentFolderName(WScript.ScriptFullName) & "\" ' path = obj.GetParentFolderName(toolsPath) & "\" ' ' Dim phantom, bmpname phantom = toolsPath&"phantomjs\" ' phantomjs bmpname = path&"url.bmp " ' bmp WshShell.Run phantom & "phantomjs.exe " & toolsPath & "rasterize.js " & url & " " & bmpname & monSize, 0, True '
0, True
necessary for the code to be executed in the background and further commands described in the script are waiting for the execution of this code. Dim OSType OSType = Left(Trim(WshShell.RegRead("HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\CurrentVersion")),1) ' windows Dim convert, n, time, jpgname, wallpaper
If OSType>5 Then ' Windows Vista Windows 7 ' bmp jpg Dim quality quality = 95 ' jpg convert = toolsPath & "nconvert.exe -out jpeg -q " & quality & " -i -overwrite -o " n = Now ' time = Right("00" & Day(n), 2) & "-" & Right("00" & Month(n), 2) & "-" & Right("00" & Year(n), 2) & "_" & Right("00" & Hour(n), 2) & "_" & Right("00" & Minute(n), 2) & "_" & Right("00" & Second(n), 2) ' jpgname = path & time & ".jpg " ' jpg WshShell.Run convert & jpgname & bmpname, 0, True ' bmp jpeg ' wallpaper = WshShell.ExpandEnvironmentStrings("%APPDATA%") & "\Microsoft\Windows\Themes\TranscodedWallpaper.jpg" ' obj.CopyFile jpgname, wallpaper ' jpg . WshShell.RegWrite "HKCU\Control Panel\Desktop\Wallpaper", wallpaper ' ' logon Dim logonname logonname = WshShell.ExpandEnvironmentStrings("%windir%") & "\System32\oobe\info\backgrounds\backgroundDefault.jpg " ' logon If logon = 1 Then ' logon Dim logonconvert, goodlogon Set file = obj.GetFile(jpgname) ' logon If Round(file.size/1024) < 256 Then ' < 256, goodlogon = 1 obj.CopyFile jpgname, logonname Else goodlogon = 0 quality = quality - 3 End If ' logon While goodlogon = 0 logonconvert = toolsPath & "nconvert.exe -out jpeg -q " & quality & " -i -overwrite -o " ' -canvas 1280 800 top-left WshShell.Run logonconvert & logonname & bmpname, 0, True Set file = obj.GetFile(logonname) ' logon If Round(file.size/1024) < 256 Then ' < 256 Kb, goodlogon = 1 Else quality = quality - 3 ' End If Wend WshShell.RegWrite "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI\Background\OEMBackground", 1, "REG_DWORD" Else If obj.FileExists(logonname) Then obj.DeleteFile logonname, True ' logon , End If End If If history = 0 Then ' , jpg obj.DeleteFile jpgname, True End If WshShell.Run toolsPath & "wallpaper.exe", 0, True ' Windows
Else ' Windows ' wallpaper = WshShell.ExpandEnvironmentStrings("%appdata%") & "\Wallpaper.bmp" ' obj.CopyFile bmpname, wallpaper ' bmp . WshShell.RegWrite "HKCU\Control Panel\Desktop\Wallpaper", wallpaper ' ' logon Dim Background, Winlogon If logon = 1 Then ' logon Background = 1 Winlogon = 0 WshShell.RegWrite "HKEY_USERS\.DEFAULT\Control Panel\Desktop\TileWallpaper", 1, "REG_SZ" ' : (0 = ; 1 = ()) Else Background = 0 wallpaper = "" Winlogon = 1 End If WshShell.RegWrite "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI\Background\OEMBackground", Background, "REG_DWORD" ' logon WshShell.RegWrite "HKEY_USERS\.DEFAULT\Control Panel\Desktop\Wallpaper", wallpaper, "REG_SZ"' logon ' WshShell.RegWrite "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\LogonType", Winlogon, "REG_DWORD" ' 1 - , 0 - If history = 1 Then ' , bmp jpg (95% ) convert = toolsPath & "nconvert.exe -out jpeg -q 95 -overwrite -o " n = Now time = Right("00" & Day(n), 2) & "-" & Right("00" & Month(n), 2) & "-" & Right("00" & Year(n), 2) & "_" & Right("00" & Hour(n), 2) & "_" & Right("00" & Minute(n), 2) & "_" & Right("00" & Second(n), 2) ' jpgname = path & time & ".jpg " WshShell.Run convert & jpgname & bmpname, 0, True ' bmp jpg End If WshShell.Run "%windir%\System32\RUNDLL32.EXE user32.dll,UpdatePerUserSystemParameters", 0, True ' End If
obj.DeleteFile bmpname, True ' bmp Set WshShell = Nothing
"%windir%\System32\oobe\info\backgrounds\"
or changing the user account control settings (UAC) to the lowest, then restarting the computer and updating the script which can be downloaded here .Source: https://habr.com/ru/post/132581/
All Articles