Could somebody give me a hand with writing a script whereby an Internet
Explorer window can be used to browse a series of pictures, as if browsing
them on a website?

I have the code for creating an IE window, but don't know how to put images
on different pages within that window. It would be great to use the
backwards and forwards arrow buttons to browse these images, if that is
possible.

--
Charles Dean

Re: VBScript and Internet Explorer by Paul

Paul
Mon Sep 03 05:55:38 PDT 2007

Hi, Charles
Are you saying
1a) you have a folder with a bunch of pictures in it and you want to display
these pictures, and you want a way to display those pictures one at a time,
perhaps giving the user forward and back buttons to control which picture to
view?

1b) maybe give the person a window full of thumbnails and allow the user to
click on any thumbnail to view that picture; on that single-picture page
perhaps giving the user forward and back buttons as well as a button to go
back to the thumbnails page?

1c) slide show - pictures from your folder sequentially or randomly show in
the window at some fixed or user setable interval?

2) the user navigates to some web page manually and the script 'clicks' the
links to explore the web of pages automagically?

3) something else?

-Paul Randall

"CCDEAN100" <CCDEAN100@discussions.microsoft.com> wrote in message
news:21F8BB6E-DA7A-4F19-850D-AC9AD037A9F4@microsoft.com...
>
> Could somebody give me a hand with writing a script whereby an Internet
> Explorer window can be used to browse a series of pictures, as if browsing
> them on a website?
>
> I have the code for creating an IE window, but don't know how to put
> images
> on different pages within that window. It would be great to use the
> backwards and forwards arrow buttons to browse these images, if that is
> possible.
>
> --
> Charles Dean



Re: VBScript and Internet Explorer by CCDEAN100

CCDEAN100
Mon Sep 03 06:04:01 PDT 2007


Hi Paul

I think option 1b is what I'm looking for - I have a folder full of images
which I would like users to be able to browse through using backwards and
forwards buttons.

The use of a thumbnail index page would be nice as well if it's not too
complicated.

Thanks for the offer of help

Re: VBScript and Internet Explorer by mayayana

mayayana
Mon Sep 03 06:18:32 PDT 2007

This is a script that writes an IE page for
a given folder and then generates thumbnails
of all the images in the folder, with options to
show actual image size and to open the image
full-size in a second window.

http://www.jsware.net/jsware/scripts.php3#picview

I'm not sure whether I've ever actually tested it
in IE6+, but it should work. The only catch I can think
of offhand is that it opens a window offscreen to get
the actual image size and displays that in the status bar.
Both those actions may be blocked in IE7.
The script uses the ThumbCtl control in webvw.dll,
which I think is installed on all windows versions, but if
you have any trouble it could probably also be done by
just coding specific width and height in the IMG tags
for the thumbnail versions.




Re: VBScript and Internet Explorer by McKirahan

McKirahan
Mon Sep 03 06:43:45 PDT 2007

"CCDEAN100" <CCDEAN100@discussions.microsoft.com> wrote in message
news:21F8BB6E-DA7A-4F19-850D-AC9AD037A9F4@microsoft.com...
>
> Could somebody give me a hand with writing a script whereby an Internet
> Explorer window can be used to browse a series of pictures, as if browsing
> them on a website?
>
> I have the code for creating an IE window, but don't know how to put
images
> on different pages within that window. It would be great to use the
> backwards and forwards arrow buttons to browse these images, if that is
> possible.

Are you familiar with HTA's (HTML Applications)?

Try this script "as-is".

It creates a selection list of all pictures in the current folder,
displays the first, then allows any picture to be displayed.

Put it in a folder with pictures then run it;
(e.g. double-click on it under Windows Explorer).

Use the up and down arrows to move among the pictures;
also, any picture may selected by clicking on its filename.

<html>
<head>
<title>Pictures.hta</title>
<HTA:Application ID = "HTA"
ApplicationName = "Pictures"
Border = "thin"
BorderStyle = "normal"
Caption = "yes"
Icon = ""
MaximizeButton = "yes"
MinimizeButton = "yes"
ShowInTaskBar = "yes"
SingleInstance = "yes"
SysMenu = "yes"
Version = "1.0"
WindowState = "maximize"
>
<script type="text/vbscript">
'****
'* This identifies all pictures in the current folder
'* and provides for their selection and display.
'****
Option Explicit
'*
'* Declare Constants
'*
Const cIMG = ".bmp|.gif|.jpg|.jpeg|.png"
Const cPIC = "<img src=`*` border=`0` title=`?`>"
'*
'* Declare Variables
'*
Dim i,j,k
Dim strDIR
Dim arrFIL()
Dim intFIL
intFIL = 0
Dim strFIL
Dim strGFI
Dim arrIMG
arrIMG = Split(cIMG,"|")
Dim intIMG
Dim strIMG
Dim strPIC
'*
'* Declare Objects
'*
Dim objFSO
Dim objGFO
Dim objOPT
Dim objWSS

Sub Window_Onload()
'*
'* Window Onload
'*
Alert("Click 'OK' to find pictures. Please be patient.")
'*
'* Assign Objects
'*
Set objWSS = CreateObject("WScript.Shell")
strDIR = objWSS.CurrentDirectory & "\"
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objGFO = objFSO.GetFolder(strDIR)
'*
'* Find Pictures
'*
For Each strGFI in objGFO.Files
strFIL = strGFI.Name
For intIMG = 0 To UBound(arrIMG)
strIMG = arrIMG(intIMG)
If Right(LCase(strFIL),Len(strIMG)) = strIMG Then
ReDim Preserve arrFIL(intFIL)
arrFIL(intFIL) = LCase(strFIL) & "=" & strFIL
intFIL = intFIL + 1
End If
Next
Next
'*
'* Destroy Objects
'*
Set objGFO = Nothing
Set objFSO = Nothing
Set objWSS = Nothing
'*
'* Sort Pictures
'*
For i = UBound(arrFIL) - 1 To 0 Step -1
For j = 0 To i
If arrFIL(j) > arrFIL(j+1) Then
k = arrFIL(j+1)
arrFIL(j+1) = arrFIL(j)
arrFIL(j) = k
End If
Next
Next
'*
'* List Pictures
'*
For intFIL = 0 To UBound(arrFIL)
strFIL = Split(arrFIL(intFIL),"=")(1)
Set objOPT = document.createElement("OPTION")
objOPT.Text = strFIL
objOPT.Value = strFIL
document.form1.Pictures.Add(objOPT)
Set objOPT = Nothing
Next
document.getElementById("Pictures").size = intFIL
'*
'* Show Picture
'*
strFIL = Split(arrFIL(0),"=")(1)
strPIC = Replace(cPIC,"*",strDIR & strFIL)
strPIC = Replace(strPIC,"?",strFIL)
document.getElementById("Pictured").innerHTML = strPIC
document.getElementById("Pictures").focus()
document.title = document.title & " -- " & strDIR
End Sub

Sub Picture()
'*
'* Show Picture
'*
strFIL = document.getElementById("Pictures").value
strPIC = Replace(cPIC,"*",strDIR & strFIL)
strPIC = Replace(strPIC,"?",strFIL)
document.getElementById("Pictured").innerHTML = strPIC
End Sub
</script>
</head>
<body>
<form name="form1">
<table border="0" width="100%">
<tr valign="top">
<td width="200">
<select name="Pictures" id="Pictures" size="1"
onchange="Picture()" style="font-size:8pt">
</select>
</td>
<td>
<span id="Pictured"></span>
</td>
</tr>
</table>
</form>
</body>
</html>



Re: VBScript and Internet Explorer by CCDEAN100

CCDEAN100
Mon Sep 03 08:42:00 PDT 2007


Hi Paul - on second thoughts, I think the first option you presented is more
suitable for what I'm trying to do - an IE window which has forward/back
buttons to browse through a set of pictures in a folder.

Is this possible?

Re: VBScript and Internet Explorer by McKirahan

McKirahan
Mon Sep 03 08:48:19 PDT 2007

"CCDEAN100" <CCDEAN100@discussions.microsoft.com> wrote in message
news:7D7D585C-3EB0-4CB9-A1FA-C8A8EF43B7A3@microsoft.com...
>
> Hi Paul - on second thoughts, I think the first option you presented is
more
> suitable for what I'm trying to do - an IE window which has forward/back
> buttons to browse through a set of pictures in a folder.
>
> Is this possible?

Did you see the solution I posted?



Re: VBScript and Internet Explorer by Paul

Paul
Mon Sep 03 09:35:46 PDT 2007


"CCDEAN100" <CCDEAN100@discussions.microsoft.com> wrote in message
news:7D7D585C-3EB0-4CB9-A1FA-C8A8EF43B7A3@microsoft.com...
>
> Hi Paul - on second thoughts, I think the first option you presented is
> more
> suitable for what I'm trying to do - an IE window which has forward/back
> buttons to browse through a set of pictures in a folder.
>
> Is this possible?

Hi
I would go with McKirahan's HTA solution if possible, or at least look at it
and see if it can be modified to do what you want. HTAs are easy to work
with and are essentially a web page with special privileges -- access to
your system without annoying warnings. They can be scripted with VBScript
and other scripting languages, and can use the standard HTML controls like
buttons and stuff.

Create a folder with a few pictures in it and McKirahan's <html> ... </html>
stored in a plain text file with a .hta extension. When you double click
the hta, it should open a window, tell you to be patient, wait for you to
click OK, and immediately display a list of picture file names on the left,
and one of the pictures on the left. If there are things about it you want
to change, let us know. If you have special requirements, like needing to
start it from some proprietary system, let us know that too.

Scan the script and I think you will get a feel for how it works. Changing
the user interface (forward/back buttons for instance) is easily
accomplished. Groups.Google in microsoft's scripting groups will find lots
of hta examples. One example of how to do a lot of things is ScriptOMatic,
an HTA which gets a list of types of info available about your system
through the WMI service and can build VBScripts to display that info.

-Paul Randall



Re: VBScript and Internet Explorer by CCDEAN100

CCDEAN100
Mon Sep 03 09:46:03 PDT 2007


Hi McKirahan

I tried the code you suggested, but I get an error message in the first
line. Is it to be run from a standard .vbs file?

Thanks

Re: VBScript and Internet Explorer by McKirahan

McKirahan
Mon Sep 03 09:51:20 PDT 2007

"CCDEAN100" <CCDEAN100@discussions.microsoft.com> wrote in message
news:0C5E1B95-0380-46D9-B9CF-70E256EF630B@microsoft.com...
>
> Hi McKirahan
>
> I tried the code you suggested, but I get an error message in the first
> line. Is it to be run from a standard .vbs file?

Save it as "Pictures.hta"; (per the title tag).



Re: VBScript and Internet Explorer by CCDEAN100

CCDEAN100
Mon Sep 03 10:04:10 PDT 2007

Thanks, that's great. It looks really professional.

Two questions though:

1) How do I put a text title at the top of the HTML page, such as "My
Pictures".

2) Is it possible to activate the .hta file from a VBSCript (.vbs) file?

Thanks again

Re: VBScript and Internet Explorer by McKirahan

McKirahan
Mon Sep 03 10:13:34 PDT 2007

"CCDEAN100" <CCDEAN100@discussions.microsoft.com> wrote in message
news:5969EC19-E241-4790-82F9-F307795041AB@microsoft.com...
> Thanks, that's great. It looks really professional.

Thank you.

> Two questions though:
>
> 1) How do I put a text title at the top of the HTML page, such as "My
> Pictures".
>
> 2) Is it possible to activate the .hta file from a VBSCript (.vbs) file?

1) Just add a title after the <body> tag; e.g.: <b>My Pictures</b>

2) Why? (You may have a reason for needing to do this.)

If not then just invoke it the same way that you would a VBS;
that is, by double-clicking on it via Windows Explorer or
invoking a shortcut that you've created to point to it.




Re: VBScript and Internet Explorer by McKirahan

McKirahan
Mon Sep 03 10:28:26 PDT 2007

"McKirahan" <News@McKirahan.com> wrote in message
news:1-idnanHMOIMkkHbnZ2dnUVZ_qqgnZ2d@comcast.com...
> "CCDEAN100" <CCDEAN100@discussions.microsoft.com> wrote in message
> news:21F8BB6E-DA7A-4F19-850D-AC9AD037A9F4@microsoft.com...
> >
> > Could somebody give me a hand with writing a script whereby an Internet
> > Explorer window can be used to browse a series of pictures, as if
browsing
> > them on a website?
> >
> > I have the code for creating an IE window, but don't know how to put
> images
> > on different pages within that window. It would be great to use the
> > backwards and forwards arrow buttons to browse these images, if that is
> > possible.
>
> Are you familiar with HTA's (HTML Applications)?
>
> Try this script "as-is".

Change
Const cEXT = ".bmp|.gif|.jpg|.jpeg|.png"
to
Const cEXT = ".gif|.jpg|.jpeg|.png"
as Web pages cannot show BMP images.



Re: VBScript and Internet Explorer by CCDEAN100

CCDEAN100
Mon Sep 03 10:32:05 PDT 2007


I would really like to run it from a .vbs file - I'll explain why.

I've been using a program which is effectively a platform for running
VBScript files, but they are not of the .vbs extension. Instead, they are of
an extension customised to the program (.SI-r). Effectively, these files are
simply .vbs files, with some added extras.

I am trying to incporate the .hta file into the program, and therefore would
like to be able to run it from the program as I would the other (.SI-r) files.

Is running a .hta file from a VBScript file very difficult? The code I need
would be the same as that for loading a .hta file from a .vbs file.

Hope you can help

Re: VBScript and Internet Explorer by ekkehard

ekkehard
Mon Sep 03 10:39:45 PDT 2007

CCDEAN100 schrieb:
> I would really like to run it from a .vbs file - I'll explain why.
>
> I've been using a program which is effectively a platform for running
> VBScript files, but they are not of the .vbs extension. Instead, they are of
> an extension customised to the program (.SI-r). Effectively, these files are
> simply .vbs files, with some added extras.
>
> I am trying to incporate the .hta file into the program, and therefore would
> like to be able to run it from the program as I would the other (.SI-r) files.
>
> Is running a .hta file from a VBScript file very difficult? The code I need
> would be the same as that for loading a .hta file from a .vbs file.
>
> Hope you can help
Try
CreateObject( "WScript.Shell" ).Run "<full file spec of your .hta>"

Re: VBScript and Internet Explorer by Paul

Paul
Mon Sep 03 10:41:05 PDT 2007


"McKirahan" <News@McKirahan.com> wrote in message
news:J-ednagkcZsj3UHbnZ2dnUVZ_j6dnZ2d@comcast.com...
> "CCDEAN100" <CCDEAN100@discussions.microsoft.com> wrote in message
> news:5969EC19-E241-4790-82F9-F307795041AB@microsoft.com...
>> Thanks, that's great. It looks really professional.
>
> Thank you.
>
>> Two questions though:
>>
>> 1) How do I put a text title at the top of the HTML page, such as "My
>> Pictures".
>>
>> 2) Is it possible to activate the .hta file from a VBSCript (.vbs) file?
>
> 1) Just add a title after the <body> tag; e.g.: <b>My Pictures</b>
>
> 2) Why? (You may have a reason for needing to do this.)
>
> If not then just invoke it the same way that you would a VBS;
> that is, by double-clicking on it via Windows Explorer or
> invoking a shortcut that you've created to point to it.

From a .VBS-created shell object, the standard old shell run will run a
.HTA, won't it?

-Paul Randall



Re: VBScript and Internet Explorer by CCDEAN100

CCDEAN100
Mon Sep 03 11:00:03 PDT 2007


What syntax would I need in order to try that?

Re: VBScript and Internet Explorer by Paul

Paul
Mon Sep 03 12:00:12 PDT 2007


"CCDEAN100" <CCDEAN100@discussions.microsoft.com> wrote in message
news:6B3819D2-41FF-42C9-877F-D6737C08C5BE@microsoft.com...
>
> What syntax would I need in order to try that?

As ekkehard said,
CreateObject( "WScript.Shell" ).Run "<full file spec of your .hta>"
or more specifically to run the HTA located in the root of your C: drive:
CreateObject( "WScript.Shell" ).Run "c:\myPictures.hta"

or you might like createing a separate shell object first and use that same
shell object elsewhere in your script:
Set objShell = CreateObject("WScript.Whell")
objShell.Run "c:\myPictures.hta"



Re: VBScript and Internet Explorer by CCDEAN100

CCDEAN100
Mon Sep 03 12:56:00 PDT 2007


Thanks guys, it works a treat

Re: VBScript and Internet Explorer by McKirahan

McKirahan
Mon Sep 03 15:30:47 PDT 2007

"CCDEAN100" <CCDEAN100@discussions.microsoft.com> wrote in message
news:DC3CB043-695F-4E9D-A2F3-AA2AA2393B13@microsoft.com...
>
> Thanks guys, it works a treat

Here's a VBScript version: "Pictures.vbs".

"Sub Append(strSTR)" and "Function Concat()" are used
(instead of concatenatination) to build the HTML string.

Also, "strDIR" could be dynamically set to a different directory.

'****
'* This script identifies all pictures under the current directory
'* via a selection list and allows for each to be displayed.
'****
Option Explicit
'*
'* Declare Constants
'*
Const cVBS = "Pictures.vbs"
Const cEXT = ".gif|.jpg|.jpeg|.png"
Const cIMG = "<br><img src=`*?` border=`0` title=`?`>"
'*
'* Declare Variables
'*
Dim i,j,k
Dim booDIR
Dim strDIR
strDIR = WScript.ScriptFullName
strDIR = Left(strDIR,InStrRev(strDIR,"\"))
Dim arrEXT
arrEXT = Split(cEXT,"|")
Dim intEXT
Dim strEXT
Dim arrFIL()
Dim intFIL
intFIL = 0
Dim strFIL
Dim strGFI
Dim strIMG
Dim intOPT
Dim intSIZ
intSIZ = 1
Dim arrSTR()
ReDim arrSTR(100)
Dim intSTR
intSTR = 0
Dim strSTR
'*
'* Declare Objects
'*
Dim objFSO
Dim objGFO
Dim objIEA
Dim objWSS
'*
'* Pictures()
'*
MsgBox "Click 'OK' to find pictures. Please be
patient.",vbInformation,cVBS
Call Pictures()

Sub Append(strSTR)
'****
'* Appends strings to array entries ReDim as needed; (see "Concat()").
'****
strSTR = strSTR & ""
If intSTR > UBound(arrSTR) Then
ReDim Preserve arrSTR(UBound(arrSTR) + 100)
End If
arrSTR(intSTR) = strSTR & vbCrLf
intSTR = intSTR + 1
End Sub

Function Concat()
'****
'* Concatenates array entries into a single string; (see "Append()").
'****
Redim Preserve arrSTR(intSTR)
Concat = Replace(Join(arrSTR, ""),"`",Chr(34))
Erase arrSTR
ReDim arrSTR(100)
intSTR = 0
End Function

Sub Pictures()
'****
'* Pictures()
'****
'*
'* Find Pictures
'*
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objGFO = objFSO.GetFolder(strDIR)
For Each strGFI in objGFO.Files
strFIL = strGFI.Name
For intEXT = 0 To UBound(arrEXT)
strEXT = arrEXT(intEXT)
If Right(LCase(strFIL),Len(strEXT)) = strEXT Then
ReDim Preserve arrFIL(intFIL)
arrFIL(intFIL) = LCase(strFIL) & "=" & strFIL
intFIL = intFIL + 1
If intSIZ < 47 Then intSIZ = intSIZ + 1
End If
Next
Next
Set objGFO = Nothing
Set objFSO = Nothing
'*
If intFIL = 0 Then
MsgBox "No pictures in " & strDIR,vbExclamation,cVBS
Exit Sub
End If
'*
'* Sort Pictures
'*
For i = UBound(arrFIL) - 1 To 0 Step -1
For j = 0 To i
If arrFIL(j) > arrFIL(j+1) Then
k = arrFIL(j+1)
arrFIL(j+1) = arrFIL(j)
arrFIL(j) = k
End If
Next
Next
'*
'* Show Picture (first)
'*
strFIL = Split(arrFIL(0),"=")(1)
strIMG = Replace(cIMG,"*",strDIR)
strIMG = Replace(strIMG,"?",strFIL)
'*
'* Make Page
'*
Append "<form style=`margin:0px; padding:0px` name=`form1`>"
Append "<table border=`0` cdellpadding=`0` cellspacing=`0`
width=`100%`>"
Append "<tr valign=`top`>"
Append " <td width=`2`>&nbsp;</td>"
Append " <td width=`200` style=`font-family:Arial; font-size:8pt`>"
Append " <span><b>&equiv; " & intFIL & " Pictures</b></span>"
Append " <br>"
Append " <select id=`Pictures` onchange=`Picture()` size=`" & intSIZ
& "`"
Append " style=`font-family:Arial; font-size:8pt`>"
For intFIL = 0 To UBound(arrFIL)
strFIL = Split(arrFIL(intFIL),"=")(1)
Append " <option value=`" & strFIL & "`>" & strFIL
Next
Append " </select>"
Append " </td>"
Append " <td width=`2`>&nbsp;</td>"
Append " <td>"
Append " <span id=`Pictured`>" & strIMG & "</span>"
Append " </td>"
Append "</tr>"
Append "</table>"
Append "</form>"
Append "<script type=`text/vbscript`>"
Append "Sub Picture()"
Append " Const cIMG = `<br><img src='*?' border='0' title='?'>`"
Append " Dim strDIR"
Append " strDIR = " & Chr(34) & strDIR & Chr(34)
Append " Dim strFIL"
Append " strFIL = document.getElementById(`Pictures`).value"
Append " Dim strIMG"
Append " strIMG = Replace(cIMG,`*`,strDIR)"
Append " strIMG = Replace(strIMG,`?`,strFIL)"
Append " document.getElementById(`Pictured`).InnerHTML = strIMG"
Append " window.status = strFIL"
Append "End Sub"
Append "window.status = " & Chr(34) & Split(arrFIL(0),"=")(1) & Chr(34)
Append "document.getElementById(`Pictures`).selectedIndex = 0"
Append "document.getElementById(`Pictures`).focus()"
Append "</script>"
'*
'* Show Page
'*
Set objIEA = CreateObject("InternetExplorer.Application")
objIEA.ToolBar = 0
objIEA.StatusBar = 1
objIEA.Width = 1024
objIEA.Height = 740
objIEA.Left = 0
objIEA.Top = 0
objIEA.Visible = True
objIEA.Navigate "about:blank"
While objIEA.Busy
Wend
objIEA.Document.Write(Concat())
objIEA.Document.Title = cVBS & " -- " & strDIR
End Sub



Re: VBScript and Internet Explorer by CCDEAN100

CCDEAN100
Tue Sep 04 11:16:04 PDT 2007



Hi, I tried the VBScript version, but I get a 'Variable is
undefined:WScript' on line 19. Can anyone tell me why this is happening?



Re: VBScript and Internet Explorer by Paul

Paul
Tue Sep 04 12:35:18 PDT 2007


"CCDEAN100" <CCDEAN100@discussions.microsoft.com> wrote in message
news:3D3E8116-056D-4C31-A938-42011C5BAA39@microsoft.com...
>
>
> Hi, I tried the VBScript version, but I get a 'Variable is
> undefined:WScript' on line 19. Can anyone tell me why this is happening?

Didn't you have this problem with one of the earliest scripts I suggested a
month ago or so? Maybe your system that uses SI-r scripting doesn't know
about the WScript object? As I recall, at that time, the script failed on a
WScript.Sleep statement. This object is always available in WSH (windows
scripting host).

-Paul Randall.



Re: VBScript and Internet Explorer by CCDEAN100

CCDEAN100
Tue Sep 04 12:54:01 PDT 2007


Yes, you're right. I remembered after posting the query earlier.

I've actually managed to avoid using the WScript command in the file on this
occasion - I changed the strDIR variable to equal the path name where the
pictures are located.

The result is the same; the IE window is created with a list of the pictures
in a box in the top left corner. The only difference is that the pictures
fail to be displayed. Where the picture should be is the icon with a red
cross, demonstrating that the pictures are not being shown.

Do you know what it is I need to change in the script to overcome this?


Re: VBScript and Internet Explorer by McKirahan

McKirahan
Tue Sep 04 14:19:22 PDT 2007

"CCDEAN100" <CCDEAN100@discussions.microsoft.com> wrote in message
news:74BD6568-42FB-47E6-85F3-7B68DB234DCA@microsoft.com...
>
> Yes, you're right. I remembered after posting the query earlier.
>
> I've actually managed to avoid using the WScript command in the file on
this
> occasion - I changed the strDIR variable to equal the path name where the
> pictures are located.
>
> The result is the same; the IE window is created with a list of the
pictures
> in a box in the top left corner. The only difference is that the pictures
> fail to be displayed. Where the picture should be is the icon with a red
> cross, demonstrating that the pictures are not being shown.
>
> Do you know what it is I need to change in the script to overcome this?

Right-clcik on the red X icon then click Proporties;
does the path look correct to you?

The "img" tag's "src=" points to the path and filename;
the path is defined by the value of the variable "strDIR"
which must end with a "\"; does yours?




Re: VBScript and Internet Explorer by Paul

Paul
Tue Sep 04 17:59:59 PDT 2007


"CCDEAN100" <CCDEAN100@discussions.microsoft.com> wrote in message
news:74BD6568-42FB-47E6-85F3-7B68DB234DCA@microsoft.com...
>
> Yes, you're right. I remembered after posting the query earlier.
>
> I've actually managed to avoid using the WScript command in the file on
> this
> occasion - I changed the strDIR variable to equal the path name where the
> pictures are located.
>
> The result is the same; the IE window is created with a list of the
> pictures
> in a box in the top left corner. The only difference is that the pictures
> fail to be displayed. Where the picture should be is the icon with a red
> cross, demonstrating that the pictures are not being shown.
>
> Do you know what it is I need to change in the script to overcome this?

You might let us see what is happening:
Run the script to display the IE Window
Right click somewhere in the white space and choose View Source. This will
open a notepad window displaying the HTML. There should be a section that
looks similar to this:

<span id="Pictured"><br><img src="C:\Documents and Settings\Paul\My
Documents\vbScript\Display Pictures\Howiebigmouth.jpg" border="0"
title="Howiebigmouth.jpg"></span>

Post the contents of the <span element with the id of "Pictured", just as I
have above.

-Paul Randall



Re: VBScript and Internet Explorer by CCDEAN100

CCDEAN100
Wed Sep 05 04:46:02 PDT 2007


Thanks for the tip - I added a "\" to the path name, and it now works
perfectly.



Re: VBScript and Internet Explorer by CCDEAN100

CCDEAN100
Tue Sep 11 11:20:00 PDT 2007


Hi McKirahan

Thanks for posting the code for creating a picture viewer in VBScript
recently. It works brilliantly. I wondered though, do you know how to
modify the code in order to include an image at the top right (i.e. a logo)
and perhaps a short piece of text at the top in the middle?


--
Charles Dean


"McKirahan" wrote:

> "CCDEAN100" <CCDEAN100@discussions.microsoft.com> wrote in message
> news:DC3CB043-695F-4E9D-A2F3-AA2AA2393B13@microsoft.com...
> >
> > Thanks guys, it works a treat
>
> Here's a VBScript version: "Pictures.vbs".
>
> "Sub Append(strSTR)" and "Function Concat()" are used
> (instead of concatenatination) to build the HTML string.
>
> Also, "strDIR" could be dynamically set to a different directory.
>
> '****
> '* This script identifies all pictures under the current directory
> '* via a selection list and allows for each to be displayed.
> '****
> Option Explicit
> '*
> '* Declare Constants
> '*
> Const cVBS = "Pictures.vbs"
> Const cEXT = ".gif|.jpg|.jpeg|.png"
> Const cIMG = "<br><img src=`*?` border=`0` title=`?`>"
> '*
> '* Declare Variables
> '*
> Dim i,j,k
> Dim booDIR
> Dim strDIR
> strDIR = WScript.ScriptFullName
> strDIR = Left(strDIR,InStrRev(strDIR,"\"))
> Dim arrEXT
> arrEXT = Split(cEXT,"|")
> Dim intEXT
> Dim strEXT
> Dim arrFIL()
> Dim intFIL
> intFIL = 0
> Dim strFIL
> Dim strGFI
> Dim strIMG
> Dim intOPT
> Dim intSIZ
> intSIZ = 1
> Dim arrSTR()
> ReDim arrSTR(100)
> Dim intSTR
> intSTR = 0
> Dim strSTR
> '*
> '* Declare Objects
> '*
> Dim objFSO
> Dim objGFO
> Dim objIEA
> Dim objWSS
> '*
> '* Pictures()
> '*
> MsgBox "Click 'OK' to find pictures. Please be
> patient.",vbInformation,cVBS
> Call Pictures()
>
> Sub Append(strSTR)
> '****
> '* Appends strings to array entries ReDim as needed; (see "Concat()").
> '****
> strSTR = strSTR & ""
> If intSTR > UBound(arrSTR) Then
> ReDim Preserve arrSTR(UBound(arrSTR) + 100)
> End If
> arrSTR(intSTR) = strSTR & vbCrLf
> intSTR = intSTR + 1
> End Sub
>
> Function Concat()
> '****
> '* Concatenates array entries into a single string; (see "Append()").
> '****
> Redim Preserve arrSTR(intSTR)
> Concat = Replace(Join(arrSTR, ""),"`",Chr(34))
> Erase arrSTR
> ReDim arrSTR(100)
> intSTR = 0
> End Function
>
> Sub Pictures()
> '****
> '* Pictures()
> '****
> '*
> '* Find Pictures
> '*
> Set objFSO = CreateObject("Scripting.FileSystemObject")
> Set objGFO = objFSO.GetFolder(strDIR)
> For Each strGFI in objGFO.Files
> strFIL = strGFI.Name
> For intEXT = 0 To UBound(arrEXT)
> strEXT = arrEXT(intEXT)
> If Right(LCase(strFIL),Len(strEXT)) = strEXT Then
> ReDim Preserve arrFIL(intFIL)
> arrFIL(intFIL) = LCase(strFIL) & "=" & strFIL
> intFIL = intFIL + 1
> If intSIZ < 47 Then intSIZ = intSIZ + 1
> End If
> Next
> Next
> Set objGFO = Nothing
> Set objFSO = Nothing
> '*
> If intFIL = 0 Then
> MsgBox "No pictures in " & strDIR,vbExclamation,cVBS
> Exit Sub
> End If
> '*
> '* Sort Pictures
> '*
>