# VB Script to convert file



## Drivium (May 22, 2008)

Trying to view a .snp file on my blackberry which is impossible, so I need to automatically convert the .snp into an .xls spreadsheet (which is a format that my blackberry can read). I have already written the script to email this file to my phone automatically, so now I just need to create the file to send! The only way to get the data from the .snp file is to open it (because it wont let you highlight the text in access snapshot viewer), choose print to .xps file, then open that .xps file in internet explorer, then select all, and copy, open excel and paste into that and save & close. I managed to make this happen using the SendKeys function. However, I want this to happen automatically even with my pc locked (but still logged in). I had an idea to insert a ctrl alt delete line into sendkeys and have it type in my log in and pass to get me back in and then have the rest of the script run, but ctrl alt delete is blocked through VB script (some win2k security feature that cannot be circumvented I'm reading) So I am thinking that SendKeys will not work for this.

Is these another way to perform all of these functions behind a locked pc?

Again, I need to
1. Open a .snp file
2. Print as .xps
3. Open the .xps file in iexplorer
4. Select all
5. Copy
6. Close iexplorer
7. open excel
8. paste into
9. save
10. close


----------



## Drivium (May 22, 2008)

Here is the code I have right now that works (unless pc is locked)

Set WshShell = CreateObject("WScript.Shell")
WshShell.Run chr(34) & "\\Mwcal2l\projects\GRP_ENGR\WINDSS\LaunchPad_Programs\Web_Reports\South_production.snp" &chr(34)
Wscript.Sleep 500
WshShell.SendKeys "%"
WshShell.SendKeys "F"
WshShell.SendKeys "P"
WshShell.SendKeys "{ENTER}"
WshShell.SendKeys "Production"
Wscript.Sleep 500
WshShell.SendKeys "{ENTER}"
Wscript.Sleep 500
WshShell.SendKeys "%"
WshShell.SendKeys "F"
WshShell.SendKeys "X"

filename="C:\Documents and Settings\dl206585\Desktop\Production.xps"
Set WshShell = CreateObject("WScript.Shell")
WshShell.Run chr(34) & "C:\Program Files\Internet Explorer\iexplore.exe" &chr(34) &filename
WshShell.AppActivate "iexplore"
WScript.sleep 6000
WshShell.SendKeys "^a"
WshShell.SendKeys "^c"
WshShell.SendKeys "%"
WshShell.SendKeys "{DOWN}"
WshShell.SendKeys "X"

WScript.sleep 10000
WshShell.Run chr(34) & "C:\Program Files\Microsoft Office\Office12\excel.exe" &chr(34)
WScript.sleep 3000
WshShell.SendKeys "^v"
WshShell.SendKeys "%"
WshShell.SendKeys "F"
WshShell.SendKeys "S"
WshShell.SendKeys "Production"
WshShell.SendKeys "{ENTER}"
WshShell.SendKeys "%"
WshShell.SendKeys "F"
WshShell.SendKeys "X"


----------

