testingtest Posted August 19, 2007 Share Posted August 19, 2007 (edited) ok maybe not pro but someone smarter then me lol. I got a script that looks at pictures and displays them on the gui its working fine but ran into a small problem i want the gui to fit the image. so for example I am looking at a picture with theses dimensions 288 (Width) x 352 (height) ;so the gui is the same size as the picture I want the gui to be like this ; dimensions 288 x 352 GUICreate("Embedded Web control Test" , 288 , 352) GUISetState() while 1 sleep(1000) wend Edited August 19, 2007 by testingtest Link to comment Share on other sites More sharing options...
Valuater Posted August 19, 2007 Share Posted August 19, 2007 (edited) I would think that you will be down-loading the pic anyways...so, that has little to do with IE.au3. Maybe more like getting the pic's dimensions through file info...not IE 8) ... unless it has to be "embedded"... still cant see the use though Edited August 19, 2007 by Valuater Link to comment Share on other sites More sharing options...
PsaltyDS Posted August 19, 2007 Share Posted August 19, 2007 ok maybe not pro but someone smarter then me lol. I got a script that looks at pictures and displays them on the gui its working fine but ran into a small problem i want the gui to fit the image.so for example I am looking at a picture with theses dimensions 288 (Width) x 352 (height) ;so the gui is the same size as the pictureI want the gui to be like thisWell, the GUI is the easy part. I don't suppose you already have a slick way to get metadata from the picture file for width and height in pixels?I worked on a tweak to a function by Simucal that I called _FileGetExtProp(). It should be able to get the width and height from properties number 27 and 28, but alas, in my versions of XP, it's broke and only shows the first eight properties (see the notes at the bottom of that post).You can try it with your Windows version/patch level and see if it works. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
nooby Posted August 19, 2007 Share Posted August 19, 2007 (edited) I'm not an IE expert, I don't even know HTML, but I'm guessing that using lines like: <img src='http://www.example.com/test.gif' width='50' height='50' alt='' /> you can adjust the width/height of the picture, in this case 50x50. If this does infact work (correct me if i'm wrong) than perhaps the script will produce a "prewritten" .htm file. Something like.. $FileLines = "<img src='" & $PictureLink & "' width='50' height='50' alt='' />" FileWrite("test.htm", $FileLines) $oIE.navigate("test.htm") I'm only guessing that the line of HTML will allow you to adjust the width/height of the picture. Good luck. Edited August 19, 2007 by nooby Link to comment Share on other sites More sharing options...
_Kurt Posted August 19, 2007 Share Posted August 19, 2007 Great idea.. Here's an example.. this will scale out ANY picture to your GUI: $oIE = ObjCreate("Shell.Explorer.2") GUICreate("Embedded Web control Test", 288, 352) $GUIActiveX = GUICtrlCreateObj($oIE, 0, 0, 288, 352) GUISetState() ViewPicture("http://www.autoitscript.com/forum/uploads/av-9334.jpg") While 1 Sleep(50) $msg = GUIGetMsg() If $msg = -3 Then Exit WEnd Func ViewPicture($Link) FileDelete(@ScriptDir & "\test.htm") Sleep(500) $Lines = '<html>' & @CRLF & _ "<img src='" & $Link & "' width='245' height='312' alt='' />" & @CRLF & _ '</html>' FileWrite(@ScriptDir & "\test.htm", $Lines) Sleep(500) $oIE.navigate(@ScriptDir & "\test.htm") $oIE.document.body.scroll = "no" EndFunc In this example, it scales out PsaltyDS's avatar to fit the GUI. Kurt Awaiting Diablo III.. Link to comment Share on other sites More sharing options...
Richard Robertson Posted August 19, 2007 Share Posted August 19, 2007 No, he is looking to change the GUI to fit the image, not the image to fit the GUI. Try parsing the html image tag. If it does not contain width and height values, you are stuck looking for metadata. Link to comment Share on other sites More sharing options...
_Kurt Posted August 19, 2007 Share Posted August 19, 2007 Woops, sorry >.< Got to start reading more carefully Kurt Awaiting Diablo III.. Link to comment Share on other sites More sharing options...
testingtest Posted August 19, 2007 Author Share Posted August 19, 2007 ok it was a secret but here you'll get a better idea it is to view live video feed of webcams but some are different sizes expandcollapse popup#include <GUIConstants.au3> #include <IE.au3> MsgBox(0 , "Note" , "some cameras have a set refresh rate so be patient") Global $Feed $GUI = GUICreate("Live Cam By Proxy-Demon", 237, 50) $Feed = GUICtrlCreateCombo("Live Feed Camera", 0, 0, 235, @DesktopHeight) GUICtrlSetData(-1, "CN Tower|Niagara Falls") $Select = GUICtrlCreateButton("Select...", 0, 24, 75, 25, 0) $About = GUICtrlCreateButton("About", 80, 24, 75, 25, 0) $Exit = GUICtrlCreateButton("Exit", 160, 24, 75, 25, 0) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Select _Select() Case $About MsgBox(0,"About","I have made this so people can acess just a few cool cameras that are live feed and most of them are Canadian cameras." & @CRLF & @CRLF & "You never know what you might see." & @CRLF & @CRLF & " ") Case $Exit Exit EndSwitch WEnd Func _Select() If GUICtrlRead($Feed) = "" Then _Error() If GUICtrlRead($Feed) = "Live Feed Camera" Then _Error() If GUICtrlRead($Feed) = "CN Tower" Then _Refresh("http://www.2ontario.com/webcam/oissouth.jpg") If GUICtrlRead($Feed) = "Niagara Falls" Then _IECreate("mms://niagaracam.protected.ca/niagara" , 0 , 1 , 1 , 0) EndFunc Func _Refresh($Site) ;manual buffering $oIE = ObjCreate("Shell.Explorer.2") ;600x400 GUICreate("Embedded Web control Test" , 600 , 400) $GUIActiveX = GUICtrlCreateObj($oIE , 0 , 0 , 600 , 360) $GUI_Refresh = GuiCtrlCreateButton("Refresh" , 0 , 360 , 100, 30) GUISetState() $oIE.navigate($Site) While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $GUI_Refresh $oIE.navigate($Site) EndSelect Wend GUIDelete () EndFunc ; 288x352 Func _Error() MsgBox(0 , "Error" , "that is not a proper video feed") EndFunc ;mms://niagaracam.protected.ca/niagara Link to comment Share on other sites More sharing options...
_Kurt Posted August 19, 2007 Share Posted August 19, 2007 Well just as I was reading your post, I had finished a working example: expandcollapse popup$oIE = ObjCreate("Shell.Explorer.2") $GUI = GUICreate("Embedded Web control Test", 288, 352) $GUIActiveX = GUICtrlCreateObj($oIE, -28, -60, 1000, 1000) GUISetState() ViewPicture("http://www.autoitscript.com/forum/uploads/av-4920.jpg") While 1 Sleep(50) $msg = GUIGetMsg() If $msg = -3 Then Exit WEnd Func ViewPicture($Link) $File = @ScriptDir & "\test." & StringRight($Link, 3) $GuiSize = WinGetPos($GUI) InetGet($Link, $File) $Width = StringTrimRight(_GetExtProperty($File, 27),7) $Height = StringTrimRight(_GetExtProperty($File, 28), 7) WinMove($GUI, "", $GuiSize[0], $GuiSize[1], $Width+11, $Height+34) GUICtrlSetPos($GUIActiveX, -11, -16, $Width+22, $Height+34) $oIE.navigate($Link) $oIE.document.body.scroll = "no" EndFunc Func _GetExtProperty($sPath, $iProp) Local $iExist, $sFile, $sDir, $oShellApp, $oDir, $oFile, $aProperty, $sProperty $iExist = FileExists($sPath) If $iExist = 0 Then SetError(1) Return 0 Else $sFile = StringTrimLeft($sPath, StringInStr($sPath, "\", 0, -1)) $sDir = StringTrimRight($sPath, (StringLen($sPath) - StringInStr($sPath, "\", 0, -1))) $oShellApp = ObjCreate("shell.application") $oDir = $oShellApp.NameSpace ($sDir) $oFile = $oDir.Parsename ($sFile) If $iProp = -1 Then Local $aProperty[35] For $i = 0 To 34 $aProperty[$i] = $oDir.GetDetailsOf ($oFile, $i) Next Return $aProperty Else $sProperty = $oDir.GetDetailsOf ($oFile, $iProp) If $sProperty = "" Then Return 0 Else Return $sProperty EndIf EndIf EndIf EndFunc This seems to get the scales perfectly. Kurt Awaiting Diablo III.. Link to comment Share on other sites More sharing options...
testingtest Posted August 19, 2007 Author Share Posted August 19, 2007 (edited) Well just as I was reading your post, I had finished a working example: expandcollapse popup$oIE = ObjCreate("Shell.Explorer.2") $GUI = GUICreate("Embedded Web control Test", 288, 352) $GUIActiveX = GUICtrlCreateObj($oIE, -28, -60, 1000, 1000) GUISetState() ViewPicture("http://www.autoitscript.com/forum/uploads/av-4920.jpg") While 1 Sleep(50) $msg = GUIGetMsg() If $msg = -3 Then Exit WEnd Func ViewPicture($Link) $File = @ScriptDir & "\test." & StringRight($Link, 3) $GuiSize = WinGetPos($GUI) InetGet($Link, $File) $Width = StringTrimRight(_GetExtProperty($File, 27),7) $Height = StringTrimRight(_GetExtProperty($File, 28), 7) WinMove($GUI, "", $GuiSize[0], $GuiSize[1], $Width+11, $Height+34) GUICtrlSetPos($GUIActiveX, -11, -16, $Width+22, $Height+34) $oIE.navigate($Link) $oIE.document.body.scroll = "no" EndFunc Func _GetExtProperty($sPath, $iProp) Local $iExist, $sFile, $sDir, $oShellApp, $oDir, $oFile, $aProperty, $sProperty $iExist = FileExists($sPath) If $iExist = 0 Then SetError(1) Return 0 Else $sFile = StringTrimLeft($sPath, StringInStr($sPath, "\", 0, -1)) $sDir = StringTrimRight($sPath, (StringLen($sPath) - StringInStr($sPath, "\", 0, -1))) $oShellApp = ObjCreate("shell.application") $oDir = $oShellApp.NameSpace ($sDir) $oFile = $oDir.Parsename ($sFile) If $iProp = -1 Then Local $aProperty[35] For $i = 0 To 34 $aProperty[$i] = $oDir.GetDetailsOf ($oFile, $i) Next Return $aProperty Else $sProperty = $oDir.GetDetailsOf ($oFile, $iProp) If $sProperty = "" Then Return 0 Else Return $sProperty EndIf EndIf EndIf EndFunc This seems to get the scales perfectly. Thanks but I tried it and it does not display the image Kurt It doesn't work for me Edited August 19, 2007 by testingtest Link to comment Share on other sites More sharing options...
testingtest Posted August 19, 2007 Author Share Posted August 19, 2007 [edited] above post Link to comment Share on other sites More sharing options...
testingtest Posted August 21, 2007 Author Share Posted August 21, 2007 so no one can help me any further the code didn't work frownie face Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now