Jump to content

[Solved] commandline exe tools


Recommended Posts

Hi, i would liket to use an ebook related commandline tool 'ebook-meta.exe'. It's in the Calibre subfolder (relative to the script). I wrote a program:

Run("cmd.exe")
Sleep(500)
Send('cd Calibre' & "{Enter}") ; go to Calibre subfolder
Sleep(250)
Send('ebook-meta.exe c:\test.mobi --title TESTbook --authors somebody' & "{Enter}")

Works well but i know it's not an elegant way. It would be the best the cmd window not show up at all or at least close when the exe done

I tryed to use run or runwait with no luck, i don't know how to use the parameters (--title ).

 

Edited by kisstom
Link to comment
Share on other sites

Probably going to look more like this:

RunWait(@ComSpec & " /cd Calibre/ebook-meta.exe " & "c:\test.mobi --title TESTbook --authors somebody)

 

https://www.autoitscript.com/wiki/Snippets_(_CMD_)

 

Link to comment
Share on other sites

@l3ill : what is this /cd parameter ??

Try this :

Run(@ComSpec & " /c ebook-meta.exe c:\test.mobi --title TESTbook --authors somebody", "Calibre")


 

​Many many years ago it was Change Directory :D

Link to comment
Share on other sites

Sorry guys none of this working... I tryed a lot of similar stuff without luck. I also know the @SW_HIDE parameter but i can't go so far :)

CD means change directory so the full path of the exe: @ScriptDir & "Calibre\ebook-meta.exe"

It needs a lot of DLLs and others so i put them a separate folder.

Link to comment
Share on other sites

Really a surprise this is so diffcult. I made some progress, working with this syntax:

Run(@ComSpec & " /k" & @ScriptDir & "\Calibre\ebook-meta.exe c:\test.mobi --title TESTbook --authors somebody")

But only if the script path NOT contain space(s). The run function help says: 'Paths with spaces need to be enclosed in quotation marks'

But how can i do this? '@ScriptDir' and "@ScriptDir" not working...

Any idea?

Link to comment
Share on other sites

@ComSpec stuff can be a little tricky, because it needs to be exactly correct in most instances.

Jewtus almost got it right. @ComSpec does not need wrapping in quotes. $CalibreDIR shouldn't need them either.
If TESTbook is a path, that will probably need wrapping in quotes too, especially where spaces exist.

RunWait(@ComSpec & ' /c "' & $ebook_meta & '" c:\test.mobi --title TESTbook --authors somebody', $CalibreDIR, @SW_HIDE)

If you use /k instead of /c while testing (and without @SW_HIDE), you will see if errors occur.

NOTE - As it is, c:\test.mobi, doesn't need quotes, but it might if it changed to something else.

RunWait(@ComSpec & ' /c "' & $ebook_meta & '" "c:\test.mobi" --title TESTbook --authors somebody', $CalibreDIR, @SW_HIDE)

 

Edited by TheSaint
greater clarity

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Link to comment
Share on other sites

You should really use single quotes (') to quote double quotes (") and vice-a-versa.

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Link to comment
Share on other sites

exit, solve isn't on this version of the boards... What I have been doing is editing my first post and changing the thread name to [Solved] - {original thread name}

Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

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