apple script and aria2c (ask for name before downloading)

hello everyone so after many hours (i m justa a begennir with apple script)
i put toghether a script to download video with youtube dl or aria2c.
i need help regarding aria,i want the apple script to ask for a name and then pass it to "do shell script aria etc etc "
here s my code but the varianble “w” is not corrctly interpreted by aria it stays w!!

code:
set currentURL to the clipboard

if currentURL contains “youtube” then
tell application “Finder” to set homeFolder to path to home folder
do shell script “/usr/local/bin/youtube-dl -x --audio-format mp3 -o "” & POSIX path of homeFolder & "Desktop/%(title)s.m4a" --ffmpeg-location /usr/local/bin/ffmpeg " & currentURL
do shell script "/usr/local/bin/node /usr/local/lib/node_modules/osx-notifier/bin/osx-notifier.js --type pass --title "Video Download" --subtitle "Video download successful" --message " & quoted form of currentURL
else
display dialog “Password” default answer “”
set w to text returned of the result
tell application “Finder” to set homeFolder to path to home folder
do shell script "/usr/local/bin/node /usr/local/lib/node_modules/osx-notifier/bin/osx-notifier.js --type info --title "w" --subtitle "New video download started" --message " & quoted form of w
do shell script “/usr/local/bin/aria2c -j 16 -x 16 -s 8 -k 1M -o "” & POSIX path of homeFolder & "Desktop/w.mp4" " & currentURL
do shell script "/usr/local/bin/node /usr/local/lib/node_modules/osx-notifier/bin/osx-notifier.js --type pass --title "Video Download" --subtitle "Video download successful" --message " & quoted form of currentURL

end if

When troubleshooting applescript/shell combinations, it can be helpful to show the text that will make up the shell command, i.e. remove the ‘do shell script’ part of the line. Then, if necessary, you can try running that directly in the terminal and seeing how it is treated there.

I’m assuming that you refer to the ‘w’ in this line:

do shell script "/usr/local/bin/aria2c -j 16 -x 16 -s 8 -k 1M -o \"" & POSIX path of homeFolder & "Desktop/w.mp4\" " & currentURL

It produces this line for the shell:

"/usr/local/bin/aria2c -j 16 -x 16 -s 8 -k 1M -o \"/Users/username/Desktop/w.mp4\" https://www.youtube.com/watch?v=***********"

The ‘w’ is inside the quotes and so is treated as the literal letter rather than a variable. You’d need to do something like:

[format]“Desktop/” & quoted form of w & ".mp4"[/format]

p.s. You should edit your post, select your code and then click the ‘Applescript’ button. This will format it properly for this forum.