Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Logon script to copy WallPaper file depending the Resolution screen

Posted on 2011-03-08
3
Medium Priority
?
1,307 Views
Last Modified: 2012-05-11
In other question I found the VBS to get the resolution of the screen
http://www.experts-exchange.com/Programming/Languages/Visual_Basic/Q_21479950.html 

but now I need to know how to use the result of the VBS file to copy a Wallpaper file dependeing the resolution (I know, need to put a lot of posible combinations of screen resolutions)

or if can get the aspect ratio (4:3 or 16:9) can only copy 2 posible files

Have Windows 2008 R2 Domain, with clients XP and 7

Ideas are wellcome
0
Comment
Question by:DavidLeal
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
3 Comments
 
LVL 3

Author Comment

by:DavidLeal
ID: 35070460
I'm pretty close to the solution, searching in google (and with help of a programer of the company)

get to this:

screen = ScreenResolution
WScript.Echo screen(0),screen(1)


Function ScreenResolution()
Set oIE = CreateObject("InternetExplorer.Application")
With oIE
.Navigate("about:blank")
Do Until .readyState = 4: wscript.sleep 100: Loop
width = .document.ParentWindow.screen.width
height = .document.ParentWindow.screen.height
End With
oIE.Quit
ScreenResolution = array(width,height)
End Function

dim filesys
set filesys=CreateObject("Scripting.FileSystemObject")

If (screen(0)/screen(1)) > 1.5 Then
      filesys.CopyFile "c:\vbs\wall1280x800.jpg", "C:\wp4.jpg"
Else
      filesys.CopyFile "c:\vbs\wall800x600.jpg", "C:\wp4.jpg"
End IF


but now need insert %LOGONSERVER% and %USERPROFILE% variables in copy statements for the origin and destination paths to finish it

Why 1.5 ? 4:3 ascpect ratio was 1.3333 and 16:9 aspect ratio was 1.77777
0
 
LVL 3

Accepted Solution

by:
DavidLeal earned 0 total points
ID: 35071100
Ok, I solve my script.

Tested and work well

I don't remove the echo of the resolution in orther to know the resolution.
 
set objWShell=wScript.createObject("WScript.Shell")

screen = ScreenResolution
WScript.Echo screen(0),screen(1)

strProfile = objWShell.ExpandEnvironmentStrings("%USERPROFILE%")
strLogonServer = objWShell.ExpandEnvironmentStrings("%LOGONSERVER%")

Function ScreenResolution()
Set oIE = CreateObject("InternetExplorer.Application")
With oIE
.Navigate("about:blank")
Do Until .readyState = 4: wscript.sleep 100: Loop
width = .document.ParentWindow.screen.width
height = .document.ParentWindow.screen.height
End With
oIE.Quit
ScreenResolution = array(width,height)
End Function

dim filesys
set filesys=CreateObject("Scripting.FileSystemObject")


If (screen(0)/screen(1)) > 1.5 Then
	strFileToCopy=strLogonServer&"\SYSVOL\geusa.corp\scripts\wall1280x800.jpg"
	strFolder=strProfile&"\wp4.jpg"
	filesys.CopyFile strFileToCopy,strFolder
Else
	strFileToCopy=strLogonServer&"\SYSVOL\geusa.corp\scripts\wall800x600.jpg"
	strFolder=strProfile&"\wp4.jpg"
	filesys.CopyFile strFileToCopy,strFolder
End IF

Open in new window

0
 
LVL 3

Author Closing Comment

by:DavidLeal
ID: 35083589
Reading other questions, and searching in google, I solve the Issue
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I was prompted to write this article after the recent World-Wide Ransomware outbreak. For years now, System Administrators around the world have used the excuse of "Waiting a Bit" before applying Security Patch Updates. This type of reasoning to me …
This process allows computer passwords to be managed and secured without using LAPS. This is an improvement on an existing process, enhanced to store password encrypted, instead of clear-text files within SQL
This tutorial will walk an individual through configuring a drive on a Windows Server 2008 to perform shadow copies in order to quickly recover deleted files and folders. Click on Start and then select Computer to view the available drives on the se…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
Suggested Courses

597 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question