From: DustinT on
Is there a way I can programatically using VB or VBS obtain the number of
pages in a multi-page TIFF image?

From: Tom Lavedas on
On Jul 1, 2:46 pm, DustinT <Dust...(a)discussions.microsoft.com> wrote:
> Is there a way I can programatically using VB or VBS obtain the number of
> pages in a multi-page TIFF image?

I didn't have a multi-page tiff handy to confirm that this works, but
it does return a Page property for a file ...

Const nPageProperty = 13
sPathspec = "D:\somefolder\somewhere"

Set oFolder = CreateObject("Shell.Application").Namespace(sPathspec)

for each sFilename in oFolder.Items
if instr(lcase(sfilename), ".tif") > 0 then
wsh.echo sFileName, "Pages: ", _
oFolder.GetDetailsOf(oFolder.Parsename(sFileName),
nPageProperty)
end if
next

It's written as an example - best run at a command prompt with
cscript.

Tom Lavedas
===========
http://members.cox.net/tglbatch/wsh/
From: DustinT on
Thanks Tom, it worked perfectly. I have to ask, though, where did you get the
constant of PageProperty = 13? The GetDetailsOf syntax that I found only goes
up to 4. Just wondering.

From: Tom Lavedas on
On Jul 1, 10:37 pm, DustinT <Dust...(a)discussions.microsoft.com> wrote:
> Thanks Tom, it worked perfectly. I have to ask, though, where did you get the
> constant of PageProperty = 13? The GetDetailsOf syntax that I found only goes
> up to 4. Just wondering.

After learning there were more than four (40 in fact - not all
populated), I ran this little test script to delineate them ...

with CreateObject ("Shell.Application")
Set oFolder = .Namespace ("C:\Documents and Settings")
For i = 0 to 40
s = s & i & " " & oFolder.GetDetailsOf(oFolder.Items, i) &
vbNewline
Next
end with
wsh.echo s

Which gives this list ...

0 Name
1 Size
2 Type
3 Date Modified
4 Date Created
5 Date Accessed
6 Attributes
7 Status
8 Owner
9 Author
10 Title
11 Subject
12 Category
13 Pages
14 Comments
15 Copyright
16 Artist
17 Album Title
18 Year
19 Track Number
20 Genre
21 Duration
22 Bit Rate
23 Protected
24 Camera Model
25 Date Picture Taken
26 Dimensions
27
28
29 Episode Name
30 Program Description
31
32 Audio sample size
33 Audio sample rate
34 Channels
35 Company
36 Description
37 File Version
38 Product Name
39 Product Version
40 Keywords

Tom Lavedas
===========
http://members.cox.net/tglbatch/wsh/
From: DustinT on
Fantastic, thanks much!