Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Aug 31st, 2004, 5:35 PM   #1
FoCaL
Newbie
 
Join Date: Aug 2004
Location: St. Louis
Posts: 4
Rep Power: 0 FoCaL is on a distinguished road
Send a message via MSN to FoCaL
I guess Ill give some background on the project. Here at my company the Marketing Dept., with the help of the IS Dept. setup at least one computer at every branch. This computer is hooked up to a TV, or several TV's in some cases and the computer runs a Power Point to help keep employees up to date on my company's news. Well currently when they update the power point presentation they have to logon to every computer at every branch and download the new power point. Then stop the old one and start the new one. I'm trying to make this 30 - 45 minute weekly job about 2.

What I have so far is code that opens a browser so they can browse their computer and the network and select the newest power point file. Then I have the program stopping the power point process on the remote computers so I can copy over the old file. After that I do that copy, and I then would like to start power point and then start the slide show in power point. I'm stuck at starting the power point remotely. I can start power point fine, however it always starts as a background process and you only see power point running in task manager under processes. So I thought well I can make two scripts. Id prefer one but if two will work then so be it. So I wrote some cheap little code that does some send keys thinking Ill put that on the computer then start it remotely. Well I can start it remotely but it also stays in the background and you never see power point open on the console, just running in task manager.

Ive tried modifying my script accordingly so that it should start up in the forground but I cant get it to work correclty. Anyone want to give me a hand? Im open to just about anything that will make this work for me. I can provide my code or parts of my code if needed, just let me know what you need to know. Thanks in advance.
FoCaL is offline   Reply With Quote
Old Aug 31st, 2004, 7:49 PM   #2
thechristelegacy
Expert Programmer
 
thechristelegacy's Avatar
 
Join Date: Jul 2004
Location: Somerset, Pa
Posts: 708
Rep Power: 5 thechristelegacy is on a distinguished road
Send a message via AIM to thechristelegacy Send a message via MSN to thechristelegacy
Try these ideas.
A script that stays in the background, and at a certain time or interval, it shutdowns the current powerpoint, copies the the new files over and then restarts it.

I guess that depends on whether or not the remote computers have direct access to the powerpoint files. If not, maybe you could set up a small FTP server on the main computer, and write a script that downloads the files through FTP at a certain time on interval. Tell me what you think. That all can be done using Python that I know, and I'm sure you can write scripts in most other languages that will do the same.

If you need to see an example in Python let me know.

I realize this is for VB, but I'm just throwing out some more options.

Good luck
thechristelegacy is offline   Reply With Quote
Old Sep 1st, 2004, 12:28 AM   #3
FoCaL
Newbie
 
Join Date: Aug 2004
Location: St. Louis
Posts: 4
Rep Power: 0 FoCaL is on a distinguished road
Send a message via MSN to FoCaL
Thanks for the ideas, I follow what your saying. However, what you mentioned is basically what Im doing in VB. The problem Im coming across is not if my script runs in the background, everything it does happens in the background as well. So when it starts power point, its a background process.

Ill go over what I have coded again quickly.

On my computer I run the program
It prompts me to pick my power point file
Once the file is selected it stopps the power point process on the remote computers
Now it copies the power point to the remote computers renaming the file to a standard convention and overwriting the old one

Thats what I have done so far and that obviously in laymens terms. My next step is to start power point remotely, since the script is running on my computer. Ive gotten it to work, it will start power point. However, as I stated above it starts as a background process and you cannot see it on the console. Ive done some reserch and found out a method that is supposed to make it start in the forground, but I cant get it to work right. Im at home now, when I get in to work tomorrow Ill post that code.

Thanks for the idea and help. I would not mind seeing some Python code. Right now Im at the point where if it works Ill use it. Thanks again
FoCaL is offline   Reply With Quote
Old Sep 1st, 2004, 9:53 AM   #4
FoCaL
Newbie
 
Join Date: Aug 2004
Location: St. Louis
Posts: 4
Rep Power: 0 FoCaL is on a distinguished road
Send a message via MSN to FoCaL
This is the code that starts the process. However it does start in the background with this code. This code does work correclty.
strComputer = "testsvr90"
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2:Win32_Process")
errReturn = objWMIService.Create("C:\FHN\current.ppt", null, null, intProcessID)
If errReturn = 0 Then
	Wscript.Echo "Power Point was started with a process ID of " & intProcessID & "."
Else
	Wscript.Echo "Power Point could not be started due to an error " & errReturn & "."
End If


This is the modified code thats supposed to let it start in the forground. This code does NOT work correclty. I get an error return or 'Error 8'
const ShowWin = 5
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\testsvr90\root\cimv2")
Set objStartup = objWMIService.Get("Win32_ProcessStartup")
Set objConfig = objStartup.SpawnInstance_
objConfig.ShowWindow = ShowWin
Set objProcess = GetObject("winmgmts:{impersonationLevel=impersonate}!\\testsvr90\root\cimv2:Win32_Process")
errReturn = objProcess.Create("C:\FHN\POWERPNT.EXE", Null, Null, intProcessID)
If errReturn = 0 Then
	Wscript.Echo "Power Point was started with a process ID of " & intProcessID & "."
Else
	Wscript.Echo "Power Point could not be started due to an error " & errReturn & "."
End If

edit: I just got the second code to work without returning an error. However, it still start Power Point on the remote machine as a brackground process and you can only see power point running in task manager.
FoCaL is offline   Reply With Quote
Old Sep 3rd, 2004, 3:57 PM   #5
FoCaL
Newbie
 
Join Date: Aug 2004
Location: St. Louis
Posts: 4
Rep Power: 0 FoCaL is on a distinguished road
Send a message via MSN to FoCaL
Ok I found a way for me to get this to work for anyone whos interested.

What I did is make a short script that starts the power point presentation then starts the slide show. Then I made a function that creates a Scheduled Task on that remote computer and sets it to run that script in 3 minutes. The only problems I had were time zone issues, so I had to modify my time by an hour so that it would work.

I have the script I use on the remote computer and the function I call in my main script posted below. Hopfully this may be usefull for some else doing something similar. Any questions or anything please fee free to post and I do what I can to explain or help someone do something simliar.

Function ScheduleTask
strComputer = "copmuternamegoeshere"
Set objService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colTimeZone = objService.ExecQuery("SELECT * FROM Win32_TimeZone")
For Each objTimeZone in colTimeZone
	strBias = objTimeZone.Bias
Next
dtmCurrentDate = Date
dtmTargetDate = Year(dtmCurrentDate)
dtmMonth = Month(dtmCurrentDate)
If Len(dtmMonth) = 1 Then
	dtmMonth = "0" & dtmMonth
End If
dtmTargetDate = dtmTargetDate & dtmMonth
dtmDay = Day(dtmCurrentDate)
If Len(dtmDay) = 1 Then
	dtmDay = "0" & dtmDay
End If
theMin = Minute(Now)
theHour = Hour(Now)
theHour = theHour - 1
theMin = theMin + 3
If theMin > 60 Then
	theMin = theMin - 60
End If
theTime = theHour & theMin & "00"
dtmTargetDate = dtmTargetDate & dtmDay & theTime & ".000000"
dtmTargetDate = dtmTargetDate & cstr(strBias)
Set objNewJob = objService.Get("Win32_ScheduledJob")
objNewJob.Create"C:\FHN\StartPPT.vbs", dtmTargetDate, False, , , , JobID
End Function

Set objShell = WScript.CreateObject("WScript.Shell")
objShell.Run("C:\FHN\current.ppt")
Wscript.Sleep 15000
objShell.SendKeys "{F5}"
Wscript.quit
FoCaL is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 11:38 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC