Drop file on Script issue - brakes path down by spaces

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
theimmersion
Posts: 181
Joined: 09 Jul 2016, 08:34
Location: Serbia

Drop file on Script issue - brakes path down by spaces

21 Jan 2018, 22:00

I tried making some gif player but i noticed that dropping anything on a script (uncompiled) is returning weird results.
I expected it to return a path but instead it returns parts of the path.
For instance, dropping some file would place some number like 7 in the %0% param and place different parts of the path in %1% - %7%
Essentially, its braking down the path by spaces in the string.
An example as it currently is:
Gif file location:
D:\AHK's Stuff\Test projects and script development\assets\anim test\2.gif

dropping the file on a script returns this:
%0%=7
%1%=D:\AHK's
%2%=Stuff\Test
%3%=projects
%4%=and
%5%=script
%6%=development\assets\anim
%7%=test\2.gif

Is this some bug or am i using this the wrong way?? Is this intentional?
I could not find anything relevant to this behavior.
So confusing. xD

Edit:
Essentially, dropping a file with any spaces in the path is making the script think theres multiple parameters, depending on how many spaces there are.
Last edited by theimmersion on 22 Jan 2018, 19:39, edited 1 time in total.
TAC109
Posts: 1111
Joined: 02 Oct 2013, 19:41
Location: New Zealand

Re: Drop file on Script issue - brakes path down by spaces

21 Jan 2018, 22:19

There's an option when installing AHK to allow files to be dropped onto scripts. Did you enable this option when installing?

Alternatively, you can compile the script. Dropping files onto the compiled script will work regardless.
My scripts:-
XRef - Produces Cross Reference lists for scripts
ReClip - A Text Reformatting and Clip Management utility
ScriptGuard - Protects Compiled Scripts from Decompilation
I also maintain Ahk2Exe
User avatar
theimmersion
Posts: 181
Joined: 09 Jul 2016, 08:34
Location: Serbia

Re: Drop file on Script issue - brakes path down by spaces

22 Jan 2018, 17:11

Yeah, i did not enable this. Honestly, i did not notice that at all. Time to reinstall AHK i guess. Thanks. An option would be nice within the auto execute section tho. Something like #EnableDragDrop / #EDD / #EnableDD or some such (if possible of course). I honestly think i subbed to this topic and yet it was unsubbed somehow. Hm.... Need sleep i guess. xD Thanks!
User avatar
theimmersion
Posts: 181
Joined: 09 Jul 2016, 08:34
Location: Serbia

Re: Drop file on Script issue - brakes path down by spaces

22 Jan 2018, 17:19

Ok, i reinstalled AHK and yes, the option was checked (enabled) and the behavior is still the same.
I know compiled scripts work but i need it uncompiled since its on my own system for my own use and i modify the script a lot and compiling after each iteration is annoying.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: doodles333 and 285 guests