#178529 - 2007-07-27 11:23 PM
An observation regarding UDF FTPGet()
|
green78
Fresh Scripter
Registered: 2007-05-02
Posts: 34
|
Hi folks,
I started using the FTPGet() function and for the first few days it worked fine, then on the 5th day some bug appeared. Here's how I'm using the function:
Every day I download an XLS file from a website. Every day the file name is the same, but the file is being updated. Once downloaded, I open the file, read a value inside and if it corresponds with today's date I send the file via Blat SMTP to some people. I have to send the file after 16:45, so at this point the script starts downloading the file from the web address every 2 minutes. In 99% of the cases by this time file is already updated and file is being sent. Sometimes though, I see the file downloaded, but when I open it - still shows the previous date inside, while when I open it from another PC (downloaded from the website) it is updated. The script though keeps on downloading the file every two minutes and it is never updated, while at the very same time I see it updated on the site. So, conclusion is that it is getting cached and I implemented the ClearIE() UDF into the script, but this behaviour is very strange - 4 days it works perfrectly (without clearing the cache) while on the 5th day (not always the fifth day, but somewhere in this period) the cache is not getting updated.
Any thoughts why this might be happening ? ClearIE() works well, but I'd prefer not using it so often.
Thanks in advance !
Edited by green78 (2007-07-27 11:25 PM)
|
|
Top
|
|
|
|
#178537 - 2007-07-28 10:13 PM
Re: An observation regarding UDF FTPGet()
[Re: Lonkero]
|
green78
Fresh Scripter
Registered: 2007-05-02
Posts: 34
|
hmm... ftpGet() doesn't set your IE cache settings. you should set it manually via registry hack or the GUI and force it to check always for updated content.
Sure this is solution, but I was wondering why it should happen on a Friday :).
Thanks guys, I think this will help.
|
|
Top
|
|
|
|
#178546 - 2007-07-30 04:19 PM
Re: An observation regarding UDF FTPGet()
[Re: Mart]
|
green78
Fresh Scripter
Registered: 2007-05-02
Posts: 34
|
Hi again,
Actually ClearIE() doesn't solve the problem - I tried to execute it every time before the download but still it will pick up the old version of the file - I have no idea how this happens because I actually see that the file is getting deleted from "Temporary Internet files".
Anyway, the issue was that I have to set IE to check for new version on "Every visit" - once I set it, it immediatelly downloaded the new version.
Now I have another problem: Since we are using SOE (Standard Operating Environment) for Windows 2000 and I'm afraid if settings may be auto-restored on next logon -- I'd like to ask if there is some way to force set this option before the download starts via Kix ?
Thanks in advance !
|
|
Top
|
|
|
|
#178551 - 2007-07-30 07:41 PM
Re: An observation regarding UDF FTPGet()
[Re: Mart]
|
green78
Fresh Scripter
Registered: 2007-05-02
Posts: 34
|
Mart/Les,
Thanks a lot. I think this time issue is solved. Maybe a modification to the FTPGet() function will be also useful in the following manner or at least the below usage is very advisable:
$RegVal = Readvalue( "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings","Syncmode5")
writevalue( "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings","Syncmode5","3","REG_DWORD")
FTPGet()
writevalue( "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings","Syncmode5",$RegVal,"REG_DWORD")
Today I figured it out. In the morning I logged in manually and downloaded the file. When it became time for the script to download the file it was downloading only the old version, even though the version on the site was updated. Most of the time the script was working, because when it was trying to download it the file was already updated on the site. What happened on Friday (because the guys that update it were lazy enough ) by the time the script downloaded it for the first time it was not updated, then after 10-15 mins or so it was updated on the site, but the script was still downloading the old version - even though cache was cleared each time before download (which is still a mystery to me).
Cya.
|
|
Top
|
|
|
|
#178553 - 2007-07-30 08:19 PM
Re: An observation regarding UDF FTPGet()
[Re: green78]
|
green78
Fresh Scripter
Registered: 2007-05-02
Posts: 34
|
By the way.... the above can happen if you use proxy server to access the Web. This explains why even cache is cleared - it doesn't help. The first donload is stored on the proxy and each next attempt to download without the proper settings in IE results in downloading the file from the proxy.
You shouldn't have this problem if you access internet directly.
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 756 anonymous users online.
|
|
|