Page 2 of 2 <12
Topic Options
#99589 - 2003-03-17 08:26 PM Re: Weather Report
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
beautiful...
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#99590 - 2003-03-17 08:27 PM Re: Weather Report
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
mm...
finally got a use for that udf...
well, other than it was designed for.

[ 17. March 2003, 20:28: Message edited by: Lonkero ]
_________________________
!

download KiXnet

Top
#99591 - 2003-03-17 09:32 PM Re: Weather Report
Incognito Offline
Getting the hang of it

Registered: 2001-07-09
Posts: 66
Man, I am a complete newbie. I'm having problems getting that UDF to work - Should I be passing the variables like:

$surl = "http://oap.weather.com/fcgi-bin/oap/generate_magnet?loc_id=33569"

$stargetfile = "d:\test.jpg"

Should I have IE running as a COM object before I run this UDF?

Top
#99592 - 2003-03-17 09:34 PM Re: Weather Report
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
I almost have it...

Shawn... Wake up I need picturebox help
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#99593 - 2003-03-17 09:48 PM Re: Weather Report
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
incognito, I just provided you an example how you use it!
don't change the code of the udf.
just add it in your script file.

you should read how to use UDFs from faq.

also, most likely you don't do anything with that code as said before.
it's not good as there is image. and it's JPG.

kixforms does not support JPG!
_________________________
!

download KiXnet

Top
#99594 - 2003-03-17 10:06 PM Re: Weather Report
Incognito Offline
Getting the hang of it

Registered: 2001-07-09
Posts: 66
Oh man,
Top
#99595 - 2003-03-17 10:09 PM Re: Weather Report
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
is this sort of what you had in mind?

 -
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#99596 - 2003-03-17 10:11 PM Re: Weather Report
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
it just doesn't work yet...

looking for some simple cmd line image converter... jpg to bmp

otherwise it is ready.
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#99597 - 2003-03-17 10:11 PM Re: Weather Report
Incognito Offline
Getting the hang of it

Registered: 2001-07-09
Posts: 66
Oh man,
I was over-engineering the whole thing. I just learned how to incorporate UDF's into my scripting.

Lonkero - Thanks for throwing UDF's at me - I had no idea how KIX handled FUNCTION statements - Now I do. I went to the UDF library and I'm amazed by the amount of work that has gone into building it. It makes KIX that mush more powerful.

Radimus & Sealeopard - Thanks for all of your help - Your suggestions got the wheels turning for me.

Top
#99598 - 2003-03-17 10:19 PM Re: Weather Report
Incognito Offline
Getting the hang of it

Registered: 2001-07-09
Posts: 66
I'm going to add this to my login screen process - While users wait for the printers and drives to map they can check out the weather at the locations that we do buisness in. I was going to fire off the FTPGET udf via a scheduled task, so I guess I need a simple JPG to BMP conversion to take place at the same time. Hmmmm.
Top
#99599 - 2003-03-17 10:24 PM Re: Weather Report
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
I got it....

cmd line converter (freeware)
http://www.stinsv.com/jpgtobmp.htm

code:
 
break on

$zipcode='32505','32308','32615','32209','33701','33614','32801','33901','33407','33309','33166'


$Form = CreateObject("Kixtart.Form")
$Form.FontName = "arial"
$Form.FontSize = 9
$Form.Size = 320,250

$Area01 = $Form.Button("Area01",5,5,50,25) $Area01.onClick = "ShowPic(1)"
$Area02 = $Form.Button("Area02",55,5,50,25) $Area02.onClick = "ShowPic(2)"
$Area03 = $Form.Button("Area03",105,5,50,25) $Area03.onClick = "ShowPic(3)"
$Area04 = $Form.Button("Area04",155,5,50,25) $Area04.onClick = "ShowPic(4)"
$Area05 = $Form.Button("Area05",205,5,50,25) $Area05.onClick = "ShowPic(5)"
$Area06 = $Form.Button("Area06",255,5,50,25) $Area06.onClick = "ShowPic(6)"
$Area07 = $Form.Button("Area07",5,30,50,25) $Area07.onClick = "ShowPic(7)"
$Area08 = $Form.Button("Area08",55,30,50,25) $Area08.onClick = "ShowPic(8)"
$Area09 = $Form.Button("Area09",105,30,50,25) $Area09.onClick = "ShowPic(9)"
$Area10 = $Form.Button("Area10",155,30,50,25) $Area10.onClick = "ShowPic(10)"
$Area11 = $Form.Button("Area11",205,30,50,25) $Area11.onClick = "ShowPic(11)"
$Area00 = $Form.Button("Area00",255,30,50,25) $Area00.onClick = "ShowPic(12)"


$pbox = $form.picturebox('',20,70,270,140)

$Form.Center
$Form.Show
While $Form.Visible
$=Execute($Form.DoEvents)
Loop

Exit 1

Function ShowPic($area)
$zip=$zipcode[$area-1]
ftpget("http://oap.weather.com/fcgi-bin/oap/generate_magnet?loc_id=$zip","%temp%\$zip.jpg")
del "%temp%\$zip.bmp"
shell 'c:\djpeg.exe -bmp "%temp%\$zip.jpg"'
$pbox.picture="%temp%\$zip.bmp"
$pbox.refresh
endfunction

Function FTPget($sURL, $sTargetFile, optional $sUser, optional $sPass)
Dim $oFTP, $oStream
$sUser=""+$sUser
$oFTP = CreateObject("Microsoft.XMLHTTP")
if @error $ftpget=1 exit 1 endif
$oStream = CreateObject("ADODB.Stream")
if @error $ftpget=2 exit 2 endif
if $sUser
$oFTP.Open("GET", $sURL, not 1, $sUser, $sPass)
else
$oFTP.Open("GET", $sURL, not 1)
endif
if @error $ftpget=3 exit 3 endif
$oFTP.Send
$oStream.Type = 1
$oStream.Mode = 3
$oStream.open
$oStream.Write($oFTP.responseBody)
if @error $ftpget=4 exit 4 endif
$oStream.SaveToFile($sTargetFile, 2)
if @error $ftpget=5 exit 5 endif
$oStream.Close
EndFunction



_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#99600 - 2003-03-17 10:40 PM Re: Weather Report
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
the area selection should be automatic though...

by the means of where the person logs on...
_________________________
!

download KiXnet

Top
#99601 - 2003-03-18 03:30 PM Re: Weather Report
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
ZIP Code could be associated with certains subnets/IP addresses/ domains.
_________________________
There are two types of vessels, submarines and targets.

Top
#99602 - 2003-03-18 04:00 PM Re: Weather Report
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
it could be automated, but if you have multiple sites and each site is curious about the others, adding the code to detect local area is an unnecessary complication and adds unnecessary code.

unless, you wanted to prompt the first time and store it in the registry. that would only be a few extra lines.
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#99603 - 2003-03-18 06:27 PM Re: Weather Report
Incognito Offline
Getting the hang of it

Registered: 2001-07-09
Posts: 66
Hey guys everything is working great at my end & the final result is a task that runs every two hours utilizing Lonkero's FTPGet UDF to get the weather JPG's for 3 zip codes I need. The script also shells out to utilize the JPG to BMP utility that Radimus found and supplied for the cause - thanks again. The task runs every two hours, grabs the files converts them and then copies The weather BMP's to all KIX script locations.

After that is complete, I run the following form:

Debug off
SetConsole ("Hide")


;Setup the GUI
$Form = CreateObject("Kixtart.form")
$Form.text = "Logon In Progress....."
$Form.Size = 810,600
$Form.backcolor = 255,255,255
$Form.Center
$Form.windowstate = 2

$pbar = $Form.progressbar
$pbar.width = 800
$pbar.height = 20
$pbar.min = 0
$pbar.max = 20
$pbar.Left
$pbar.top = 400
$pbar.borderstyle = 0

$logo = $form.image("login.bmp")
$logo.center
$logo.top = 15
$logo.borderstyle = 0

$PHX = $form.image("85040.bmp")
$PHX.center
$PHX.top = 430
$PHX.borderstyle = 0

$SF = $form.image("94120.bmp")
$SF.Left
$SF.top = 430
$SF.borderstyle = 0

$HI = $form.image("96819.bmp")
$HI.Left = 530
$HI.top = 430
$HI.borderstyle = 0

$text = $form.textbox
$text.borderstyle = 0
$text.locked = 1
$text.width = 400
$text.height = 20
$text.Left
$text.top = 375
$text.value = "Logging into Network @SCRIPTNAME"

$ID = $form.textbox
$ID.borderstyle = 0
$ID.locked = 1
$ID.fontsize = 16
$ID.width = 325
$ID.height = 30
$ID.Left = 260
$ID.top = 200
$ID.value = "Welcome %s_user%!"

$text2 = $form.textbox
$text2.borderstyle = 0
$text2.locked = 1
$text2.fontsize = 16
$text2.width = 350
$text2.height = 30
$text2.center
$text2.top = 225
$text2.value = "@day, @month @mdayno @year @time"

$text3 = $form.textbox
$text3.borderstyle = 0
$text3.locked = 1
$text3.fontsize = 16
$text3.width = 200
$text3.height = 20
$text3.center
$text3.top = 250
$text3.value = "Station: @WKSTA"

$text4 = $form.textbox
$text4.borderstyle = 0
$text4.locked = 1
$text4.fontsize = 16
$text4.width = 300
$text4.height = 20
$text4.center
$text4.top = 275
$text4.value = "@PRODUCTTYPE"

$text6 = $form.textbox
$text6.borderstyle = 0
$text6.locked = 1
$text6.fontsize = 16
$text6.width = 300
$text6.height = 25
$text6.center
$text6.top = 300
$text6.value = "Logon Server:@LSERVER"

$text7 = $form.textbox
$text7.borderstyle = 0
$text7.locked = 1
$text7.fontsize = 16
$text7.width = 100
$text7.height = 25
$text7.center
$text7.top = 325
$text7.value = "@DOMAIN"

$form.show

$pbar.value = 0
$text.value = "Starting Login Progess"
Sleep 1

$pbar.value = 1
$text.value = "Defining Variables"

ETC ETC ETC..

Thanks again guys..

Top
#99604 - 2003-03-18 06:31 PM Re: Weather Report
Incognito Offline
Getting the hang of it

Registered: 2001-07-09
Posts: 66
Oh,
one last thing - Is there a simple command / function that I can incorporate that will keep a form in the foreground / on top regardless of what is launching maximized in the background?

I seem to recall a window order/priority...

I though setting windowstate to 2 would work, but no dice..

I'm sure it's easy.

Top
#99605 - 2003-03-18 06:41 PM Re: Weather Report
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
might try:

$Form.TopMost = 1

-Shawn

Top
Page 2 of 2 <12


Moderator:  Arend_, Allen, Jochen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 2141 anonymous users online.
Newest Members
BeeEm, min_seow, Audio, Hoschi, Comet
17882 Registered Users

Generated in 0.091 seconds in which 0.043 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org