Illegal character error with Run command

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
KilliK
Posts: 255
Joined: 10 Mar 2016, 21:19

Illegal character error with Run command

16 Oct 2018, 22:34

Hello.
I am using the below command in CMD with all its parameters with no problems. the double quotes are necessary for the app to work correctly.
"C:\Program Files (x86)\Youtube-dl\youtube-dl.exe" -f "best[height=720]" -o "C:/Storage/%(title)s.%(ext)s" URL

To run the same command from inside an AHK script, I only added the Run command:
Run, "C:\Program Files (x86)\Youtube-dl\youtube-dl.exe" -f "best[height=720]" -o "C:/Storage/%(title)s.%(ext)s" URL

The problem is that when I try to run the script I am getting an error:
The following variable name contains an illegal character:
"(title)s."

The program will exit.
The conflict must be with the special symbols in that specific parameter. I tried triple quotes and double percentages and an accent before the dot but the problem remains.
Any idea how to fix this?
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Re: Illegal character error with Run command

16 Oct 2018, 22:40

Try a backtick before the % for a literal %: `%
Otherwise it sees the start of a variable e.g. %var%
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
User avatar
KilliK
Posts: 255
Joined: 10 Mar 2016, 21:19

Re: Illegal character error with Run command

16 Oct 2018, 22:54

I did that but i am getting the same error.
User avatar
Masonjar13
Posts: 1555
Joined: 20 Jul 2014, 10:16
Location: Не Россия
Contact:

Re: Illegal character error with Run command

17 Oct 2018, 00:23

Expression syntax > traditional syntax

Code: Select all

Run,% """C:\Program Files (x86)\Youtube-dl\youtube-dl.exe"" -f ""best[height=720]"" -o ""C:/Storage/%(title)s.%(ext)s"" URL"
If that also doesn't work, try running it through comspec.
OS: Windows 10 Pro | Editor: Notepad++
My Personal Function Library | Old Build - New Build
garry
Posts: 3771
Joined: 22 Dec 2013, 12:50

Re: Illegal character error with Run command

17 Oct 2018, 09:02

example

Code: Select all

url=https://www.youtube.com/watch?v=yKbzBGntI8Q  ;- li xiang lan 
;url=https://www.youtube.com/watch?v=6pxRHBw-k8M  ; 4K downloads fmt=22  720p as MP4
folderx:=a_desktop . "\YT_DNL"
ifnotexist,%folderx%
   filecreatedir,%folderx%
dest:=folderx . "\%(title)s$%(uploader)s$%(format)s$%(id)s$%(format_id)s.%(ext)s"
youtubedl:="C:\Programs_SA\youtube-dl.exe"
ifexist,%youtubedl%
{
loop,%youtubedl%                                                ;- create shortpath
   SP1:=A_loopFileShortPath
RunWait, %comspec% /k %sp1% %URL% -f 22/18 -w -i --console-title --youtube-skip-dash-manifest -o "%dest%"
run,%folderx%
}
else
{
run,youtube-dl.org/latest/youtube-dl.exe
;run,https://github.com/rg3/youtube-dl/blob/master/README.md#readme   ;- help
;run,%comspec% /k %sp1% -U                                            ;- update
}
return
User avatar
KilliK
Posts: 255
Joined: 10 Mar 2016, 21:19

Re: Illegal character error with Run command

17 Oct 2018, 20:31

thank you guys, I followed your examples and I finally fixed it. thank you.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Google [Bot] and 55 guests