Jumat, 29 Juli 2011

[MS_AccessPros] Re: help with vbs script code

 

Sarah,
Here is my two cents (since I don't know VBS thats all my opinion is worth), I never include the mapped drive (in your case F:\) I put the whole server name in for the parameter in case you try to run the program on other machines. If you put the entire path name in, it always works.

Instead of: F:\SCHEME\SUBCMT\STYLES\pictures\Scenic001.jpg

Something like this: \\ServerName\SCHEME\SUBCMT\STYLES\pictures\Scenic001.jpg

The other John :)

--- In MS_Access_Professionals@yahoogroups.com, "Bill Mosca" <wrmosca@...> wrote:
>
> 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