Jump to content

@ComSpec woes, quote difficulties


Go to solution Solved by ioa747,

Recommended Posts

Posted (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 by Viscouse
  • Solution
Posted (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 by ioa747

I know that I know nothing

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...