Steinland Posted January 30, 2018 Share Posted January 30, 2018 I have been trying now to integrate autoit and vbs to create the perfect system for downloading torrents. But the final step is that I need to run utorrent with the torrentfile as a parameter. From then I can tell autoit what to write and do but there is a problem. To execute the autoit exe file I need to include what path that will be written into utorrent and I can't get it to work. The path to where I want to save the torrent is in the parameter but $CmdLine[1] does not work with ShellExecute. How do I perform the execution of utorrent and passes on the parameter to the execution of utorrent? Link to comment Share on other sites More sharing options...
Developers Jos Posted January 30, 2018 Developers Share Posted January 30, 2018 Please show the script that is having the issue so we can check it. Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
ViciousXUSMC Posted January 30, 2018 Share Posted January 30, 2018 I would be interested in seeing what you are trying to do, there could be a better way. My guess is that your running into your standard issue with cmd arguments not handling spaces and such. Link to comment Share on other sites More sharing options...
Steinland Posted January 30, 2018 Author Share Posted January 30, 2018 Just trying to execute utorrent with the parameter. ShellExecute("C:\Program Files (x86)\uTorrent\utorrent.exe " & $CmdLine[1]) Works perfect from run prompt: C:\Program Files (x86)\uTorrent\utorrent.exe C:\Users\Steinland\AppData\Local\Temp\Supergirl.S03E12.1080p.WEB.x264-STRiFE.torrent Link to comment Share on other sites More sharing options...
Steinland Posted January 30, 2018 Author Share Posted January 30, 2018 >"C:\Program Files (x86)\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\Users\Steinland\Dropbox\StartTorrent.au3" "C:\Users\Steinland\Dropbox\StartTorrent.au3" (13) : ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.: ShellExecute("C:\Program Files (x86)\uTorrent\utorrent.exe " & $CmdLine[1]) ShellExecute("C:\Program Files (x86)\uTorrent\utorrent.exe " & ^ ERROR >Exit code: 1 Time: 0.08584 Link to comment Share on other sites More sharing options...
Moonscarlet Posted January 30, 2018 Share Posted January 30, 2018 Hello, What about using Run() or RunWait(): $TorrentFile = '' ; its path Run(@ComSpec & " /c " & 'C:\Program Files (x86)\uTorrent\utorrent.exe '&$TorrentFile) https://www.autoitscript.com/autoit3/docs/functions/Run.htm https://www.autoitscript.com/autoit3/docs/functions/RunWait.htm Link to comment Share on other sites More sharing options...
Developers Jos Posted January 30, 2018 Developers Share Posted January 30, 2018 (edited) @Moonscarlet, How does that help? @Steinland, You are trying to retrieve an commandline parameter which wasn't provided in at the startup, and you are not checking its presence.... hence the error. How are you planning to provide that filename to the script? Jos Edited January 30, 2018 by Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Moonscarlet Posted January 30, 2018 Share Posted January 30, 2018 (edited) @Jos Quote Just trying to execute utorrent with the parameter. ShellExecute("C:\Program Files (x86)\uTorrent\utorrent.exe " & $CmdLine[1]) Works perfect from run prompt: C:\Program Files (x86)\uTorrent\utorrent.exe C:\Users\Steinland\AppData\Local\Temp\Supergirl.S03E12.1080p.WEB.x264-STRiFE.torrent Isn't it possible to do it using Run() like this? Run(@ComSpec & " /c " & 'C:\Program Files (x86)\uTorrent\utorrent.exe C:\Users\Steinland\AppData\Local\Temp\Supergirl.S03E12.1080p.WEB.x264-STRiFE.torrent') Edited January 30, 2018 by Moonscarlet Link to comment Share on other sites More sharing options...
Developers Jos Posted January 30, 2018 Developers Share Posted January 30, 2018 The point is that there is an error reffering to the $cmdline array and not and shellexecute issue, so prefer to stay on the issue at hand. Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Steinland Posted January 30, 2018 Author Share Posted January 30, 2018 What about the command line parameter? How do I extract it? $CmdLine[1] to a string that can be inserted in the run command? C:\Program Files (x86)\uTorrent\utorrent.exe C:\Users\Steinland\AppData\Local\Temp\Supergirl.S03E12.1080p.WEB.x264-STRiFE.torrent The bold part is different for every torrent. Link to comment Share on other sites More sharing options...
Moonscarlet Posted January 30, 2018 Share Posted January 30, 2018 That's what I mean, since it's different every time, why are you using $CmdLine and not Run() with utorrent path & filepath directly? Link to comment Share on other sites More sharing options...
Developers Jos Posted January 30, 2018 Developers Share Posted January 30, 2018 I fully understand what you meant in the initial post but am still puzzled what the purpose of the script is and how you plan to provide that bold filename to the script. You clearly were testing from within SciTE pressing the Run command and did not provide any parameter for the commandline. Also the commandline parameters in shellexecute are provided through a separate parameter : ShellExecute ( "filename" [, "parameters" [, "workingdir" [, "verb" [, showflag]]]] ) Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Developers Jos Posted January 30, 2018 Developers Share Posted January 30, 2018 1 minute ago, Moonscarlet said: That's what I mean, since it's different every time, why are you using $CmdLine and not Run() with utorrent path & filepath directly? Not making too much sense to me... and please use the standard forum colors for posts. Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Steinland Posted January 30, 2018 Author Share Posted January 30, 2018 If i create program.exe and want a parameter for it, Lets say "program.exe C:\Longfilename,txt". But the filename is not constant. It's just been created. Link to comment Share on other sites More sharing options...
Moonscarlet Posted January 30, 2018 Share Posted January 30, 2018 Let me try to clarify this again I have a torrent file downloaded "D:\1.torrent" and my Utorrent is located here "C:\Users\moons\AppData\Roaming\uTorrent\uTorrent.exe" Doing this will open utorrent and add the new torrent to my download list: $TorrentPath= "D:\1.torrent" Run(@ComSpec & " /c " & 'C:\Users\moons\AppData\Roaming\uTorrent\uTorrent.exe '&$TorrentPath,"",@SW_HIDE) Link to comment Share on other sites More sharing options...
Steinland Posted January 30, 2018 Author Share Posted January 30, 2018 Let me refer it as this. I just downloaded a file and I want to open it with my scripted exe. The browser will run the exe with the file as parameter. myprogram.exe justdownloadedtemporaryfile.file Link to comment Share on other sites More sharing options...
Steinland Posted January 30, 2018 Author Share Posted January 30, 2018 I want to run it from the browser itself. Link to comment Share on other sites More sharing options...
Steinland Posted January 30, 2018 Author Share Posted January 30, 2018 DownloadFile.exe C:\Users\Steinland\AppData\Local\Temp\Supergirl.S03E12.1080p.WEB.x264-STRiFE.torrent Where in the script can I extract the torrent part? Link to comment Share on other sites More sharing options...
Steinland Posted January 30, 2018 Author Share Posted January 30, 2018 The script itself: ShellExecute("C:\Program Files (x86)\uTorrent\utorrent.exe " & $CmdLine[1]) Then some type commands, then some tabs, then enter. Link to comment Share on other sites More sharing options...
Steinland Posted January 30, 2018 Author Share Posted January 30, 2018 I open firefox. I visit my website. I click on a link. I get to choose to open it or save it. I want to open it with DownloadTorrent.exe. DownloadTorrent.exe will now open and the first parameter will be my downloaded file like some temporary stored .zip and I want to use it in a new run command, This does not work: ShellExecute("C:\MySecondFile.exe " & $CmdLine[1]) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now