Viscouse Posted April 13 Posted April 13 (edited) I tried, but I can't seem to crack this, what I think should be a pretty easy line of code. Also, /c can be replaced with /k, making no difference in any code below. First, this works to pull the URL, pass it to @comspec and correctly open a window Opt("WinTitleMatchMode", 2) Opt("SendKeyDelay",9) if winexists("Flickr - Google Chrome","") = 0 Then Exit WinActivate("Flickr - Google Chrome","") send("!d^c");Extract URL flickr RunWait(@ComSpec & " /c gallery-dl " & ClipGet()) First a question: Does comspec accept variables with a string? Because I think an easy solution would be to build a string and just pass it. The code below does not work. $u=https://www.flickr.com/photos/bm-mocs/46714523754/ RunWait(@ComSpec & " /c gallery-dl " & $u) Ultimately, what I want is this: $lots = "@ComSpec /c gallery-dl -o keywords.title="Spring" -o filename="{filename} {title}.{extension}" & Clipget()) ;or really: $lots = "@ComSpec /c gallery-dl -o keywords.title=$variable -o filename="{filename} {title}.{extension}" & Clipget()) ;so I am able to change $variable to different words. I understand readers may not know gallery-dl. At the command line, this sequence works: C:\gallery\gallery-dl -o keywords.title="Spring" -o filename="{filename} {title}.{extension}" https://www.flickr.com/photos/bm-mocs/46714523754/ Edited April 13 by Viscouse
Solution ioa747 Posted April 14 Solution Posted April 14 (edited) you may need a little Sleep time, so that the clipboard contents can catch up Also a good tactic is to put a ConsoleWrite so that you can check the contents of the command line (for debugging purposes) Opt("WinTitleMatchMode", 2) If Not WinExists("Flickr - Google Chrome") Then Exit WinActivate("Flickr - Google Chrome") Send("!d^c") Sleep(100) Local $sCMD = 'gallery-dl "' & ClipGet() & '"' ConsoleWrite("$sCMD=" & $sCMD & @CRLF) RunWait(@ComSpec & ' /c ' & $sCMD) Edit: ; C:\gallery\gallery-dl -o keywords.title="Spring" -o filename="{filename} {title}.{extension}" https://www.flickr.com/photos/bm-mocs/46714523754/ Local $sProgramPath = "C:\gallery\gallery-dl" Local $sTitle = "Spring" Local $sURL = "https://www.flickr.com/photos/bm-mocs/46714523754/" $sCMD = $sProgramPath & ' -o keywords.title="' & $sTitle & '" -o filename="{filename} {title}.{extension}" ' & $sURL ConsoleWrite("$sCMD=" & $sCMD & @CRLF) ;~ RunWait(@ComSpec & ' /c ' & $sCMD) Edited April 14 by ioa747 I know that I know nothing
Viscouse Posted April 29 Author Posted April 29 (edited) Sorry, one more bit. How do I handle directories with spaces? Local $sProgramPath = "C:\gallery pics\nice ones\pics" I tried including a single quote around the path but that still doesn't work $sCMD = -d $sProgramPath & $sURL ConsoleWrite("$sCMD=" & $sCMD & @CRLF) Edited April 29 by Viscouse
ioa747 Posted April 29 Posted April 29 (edited) $MyPath = "D:\tmp\one two three\1) test one" ; test folder ConsoleWrite('explorer.exe /select, "' & $MyPath & '"' & @CRLF) Run('explorer.exe /select, "' & $MyPath & '"') Edited April 29 by ioa747 I know that I know nothing
Viscouse Posted April 30 Author Posted April 30 That's done it, thanks again. I'm getting PTSD from trying to learn regex.
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