Jump to content

What am i not seeing?


BrettF
 Share

Recommended Posts

What is wrong? Why wont the image download???

#include <GUIConstants.au3>
#include <INET.au3>
#include <IE.au3> 
$forcast = ObjCreate("http://www.bom.gov.au/products/IDQ10095.shtml")
$save = @ScriptDir & "\Radar Images\"&@HOUR&":"&@MIN&":"&@MDAY&":"&@MON&":"&@YEAR&".gif"
$site = InetGet ( "http://mirror.bom.gov.au/radar/IDR663.gif" ,$save,1)
Do
    Sleep (100)
Until @InetGetActive = 0
IF $site = 0 Then 
    MsgBox (0, "ERROR", "There was an error updating the radar images.")
EndIf

Global $imgtype
$Form1 = GUICreate("AForm1", 609, 663, 201, 115)
$Pic1 = GUICtrlCreatePic($save, 2, 5, 393, 393, BitOR($SS_NOTIFY, $WS_GROUP))
$Combo1 = GUICtrlCreateCombo("", 408, 72, 97, 25, $CBS_DROPDOWNLIST)
GUICtrlSetData (-1, "64km|128km|256km")
GUICtrlSetState($Combo1, $GUI_CHECKED)
$Radio1 = GUICtrlCreateRadio("Loop", 408, 48, 113, 17)
$Radio2 = GUICtrlCreateRadio("Static", 408, 32, 113, 17)
$Button1 = GUICtrlCreateButton("Update!", 408, 104, 75, 25, 0)
$Group1 = GUICtrlCreateGroup("Radar Options", 400, 0, 202, 145)
$Label1 = GUICtrlCreateLabel("SEQ Weather Radar:", 406, 14, 180, 17)
$Group2 = GUICtrlCreateGroup("Brisbane Forcast", 2, 400, 601, 257)
$Edit1 = GUICtrlCreateEdit("", 8, 416, 585, 233, BitOR($ES_READONLY, $ES_WANTRETURN, $WS_HSCROLL, $WS_VSCROLL))
GUICtrlSetData(-1, _IEBodyReadHTML ($forcast))
$Edit2 = GUICtrlCreateEdit("", 400, 147, 201, 249, BitOR($ES_WANTRETURN, $WS_VSCROLL))
GUICtrlSetData(-1,"Images supplied by the Australian Bureau of Metorology.")
GUISetState(@SW_SHOW)
While 1
    $Msg = GUIGetMsg()
    Select
        Case $Msg = $GUI_EVENT_CLOSE
            Exit
        Case $Msg = $Button1
        $height = GUICtrlRead($Combo1)
        GUICtrlSetData ($Label1, "SEQ Weather Radar: "& $height & ", " & $imgtype)
        Case $Msg = $Label1

            
        Case $Msg = $Edit1

            
        Case $Msg = $Edit2
            
        Case $Msg = $Radio1
            $imgtype = "Loop"
        Case $Msg = $Radio2
            $imgtype = "Static"
    EndSelect
WEnd
Link to comment
Share on other sites

  • Moderators

$save = @ScriptDir & "\Radar Images\"&@HOUR&":"&@MIN&":"&@MDAY&":"&@MON&":"&@YEAR&".gif"

Have you ever saved a file with a colon in it before?

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Of course i have... :)

It still dosnt work. My amended code:

#include <GUIConstants.au3>
#include <INET.au3>
#include <IE.au3> 
$forcast = ObjCreate("http://www.bom.gov.au/products/IDQ10095.shtml")
$save = @ScriptDir & "\Radar Images\"&@HOUR&"-"&@MIN&"_"&@MDAY&"-"&@MON&"-"&@YEAR&".gif"
MsgBox (0, "", $save)
$site = InetGet ( "http://mirror.bom.gov.au/radar/IDR663.gif" ,$save,1)
Do
    Sleep (100)
Until @InetGetActive = 0
IF $site = 0 Then 
    MsgBox (0, "ERROR", "There was an error updating the radar images.")
EndIf

Global $imgtype
$Form1 = GUICreate("AForm1", 609, 663, 201, 115)
$Pic1 = GUICtrlCreatePic($save, 2, 5, 393, 393, BitOR($SS_NOTIFY, $WS_GROUP))
$Combo1 = GUICtrlCreateCombo("", 408, 72, 97, 25, $CBS_DROPDOWNLIST)
GUICtrlSetData (-1, "64km|128km|256km")
GUICtrlSetState($Combo1, $GUI_CHECKED)
$Radio1 = GUICtrlCreateRadio("Loop", 408, 48, 113, 17)
$Radio2 = GUICtrlCreateRadio("Static", 408, 32, 113, 17)
$Button1 = GUICtrlCreateButton("Update!", 408, 104, 75, 25, 0)
$Group1 = GUICtrlCreateGroup("Radar Options", 400, 0, 202, 145)
$Label1 = GUICtrlCreateLabel("SEQ Weather Radar:", 406, 14, 180, 17)
$Group2 = GUICtrlCreateGroup("Brisbane Forcast", 2, 400, 601, 257)
$Edit1 = GUICtrlCreateEdit("", 8, 416, 585, 233, BitOR($ES_READONLY, $ES_WANTRETURN, $WS_HSCROLL, $WS_VSCROLL))
GUICtrlSetData(-1, _IEBodyReadHTML ($forcast))
$Edit2 = GUICtrlCreateEdit("", 400, 147, 201, 249, BitOR($ES_WANTRETURN, $WS_VSCROLL))
GUICtrlSetData(-1,"Images supplied by the Australian Bureau of Metorology.")
GUISetState(@SW_SHOW)
While 1
    $Msg = GUIGetMsg()
    Select
        Case $Msg = $GUI_EVENT_CLOSE
            Exit
        Case $Msg = $Button1
        $height = GUICtrlRead($Combo1)
        GUICtrlSetData ($Label1, "SEQ Weather Radar: "& $height & ", " & $imgtype)
        Case $Msg = $Label1

            
        Case $Msg = $Edit1

            
        Case $Msg = $Edit2
            
        Case $Msg = $Radio1
            $imgtype = "Loop"
        Case $Msg = $Radio2
            $imgtype = "Static"
    EndSelect
WEnd
Link to comment
Share on other sites

  • Moderators

I hate to ask the obvious (because I know the answer), does the Radar Images directory exist already? If it doesn't, what makes you think InetGet() will create it for you?

$save = @ScriptDir & "\Radar Images\"&@HOUR&"-"&@MIN&"_"&@MDAY&"-"&@MON&"-"&@YEAR&".gif"
If Not FileExists(@ScriptDir & '\Radar Images') Then DirCreate(@ScriptDir & '\Radar Images')
MsgBox (0, "", $save)

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Link to comment
Share on other sites

  • Moderators

Thankyou. I do feel such a noob

:">

At least you try...

Some can answer questions, because they read the information somewhere and retained it... Myself, being quite hard headed, answer most of the questions from pure experience :"> :)

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Why is the $pic1 black around the image?

#include <GUIConstants.au3>
#include <INET.au3>
#include <IE.au3> 
$save = @ScriptDir & "\Radar Images\"&@HOUR&"-"&@MIN&"_"&@MDAY&"-"&@MON&"-"&@YEAR&"IDR663.gif"
If Not FileExists(@ScriptDir & '\Radar Images') Then DirCreate(@ScriptDir & '\Radar Images') ; 128km
$site = InetGet ( "http://mirror.bom.gov.au/radar/IDR663.gif" ,$save)
IF $site = 0 Then 
    MsgBox (0, "ERROR", "Brisbane (Mt Stapylton) Radar seems to be unavalible.  Will download Margburg Radar Instead.")
    $save = @ScriptDir & "\Radar Images\"&@HOUR&"-"&@MIN&"_"&@MDAY&"-"&@MON&"-"&@YEAR&"IDR503.gif" ; 
    If Not FileExists(@ScriptDir & '\Radar Images') Then DirCreate(@ScriptDir & '\Radar Images')
    $site2 = InetGet ( "http://mirror.bom.gov.au/radar/IDR503.gif" ,$save2)
EndIf

$save1 = @ScriptDir & "\Radar Images\"&@HOUR&"-"&@MIN&"_"&@MDAY&"-"&@MON&"-"&@YEAR&"IDR664.gif" ;64km
If Not FileExists(@ScriptDir & '\Radar Images') Then DirCreate(@ScriptDir & '\Radar Images')
$site1 = InetGet ( "http://mirror.bom.gov.au/radar/IDR664.gif" ,$save1)
IF $site1 = 0 Then 
    MsgBox (0, "ERROR", "Brisbane (Mt Stapylton) Radar seems to be unavalible.  Will download Margburg Radar Instead.")
EndIf

$save2 = @ScriptDir & "\Radar Images\"&@HOUR&"-"&@MIN&"_"&@MDAY&"-"&@MON&"-"&@YEAR&"IDR662.gif" ; 256km
If Not FileExists(@ScriptDir & '\Radar Images') Then DirCreate(@ScriptDir & '\Radar Images')
$site2 = InetGet ( "http://mirror.bom.gov.au/radar/IDR662.gif" ,$save2)
IF $site2 = 0 Then 
    MsgBox (0, "ERROR", "Brisbane (Mt Stapylton) Radar seems to be unavalible.  Will download Margburg Radar Instead.")
    $save2 = @ScriptDir & "\Radar Images\"&@HOUR&"-"&@MIN&"_"&@MDAY&"-"&@MON&"-"&@YEAR&"IDR502.gif" ;
If Not FileExists(@ScriptDir & '\Radar Images') Then DirCreate(@ScriptDir & '\Radar Images')
$site2 = InetGet ( "http://mirror.bom.gov.au/radar/IDR502.gif" ,$save2)
EndIf

Global $imgtype
$Form1 = GUICreate("AForm1", 747, 845)
$Pic1 = GUICtrlCreatePic($save, 2, 5, 524, 564, BitOR($SS_NOTIFY,$WS_GROUP,$SS_WHITERECT ))
$Combo1 = GUICtrlCreateCombo("64km", 544, 80, 97, 25)
GUICtrlSetData(-1, "128km|256km")
$Button1 = GUICtrlCreateButton("Update!", 544, 112, 75, 25, 0)
$Group1 = GUICtrlCreateGroup("Radar Options", 536, 7, 202, 145)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Label1 = GUICtrlCreateLabel("SEQ Weather Radar:", 538, 22, 150, 34)
$Group2 = GUICtrlCreateGroup("Weather Warnings", 2, 576, 737, 257)
$Edit1 = GUICtrlCreateEdit("", 8, 600, 721, 225, BitOR($ES_AUTOVSCROLL,$ES_AUTOHSCROLL,$ES_READONLY,$ES_WANTRETURN,$WS_HSCROLL,$WS_VSCROLL))
GUICtrlSetData(-1, "AEdit1")
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Edit2 = GUICtrlCreateEdit("", 536, 155, 201, 409, BitOR($ES_AUTOVSCROLL,$ES_WANTRETURN,$WS_VSCROLL))
GUICtrlSetData(-1, "AEdit2")
GUISetState(@SW_SHOW)
While 1
    $Msg = GUIGetMsg()
    Select
        Case $Msg = $GUI_EVENT_CLOSE
            Exit
        Case $Msg = $Button1
        $height = GUICtrlRead($Combo1)
        IF $Height = "64km" Then
            $image = $save1
        ElseIF $Height = "128km" Then
            $image = $save
        ElseIF $Height = "256km" Then
            $image = $save2
        EndIf
        GUICtrlSetData ($Label1, "SEQ Weather Radar: "& $height & @CRLF & "(Mt Stapylton)")
        GUICtrlSetImage ($pic1, $Image)
        Case $Msg = $Label1

            
        Case $Msg = $Edit1

            
        Case $Msg = $Edit2
            
    EndSelect
WEnd
Link to comment
Share on other sites

  • Moderators

Why is the $pic1 black around the image?

CODE
#include <GUIConstants.au3>
#include <INET.au3>
#include <IE.au3> 
$save = @ScriptDir & "\Radar Images\"&@HOUR&"-"&@MIN&"_"&@MDAY&"-"&@MON&"-"&@YEAR&"IDR663.gif"
If Not FileExists(@ScriptDir & '\Radar Images') Then DirCreate(@ScriptDir & '\Radar Images') ; 128km
$site = InetGet ( "http://mirror.bom.gov.au/radar/IDR663.gif" ,$save)
IF $site = 0 Then 
    MsgBox (0, "ERROR", "Brisbane (Mt Stapylton) Radar seems to be unavalible.  Will download Margburg Radar Instead.")
    $save = @ScriptDir & "\Radar Images\"&@HOUR&"-"&@MIN&"_"&@MDAY&"-"&@MON&"-"&@YEAR&"IDR503.gif" ; 
    If Not FileExists(@ScriptDir & '\Radar Images') Then DirCreate(@ScriptDir & '\Radar Images')
    $site2 = InetGet ( "http://mirror.bom.gov.au/radar/IDR503.gif" ,$save2)
EndIf

$save1 = @ScriptDir & "\Radar Images\"&@HOUR&"-"&@MIN&"_"&@MDAY&"-"&@MON&"-"&@YEAR&"IDR664.gif" ;64km
If Not FileExists(@ScriptDir & '\Radar Images') Then DirCreate(@ScriptDir & '\Radar Images')
$site1 = InetGet ( "http://mirror.bom.gov.au/radar/IDR664.gif" ,$save1)
IF $site1 = 0 Then 
    MsgBox (0, "ERROR", "Brisbane (Mt Stapylton) Radar seems to be unavalible.  Will download Margburg Radar Instead.")
EndIf

$save2 = @ScriptDir & "\Radar Images\"&@HOUR&"-"&@MIN&"_"&@MDAY&"-"&@MON&"-"&@YEAR&"IDR662.gif" ; 256km
If Not FileExists(@ScriptDir & '\Radar Images') Then DirCreate(@ScriptDir & '\Radar Images')
$site2 = InetGet ( "http://mirror.bom.gov.au/radar/IDR662.gif" ,$save2)
IF $site2 = 0 Then 
    MsgBox (0, "ERROR", "Brisbane (Mt Stapylton) Radar seems to be unavalible.  Will download Margburg Radar Instead.")
    $save2 = @ScriptDir & "\Radar Images\"&@HOUR&"-"&@MIN&"_"&@MDAY&"-"&@MON&"-"&@YEAR&"IDR502.gif" ;
If Not FileExists(@ScriptDir & '\Radar Images') Then DirCreate(@ScriptDir & '\Radar Images')
$site2 = InetGet ( "http://mirror.bom.gov.au/radar/IDR502.gif" ,$save2)
EndIf

Global $imgtype
$Form1 = GUICreate("AForm1", 747, 845)
$Pic1 = GUICtrlCreatePic($save, 2, 5, 524, 564, BitOR($SS_NOTIFY,$WS_GROUP,$SS_WHITERECT ))
$Combo1 = GUICtrlCreateCombo("64km", 544, 80, 97, 25)
GUICtrlSetData(-1, "128km|256km")
$Button1 = GUICtrlCreateButton("Update!", 544, 112, 75, 25, 0)
$Group1 = GUICtrlCreateGroup("Radar Options", 536, 7, 202, 145)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Label1 = GUICtrlCreateLabel("SEQ Weather Radar:", 538, 22, 150, 34)
$Group2 = GUICtrlCreateGroup("Weather Warnings", 2, 576, 737, 257)
$Edit1 = GUICtrlCreateEdit("", 8, 600, 721, 225, BitOR($ES_AUTOVSCROLL,$ES_AUTOHSCROLL,$ES_READONLY,$ES_WANTRETURN,$WS_HSCROLL,$WS_VSCROLL))
GUICtrlSetData(-1, "AEdit1")
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Edit2 = GUICtrlCreateEdit("", 536, 155, 201, 409, BitOR($ES_AUTOVSCROLL,$ES_WANTRETURN,$WS_VSCROLL))
GUICtrlSetData(-1, "AEdit2")
GUISetState(@SW_SHOW)
While 1
    $Msg = GUIGetMsg()
    Select
        Case $Msg = $GUI_EVENT_CLOSE
            Exit
        Case $Msg = $Button1
        $height = GUICtrlRead($Combo1)
        IF $Height = "64km" Then
            $image = $save1
        ElseIF $Height = "128km" Then
            $image = $save
        ElseIF $Height = "256km" Then
            $image = $save2
        EndIf
        GUICtrlSetData ($Label1, "SEQ Weather Radar: "& $height & @CRLF & "(Mt Stapylton)")
        GUICtrlSetImage ($pic1, $Image)
        Case $Msg = $Label1

            
        Case $Msg = $Edit1

            
        Case $Msg = $Edit2
            
    EndSelect
WEnd
Wow, why don't you take some time and run through some things logically before posting...

Have you tried to open the pictures your downloading in a paint program? Double click on the pic and with my viewer it's black in the pic... makes sense it would be black in the GUI.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...