Kamis, 28 Juli 2011

RE: [MS_AccessPros] Re: help with vbs script code

 

Hi Sarah

It might take me a couple days to get to this. I'm a bit behind in my "real"
work this week.

Regards,

Bill

From: MS_Access_Professionals@yahoogroups.com
[mailto:MS_Access_Professionals@yahoogroups.com] On Behalf Of novice012000
Sent: Thursday, July 28, 2011 8:01 AM
To: MS_Access_Professionals@yahoogroups.com
Subject: [MS_AccessPros] Re: help with vbs script code

This is the entire script.
Thanks for your help.
Sarah
--- In MS_Access_Professionals@yahoogroups.com
<mailto:MS_Access_Professionals%40yahoogroups.com> , "Bill Mosca" <wrmosca@...>
wrote:
>
> Sarah
>
> Let me see what I can do with this. Is there any more code in the VBScipt
file?
>
> Bill Mosca
>
> --- In MS_Access_Professionals@yahoogroups.com
<mailto:MS_Access_Professionals%40yahoogroups.com> , "novice012000" <sarahk@>
wrote:
> >
> > The following is not related directly to MSAccess, but since there are great
experts in this group, I am allowing myself to post the question here. I have
exhausted other possibilities.
> > I have the following code that I run from a command prompt with wscript. It
reads the contents of a file that I pass to the script. The file content has the
name of an image file (.jpg) that I want to automatically open. Everything works
fine, I display the file name first and it is correct, but the wshell.open does
not do anything, or maybe it does open the file but closes it immediately,
because I also tried the command with the hard coded file name (now commented
out) and I think I see it flashing in the background, but it is immediately
closed. The script does not return any error messages.
> >
> > Here it is:
> > Option Explicit
> > Dim objargs, INputfile, objFso,objFile, objReadfile, strContents,
LoadPicture, stypic, wshell, shell
> > set objargs=wscript.arguments
> > INputfile = objargs(0)
> > Set objFSO = CreateObject("Scripting.FileSystemObject")
> > Set objFile = objFSO.GetFile(inputfile)
> > Set objReadFile = objFSO.OpenTextFile(inputfile, 1)
> > strContents = objReadFile.ReadAll
> > Wscript.Echo strContents
> > 'objReadFile.Close
> > set wShell = CreateObject("Shell.Application")
> > wShell.Open strContents
> >
> > 'wShell.open "F:\SCHEME\SUBCMT\STYLES\pictures\Scenic001.jpg"
> >
> > ' Set wshell = Nothing
> >
> > I checked that strContents contains
"F:\SCHEME\SUBCMT\STYLES\pictures\Scenic001.jpg" and the file exsits, but
'nothing' happens when wshell.open is executed.
> >
> > All help is as always greatly appreciated.
> > Sarah
> >
>

[Non-text portions of this message have been removed]

__._,_.___
Recent Activity:
.

__,_._,___

Tidak ada komentar:

Posting Komentar