How to download a file to %A_ScriptDir%

Get help with using AutoHotkey and its commands and hotkeys
WalkerOfTheDay
Posts: 257
Joined: 24 Mar 2016, 03:01

How to download a file to %A_ScriptDir%

25 Sep 2017, 09:18

Hi,

I'm trying to download a file and place it in A_ScriptDir by using AHK.
I thought the URLDownloadToFile function but that doesn't seem to be working.

If I for instance try the example from the manual:

Code: [Select all] [Download] GeSHi © Codebox Plus

UrlDownloadToFile, https://autohotkey.com/download/1.1/version.txt C:\AutoHotKey Latest Version.txt


.. Nothing happens. Is there another / better way to do this ?
User avatar
boiler
Posts: 1850
Joined: 21 Dec 2014, 02:44

Re: How to download a file to %A_ScriptDir%

25 Sep 2017, 09:41

One reason that doesn't work is that you left out the comma between the two parameters. When you add that comma, it would download a file called "AutoHotkey Lastest Version.txt" to the root directory of your C: drive. To download it to your script directory:
UrlDownloadToFile, https://autohotkey.com/download/1.1/version.txt, %A_ScriptDir%\AutoHotkey Latest Version.txt

Edit: Accidentally left "C:\" in there. Now removed.
Last edited by boiler on 25 Sep 2017, 09:57, edited 1 time in total.
WalkerOfTheDay
Posts: 257
Joined: 24 Mar 2016, 03:01

Re: How to download a file to %A_ScriptDir%

25 Sep 2017, 09:52

Thank you boiler, this was a typo on my side :)

But even with the comma it doesn't seem to work..
User avatar
boiler
Posts: 1850
Joined: 21 Dec 2014, 02:44

Re: How to download a file to %A_ScriptDir%

25 Sep 2017, 09:58

I left the C:\ in there and shouldn't have (now edited). Should work now.

Return to “Ask For Help”

Who is online

Users browsing this forum: CH HAN, Google [Bot], Hellbent, Odlanir, Yahoo [Bot] and 30 guests