Hi all.
Is possible, using VBScript, reading a width and heigth property of one
image?

thank's

Emanuel

Re: Thumbnail by Gabriel

Gabriel
Fri Apr 29 10:03:15 CDT 2005

If you dont know the structure info of every type of graphic file, i thik
that a possible way to do that its to create an internetexplorer.application
object, next create dinamically inside the object the html structure to read
your image file; then, you can access the image properties with your vscript
code normally.

Take a look at this code, its works creating a dinamic html:

Good Luck,

Gabriel.



''' DemoProgress.vbs
dim IEO: set IEO= createObject("InternetExplorer.Application")

dim Count
const zzz= 14
const iEnd= 9
const InLoop= true
const WithLimit= true

on error resume next
do: dim answer: answer= cInt(inputBox("1 2 3","?", left(answer & 4,1)))
select case answer *-(err=0)
case 1: Test1()
case 2: Test2()
case 3: Test3()
case else exit do
end select
loop
set IEO= nothing

function Test1() ''''' Progress Demo, loop repeated iEnd+1 (0...iEnd),
dim i
for i = 0 to iEnd
Progress_oiiiibb IEO,Count, i,iEnd, zzz, InLoop,WithLimit
next
end function

function Test2() ''''' Progress Demo, repeated unknown loops,
dim i
for i = 0 to iEnd
Progress_oiiiibb IEO,Count, i, iEnd, zzz, InLoop,WithLimit
if(0=int(rnd()*6))then exit for
next
Progress_oiiiibb IEO,Count, i+1, iEnd, zzz/2, false,false
end function

function Test3() ''''' Progress Demo, repeated unknown loops,
dim i
const bar= 25
do: Progress_oiiiibb IEO,Count, i, bar, 300, InLoop,NoLimit
' ...
loop until 5=int(rnd()*6)+int(rnd()*6)
Progress_oiiiibb IEO, Count, i, bar, 12, false,false
end function

function Progress_oiiiibb(IEO,byRef Count, byRef i, byVal iEnd, byVal zzz,
byVal InLoop,byVal InLoopWithLimit)
on error resume next
if not cBool(Count) then if InLoop then MakeProgressHTML_o IEO: Count= 0

dim ProgClientW: ProgClientW=IEO.Document.All.objProgress.Style.Width

IEO.Document.All.objInner.Style.Width=cInt(left(ProgClientW,len(ProgClientW)
-2))/(iEnd+1)*(i+1)
IEO.Document.All.objText.Value= Count & " " & iEnd & " " &
cBool(InLoopWithLimit)
wScript.Sleep zzz: Count= Count +1
if InLoopWithLimit then
if(i=iEnd) then InLoop= false
else i= i +1
if i > iEnd then
i= 0
elseIf not InLoop then Count= Count -1: Progress_oiiiibb
IEO,Count,i,iEnd,zzz,0,0: exit function
end if
end if
if InLoop then
exit function
else Count= 0
if (err=0) then
wScript.sleep 400: IEO.Visible= false
else set IEO= createObject("InternetExplorer.Application")
end if
end if
end function

function MakeProgressHTML_o(IEO)
IEO.Navigate("about:blank")
Do: WScript.Sleep 60: Loop Until IEO.ReadyState= 4
With IEO
.Toolbar= false
.StatusBar= false
With .Document
.ParentWindow.ResizeTo 680, 100
.WriteLn("<html><head><title>- Progress -</title><style>")
.Write(".Outer{background-color: #000;}")
.Write(".Inner{background-color:Green;}")
.Write(".txt{position:absolute; top:0; left:50%; background-color:#C0C0C0;
border:0;}")
.Write("body{background-color:#C0C0C0; border:0;}")
.WriteLn("</style><script language=""VBScript"">")
.WriteLn("sub Window_OnLoad()")
.WriteLn("with objProgress")
.WriteLn(".Style.Position= ""Absolute""")
.WriteLn(".Style.Width= Document.Body.clientWidth * .8")
.WriteLn(".Style.Left=(Document.Body.clientWidth - .offsetWidth) / 2")
.WriteLn(".Style.Top= 27")
.WriteLn("end with")
.WriteLn("end sub")
.Write("</script></head><body>")
.WriteLn("<div id=objProgress class=Outer><div id=objInner
class=Inner></div></div>")
.WriteLn("<input id=objText class=txt type=text></body></html>")
End With
.Visible=True
.Document.Location.ReLoad()
.Document.Body.Scroll= "no"
End With
wScript.Sleep 240
end function
''' ?.
''' Benny Pedersen




"Emanuele" <ce_software@libero.it> wrote in message
news:kslce.90099$zZ1.2529567@twister1.libero.it...
> Hi all.
> Is possible, using VBScript, reading a width and heigth property of one
> image?
>
> thank's
>
> Emanuel
>
>



Re: Thumbnail by Emanuele

Emanuele
Fri Apr 29 16:30:50 CDT 2005

Thank's

Emanuele



Re: Thumbnail by mayayana

mayayana
Sat Apr 30 10:01:31 CDT 2005

The following will work but there's one catch:
The LoadPicture function uses a HIMETRIC
dimension value, which is something like metric
twips - it measures a logical size rather than
a pixel size. In most cases this code works because
in most cases the screen will be set to 96 twips/pixel
and the picture size can be calculated from that, but
if someone with bad eyesight has set their system
to show large fonts then they'll have a setting of
120 twips/pixel and you'll get a wrong result (unless
you go to the trouble of looking up their display setting
first).
------------------------
This takes a file path of BMP, JPG, GIF as "sPath1"
and returns width and height in pixels as W1 and H1:

Sub PicObGetSize(sPath1, W1, H1)
Dim oPic
Set oPic = LoadPicture(sPath1)
'-- If display is Set to large fonts use 120 in place of 96.
H1 = (96 * oPic.height) \ 2540
W1 = (96 * oPic.width) \ 2540
Set oPic = Nothing
End Sub



--
_____________________________

mayayXXana1a@mindYYspring.com
For return email remove XX and YY.
_____________________________
Emanuele <ce_software@libero.it> wrote in message
news:kslce.90099$zZ1.2529567@twister1.libero.it...
> Hi all.
> Is possible, using VBScript, reading a width and heigth property of one
> image?
>
> thank's
>
> Emanuel
>
>