AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

UrlDownloadToFile Problem

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
jk7800



Joined: 06 Jan 2008
Posts: 40
Location: Gdi+ v1.1

PostPosted: Sat Jun 28, 2008 3:42 pm    Post subject: UrlDownloadToFile Problem Reply with quote

Hi.

I'm making an Update Manager for one of my apps, but the UrlDownloadToFile function all the time sets the ErrorLevel to 1. Why does it not work?

I'm posting a modified version of my script (it's just an example, downloading the AutoHotkey logo).

The FileAppend function imitates a list of files to update (in the original script the list is downloaded from the update server).

Code:
#Persistent
SetTimer, Update, 2000
Return

Update:
connected:=DllCall("Wininet.dll\InternetGetConnectedState", "Str", 0x40,"Int",0)
if connected
{
SetTimer, Update, OFF
FileAppend, http://www.autohotkey.com/docs/images/AutoHotkey_logo.gif?

logo.gif`nhttp://www.autohotkey.com/forum/templates/subSilver/images/folder.gif?gif.gif, Temp.txt
FileRead, UpdateList, Temp.txt
Loop, Parse, UpdateList, `n
{
    StringSplit, UpdateFile, A_LoopField, ?
    UrlDownloadToFile, %UpdateFile1%, %UpdateFile2%
    msgbox, %ErrorLevel%
}
}
ExitApp

_________________
My first app: Note
(Please, vote if you like my apps!)

None of my apps took me more than a day to create... After this time I get bored with it (maybe except the note one)...
Back to top
View user's profile Send private message
jk7800



Joined: 06 Jan 2008
Posts: 40
Location: Gdi+ v1.1

PostPosted: Sun Jun 29, 2008 1:54 pm    Post subject: Reply with quote

Embarassed
The problem was caused by the linefeed symbol. When saved to a file it was being represented by 2 characters: 0a and 0d. When the text read from the file was split, the second linefeed character remained and caused problems...
_________________
My first app: Note
(Please, vote if you like my apps!)

None of my apps took me more than a day to create... After this time I get bored with it (maybe except the note one)...
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group