Kamis, 04 Agustus 2011

[MS_AccessPros] Re: help with vbs script code

 



Meanwhile I am doing this:
Set objShell = WScript.CreateObject("WScript.Shell")
IF strContents > "" then ObjShell.run("ois.exe "& strContents)
Set ObjShell=Nothing
it opens the file with MS Picture Manager,

But I would prefer to use:
set wShell = CreateObject("Shell.Application")
wShell.Open strContents
but it does not work!

--- In MS_Access_Professionals@yahoogroups.com, Crystal <strive4peace2008@...> wrote:
>
> Hi Sarah,
>
> is the point of the code just to open a file for viewing?
>
> how about this:
>
> application.FollowHyperlink "F:\SCHEME\SUBCMT\STYLES\pictures\Scenic001.jpg"
>
>
> Warm Regards,
> Crystal
>
> *
> (: have an awesome day :)
> *
>
>
> --- On Tue, 8/2/11, novice012000 <sarahk@...> wrote:
>
> > From: novice012000 <sarahk>
> >
> > 'other John',
> > I tried your suggestion and replaced F:\ with \\servername,
> > but it still does not work. The results are the same.
> > Something flashes very quickly, too quickly for me to see,
> > but maybe it is opening the picture and immediately closing
> > it. It was doing this also when I used F:\.
> > Sarah
> > --- "jfakes.rm" wrote:
> > >
> > > 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: novice012000
> > > >   
> > > >
> > > >
> > > > This is the entire script.
> > > > Thanks for your help.
> > > > Sarah
> > > > --- "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
> > > > >
> > > > > --- "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
> > > > > >
> > > > >
> > > >
>

__._,_.___
Recent Activity:
.

__,_._,___

Tidak ada komentar:

Posting Komentar