Jump to content

Recommended Posts

Posted (edited)

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
Posted

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.

Posted

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?

Posted

Well, I think you are pathing incorrectly. Try this:

 

$ebook_meta='Full path to exe'
$CalibreDIR='Full path to calibre dir'
RunWait('"' & @ComSpec & '" /c '&$ebook_meta&' c:\test.mobi --title TESTbook --authors somebody"', $CalibreDIR, @SW_HIDE)

 

Posted

?

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

 

​Madness :)  Need to be enclosed in quotation marks the FULL path, not just "@Scriptdir", Thank you Exit

Posted (edited)

@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

Posted

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

Posted

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}

Posted

Unfortunatelly not soved yet:mad:

Still have troluble with space(s) if there is in the 'test.mobi' path:

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

i getting error if enclosed in quotation marks the full stuff

Posted (edited)

So... Quote that as well :)

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

 

Edited by SadBunny

Roses are FF0000, violets are 0000FF... All my base are belong to you.

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...