Jump to content
kisstom

[Solved] commandline exe tools

Recommended Posts

kisstom

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

Share this post


Link to post
Share on other sites
kisstom

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.

Share this post


Link to post
Share on other sites
kisstom

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?

Share this post


Link to post
Share on other sites
Jewtus

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)

 

Share this post


Link to post
Share on other sites
kisstom

?

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

Share this post


Link to post
Share on other sites
TheSaint

@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
  • Like 1

AutoIt.4.Life Clubrooms - Life is like a Donut (secret key)

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

Share this post


Link to post
Share on other sites
kisstom
Run(@ComSpec & " /c """ & @ScriptDir & "\Calibre\ebook-meta.exe""" & " c:\test.mobi --title TESTbook --authors somebody","",@SW_HIDE)

This line does exactly what i want :)

Thank you for the help guys

Share this post


Link to post
Share on other sites
TheSaint

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


AutoIt.4.Life Clubrooms - Life is like a Donut (secret key)

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

Share this post


Link to post
Share on other sites
kisstom

Can i mark this topic [Solved] ?

Share this post


Link to post
Share on other sites
Jewtus

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}

Share this post


Link to post
Share on other sites
kisstom

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

Share this post


Link to post
Share on other sites
SadBunny

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.

Share this post


Link to post
Share on other sites
kisstom

So... Quote that as well :)

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

 

​Tryed, not working...

Share this post


Link to post
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

×