forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


VDSIPP - HTTP download fails if network is slow
Goto page Previous  1, 2, 3
 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help
View previous topic :: View next topic  
Author Message
Mac
Professional Member
Professional Member


Joined: 08 Jul 2000
Posts: 1585
Location: Oklahoma USA

PostPosted: Wed Feb 19, 2003 11:58 am    Post subject: Reply with quote

Gimme a few minutes on the progress bar - the XP theme thing
is a manifest file or something I think. There's a post or two on
that if ya wanna do a search... Wink

Cheers, Mac Smile

_________________
VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
Back to top
View user's profile Send private message Send e-mail
GeoTrail
Valued Contributor
Valued Contributor


Joined: 18 Feb 2003
Posts: 572
Location: Bergen, Norway

PostPosted: Wed Feb 19, 2003 12:03 pm    Post subject: Reply with quote

Great, thanks alot Mac Smile
Searching now...

_________________
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
GeoTrail
Valued Contributor
Valued Contributor


Joined: 18 Feb 2003
Posts: 572
Location: Bergen, Norway

PostPosted: Wed Feb 19, 2003 12:08 pm    Post subject: Reply with quote

Found a post about using Manifest Wizard.
Did that and now it looks perfect Smile

_________________
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Rubes_sw
Valued Contributor
Valued Contributor


Joined: 11 Jun 2001
Posts: 625
Location: Northern Ireland

PostPosted: Wed Feb 19, 2003 12:10 pm    Post subject: Reply with quote

You need to tell VDS on what dialog your progress bar is:

eg.

Code:

:EVLOOP
If %%Download
  wait event,1
  :timer
   rem retrieve the total size to transfer
   %%size = @internet(http,content-length,1)
   rem retrieve the amount of bytes left to transfer
   %%left = @internet(http,transferbytes,1)
   %%per = @fdiv(100,%%size)
   %%per1 = @fmul(%%per,%%left)
   %%per2 = @format(%%per1,9.0)
   rem P2 is dialog name for the progress bar
rem The first dialog you create is always 0 then for each dialog you
rem create add 1 etc etc
rem focus on Progress Bar Dialog !
dialog select,1
   dialog set,p2,%%per2
rem return focus to the main window
rem dialog select,0
  Else
   WAIT EVENT
end
  goto @event()
  goto evloop


Hope this helps....
Back to top
View user's profile Send private message Send e-mail Visit poster's website
GeoTrail
Valued Contributor
Valued Contributor


Joined: 18 Feb 2003
Posts: 572
Location: Bergen, Norway

PostPosted: Wed Feb 19, 2003 12:26 pm    Post subject: Reply with quote

I've put the progress bar on the main dialog and removed the second dialog until I get the progress bar working.

But it don't seem to work.
And I can't figure out why.

I think Mac is looking at it.

Anyways, here's what I got so far, notice the special thanks to info Smile
Code:
rem This is my first go at using any extension at all with VDS.
rem I've only been using VDS for about three days now and love it more each time I use it :)

%%Title = GeoTrail Downloader
%%Version = 1.0
Title %%Title
  DIALOG CREATE,%%Title,-1,0,473,110
  DIALOG ADD,GROUP,GROUP1,8,8,448,48,Download File
  DIALOG ADD,EDIT,EDIT1,24,16,432,24,http://www.geotrail.no/lastned/geoamp.zip
  DIALOG ADD,BUTTON,BUTTON1,64,280,88,24,&Save file as
  DIALOG ADD,BUTTON,BUTTON2,64,376,90,24,Start &download
  DIALOG ADD,STATUS,STATUS1,Remember to click on @CHR(34)Save file as@CHR(34) before downloading.
  DIALOG ADD,PROGRESS,P2,68,13,250,16,0 
  DIALOG ADD,MENU,&Help,H&elp|E,&About|A,-,E&xit|X
  DIALOG SHOW
  DIALOG DISABLE,BUTTON2
  DIALOG HIDE, P2

rem Calls the extenion into memory.
%P = @PATH(%0)
EXTERNAL VDSIPP.DLL

:EVLOOP
If %%Download
  rem :timer
  info You should only see this@cr()if you have started the download.
   rem retrieve the total size to transfer
   %%size = @internet(http,content-length,1)
   rem retrieve the amount of bytes left to transfer
   %%left = @internet(http,transferbytes,1)
   %%per = @fdiv(100,%%size)
   %%per1 = @fmul(%%per,%%left)
   %%per2 = @format(%%per1,9.0)
   rem P2 is dialog name for the progress bar
   dialog set,p2,%%per2
  wait event,1   
Else
   WAIT EVENT
end
  goto @event()
  goto evloop

:HelpMENU
  info Thanks for trying this simple little downloader.@cr()@cr()This is my first attempt at using HTTP Protocols in pure script programming.@cr()And it seems to work perfectly on my machine.@cr()But"," if you should experience any problems"," please let me know by emailing me at robert"@"geotrail.no
goto EVLOOP

:AboutMENU
  info %%Title v%%Version@cr()Thanks to all the people at VDSWorld for helping me :)@cr()Special thanks must go to Rubes_sw and Mac.@cr()@cr()Written by Robert Olsen <robert"@"geotrail.no>
goto EVLOOP

:ExitMENU
  goto Close
 
:BUTTON1BUTTON
  %F = @DIRDLG(Select where you want to download the file.,%P)
If %F
DIALOG SET,STATUS1,%F
  DIALOG ENABLE,BUTTON2
  DIALOG DISABLE,BUTTON1
  goto EVLOOP
Else
  info You MUST select where you want to download the file@cr()by clicking the @CHR(34)Save file as@CHR(34) button.
End
goto EVLOOP

:BUTTON2BUTTON
If %F
rem Start the download progress
%%Download = "yes"
rem Download progress
  DIALOG SHOW, P2
  DIALOG DISABLE,EDIT1
  DIALOG DISABLE,BUTTON2
  DIALOG SET,STATUS1,Download in progress...
  %%URL = @dlgtext(EDIT1)
  INTERNET HTTP,CREATE,1
  INTERNET HTTP,THREADS,1,OFF
  INTERNET HTTP,PROTOCOL,1,1
  INTERNET HTTP,USERAGENT,1,"%%Title"
  INTERNET HTTP,DOWNLOAD,1,%%URL,%F\geoamp.zip
  %S = @INTERNET(HTTP,CONTENT-LENGTH,1)
  %%FileSize = @DIV(%S,1024)
  INTERNET HTTP,DESTROY,1
  DIALOG SET,STATUS1,Download completed!
  info Download complete.@cr()@cr()The file %%URL@cr()have now been saved to@cr()%F@cr()@cr()Filesize: %%FileSize kb
  DIALOG ENABLE,BUTTON1
  DIALOG ENABLE,BUTTON2
  DIALOG ENABLE,EDIT1 
  DIALOG HIDE, P2
rem Closes the dialog with the progress bar on it.
  %%Download = ""
  goto EVLOOP
Else
  info You MUST select where you want to download the file@cr()by clicking the @CHR(34)Save file as@CHR(34) button.
  goto EVLOOP
End
 
:Close
  Exit

_________________
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Mac
Professional Member
Professional Member


Joined: 08 Jul 2000
Posts: 1585
Location: Oklahoma USA

PostPosted: Wed Feb 19, 2003 1:22 pm    Post subject: Reply with quote

Don't take this personal, but I re-wrote it from scratch...

I'm posting it in the VDS 3 source code, I'll add a link
here when I get it posted.

Cheers, Mac Smile

_________________
VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
Back to top
View user's profile Send private message Send e-mail
GeoTrail
Valued Contributor
Valued Contributor


Joined: 18 Feb 2003
Posts: 572
Location: Bergen, Norway

PostPosted: Wed Feb 19, 2003 1:27 pm    Post subject: Reply with quote

that's cool.
will it work with 4.5?

_________________
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Rubes_sw
Valued Contributor
Valued Contributor


Joined: 11 Jun 2001
Posts: 625
Location: Northern Ireland

PostPosted: Wed Feb 19, 2003 1:28 pm    Post subject: Reply with quote

Sorry Mac, Geotrail, i made a few changes maybe not as good as Mac's but hey we all learn Very Happy

Code:
rem This is my first go at using any extension at all with VDS.
rem I've only been using VDS for about three days now and love it more each time I use it :)
rem use this incase your script gives an error !
option errortrap,error
%%Title = GeoTrail Downloader
%%Version = 1.0
Title %%Title
  DIALOG CREATE,%%Title,-1,0,473,110
  DIALOG ADD,GROUP,GROUP1,8,8,448,48,Download File
  DIALOG ADD,EDIT,EDIT1,24,16,432,24,http://www.geotrail.no/lastned/geoamp.zip
  DIALOG ADD,BUTTON,BUTTON1,64,280,88,24,&Save file as
  DIALOG ADD,BUTTON,BUTTON2,64,376,90,24,Start &download
  DIALOG ADD,STATUS,STATUS1,Remember to click on @CHR(34)Save file as@CHR(34) before downloading.
  DIALOG ADD,PROGRESS,P2,68,13,250,16,0 
  DIALOG ADD,MENU,&Help,H&elp|E,&About|A,-,E&xit|X
  DIALOG SHOW
  DIALOG DISABLE,BUTTON2
  DIALOG HIDE, P2

rem Calls the extenion into memory.
%P = @PATH(%0)
EXTERNAL VDSIPP.DLL

:EVLOOP
If %%Download
  rem :timer
  rem info You should only see this@cr()if you have started the download.
   rem retrieve the total size to transfer
   %%size = @internet(http,content-length,1)
   rem retrieve the amount of bytes left to transfer
   %%left = @internet(http,transferbytes,1)
   REM If the %%left = 0 the forumla below can not be calculated....
   if @not(@equal(%%left,0))
   dialog set,STATUS1,Downloaded: %%left  of %%size
   %%per = @fdiv(100,%%size)
   %%per1 = @fmul(%%per,%%left)
   %%per2 = @format(%%per1,9.0)
   rem P2 is dialog name for the progress bar
   dialog set,p2,%%per2
   end
  wait event,1   
Else
   WAIT EVENT
end
%x = @event()
  goto %x
  rem If you use WAIT EVENT,1 you must include a label TIMER somewhere !
  :timer
  goto evloop

:HelpMENU
  info Thanks for trying this simple little downloader.@cr()@cr()This is my first attempt at using HTTP Protocols in pure script programming.@cr()And it seems to work perfectly on my machine.@cr()But"," if you should experience any problems"," please let me know by emailing me at robert"@"geotrail.no
goto EVLOOP

:AboutMENU
  info %%Title v%%Version@cr()Thanks to all the people at VDSWorld for helping me :)@cr()Special thanks must go to Rubes_sw and Mac.@cr()@cr()Written by Robert Olsen <robert"@"geotrail.no>
goto EVLOOP

:ExitMENU
  goto Close
 
:BUTTON1BUTTON
  %F = @DIRDLG(Select where you want to download the file.,%P)
If %F
DIALOG SET,STATUS1,%F
  DIALOG ENABLE,BUTTON2
  DIALOG DISABLE,BUTTON1
  goto EVLOOP
Else
  info You MUST select where you want to download the file@cr()by clicking the @CHR(34)Save file as@CHR(34) button.
End
goto EVLOOP

:BUTTON2BUTTON
If %F
rem Start the download progress
%%Download = 1
rem Download progress
  DIALOG SHOW, P2
  DIALOG DISABLE,EDIT1
  DIALOG DISABLE,BUTTON2
  DIALOG SET,STATUS1,Download in progress...
  %%URL = @dlgtext(EDIT1)
  INTERNET HTTP,CREATE,1
  rem You must turn on Threads to use: @INTERNET(HTTP,CONTENT-LENGTH,1)
  INTERNET HTTP,THREADS,1,ON
  INTERNET HTTP,PROTOCOL,1,1
  INTERNET HTTP,USERAGENT,1,"%%Title"
  REM For some reason the Download Command is not functioning... so....
 rem INTERNET HTTP,DOWNLOAD,1,%%URL,%F\geoamp.zip
 rem Get the Content of the file first...... then see HTTP1ONGETDONE
 INTERNET HTTP,GET,1,%%URL
  rem STart a timer event ! goto evloop
  goto evloop
  rem %S = @INTERNET(HTTP,CONTENT-LENGTH,1)
  rem %%FileSize = @DIV(%S,1024)
  :HTTP1ONGETDONE
  rem create a list
  list create,1
  rem add the content you just downloaded...
  list add,1,@INTERNET(HTTP,CONTENT,1)
  rem save the contents of the list
  list savefile,1,%F\geoamp.zip
  rem now close the list
  list close,1
  INTERNET HTTP,DESTROY,1
  DIALOG SET,STATUS1,Download completed!
  info Download complete.@cr()@cr()The file %%URL@cr()have now been saved to@cr()%F@cr()@cr()Filesize: %%FileSize kb
  DIALOG ENABLE,BUTTON1
  DIALOG ENABLE,BUTTON2
  DIALOG ENABLE,EDIT1 
  DIALOG HIDE, P2
rem Closes the dialog with the progress bar on it.
  %%Download = 
  goto EVLOOP
Else
  info You MUST select where you want to download the file@cr()by clicking the @CHR(34)Save file as@CHR(34) button.
  goto EVLOOP
End
 
:Close
rem If the user closes the connection before the download is complete you need to kill the connection
INTERNET HTTP,DESTROY,1
  Exit
 
 
  rem added this because the file you are trying to retrieve ??????
  :HTTP1ONGETHEADERDONE
goto evloop
:error
INTERNET HTTP,DESTROY,1
warn There was an error....@cr()Error: @error(e) at Line: @error(n)
exit


Nathan


Last edited by Rubes_sw on Wed Feb 19, 2003 1:31 pm; edited 1 time in total
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Mac
Professional Member
Professional Member


Joined: 08 Jul 2000
Posts: 1585
Location: Oklahoma USA

PostPosted: Wed Feb 19, 2003 1:30 pm    Post subject: Reply with quote

It should be both VDS3 and VDS4 compatible... Wink

http://www.vdsworld.com/forum/viewtopic.php?p=7593#7593

Cheers, Mac Smile

_________________
VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
Back to top
View user's profile Send private message Send e-mail
GeoTrail
Valued Contributor
Valued Contributor


Joined: 18 Feb 2003
Posts: 572
Location: Bergen, Norway

PostPosted: Wed Feb 19, 2003 1:37 pm    Post subject: Reply with quote

Thanks alot Nathan. It rocks Smile
_________________
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Mac
Professional Member
Professional Member


Joined: 08 Jul 2000
Posts: 1585
Location: Oklahoma USA

PostPosted: Wed Feb 19, 2003 1:45 pm    Post subject: Reply with quote

Rubes_sw wrote:
Sorry Mac, Geotrail, ...

Nathan


No prob Nathan - LOL, I'm just usually too cranky (or dense?) to
work with someone else's code very much... Laughing

Cheers, Mac Smile

_________________
VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help All times are GMT
Goto page Previous  1, 2, 3
Page 3 of 3

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group