Sign in to follow this  
Followers 0
Bob Wya

Calling a 3rd party CLI command - wierd problem?!

4 posts in this topic

I am trying to call the Rehash utility under Windows XP Pro:

Rehash Utility

When I call this command in command window it works fine:

C:\███\███\███\███\███\███\> "C:\Program Files (x86)\Rehash\rehash.exe" -none -crc32 -tiger "██████████.avi" > "temp.txt"

I have set up the working directory correctly... Any thoughts what could be going wrong?? I get an error code 3 when I

try and run the script and it exits straight away...

Doesn't work

Redirecting to a file does not work in an AutoIt script but does from a command window.

CODE

Const $c_rehash_executable_path_default = "C:\Program Files (x86)\Rehash\rehash.exe"

Global $s_hash_path, $s_hash_folder, $s_hash_file

Global $gs_temp_hash_file

Global $return_code

$s_hash_folder = "C:\███\███\███\███\███\███\"

$s_hash_file = "███.avi"

$s_hash_path = $s_hash_folder & $s_hash_file

$gs_temp_hash_file = "temp.txt"

$return_code = RunWait ("""" & $c_rehash_executable_path_default & """ -none -crc32 -tiger """ & $s_hash_file & """ > """ & $gs_temp_hash_file & """" , $s_hash_folder, @SW_HIDE)

ConsoleWrite("return code = " & $return_code & @CRLF)

ConsoleWrite(FileRead($gs_temp_hash_file) & @CRLF)

Exit

Works

I don't really want to use an AutoIt script wrapper for the Rehash process but this does work!

CODE

#include <Constants.au3>

Const $c_rehash_executable_path_default = "C:\Program Files (x86)\Rehash\rehash.exe"

Global $s_hash_path, $s_hash_folder, $s_hash_file

Global $output_stream

Global $gpid_rehash

$gpid_rehash = 0

$s_hash_folder = "C:\███\███\███\███\███\███\"

$s_hash_file = "███.avi"

$s_hash_path = $s_hash_folder & $s_hash_file

$gpid_rehash = Run("""" & $c_rehash_executable_path_default & """ -none -crc32 -tiger """ & $s_hash_file & """", $s_hash_folder, @SW_HIDE, $STDOUT_CHILD)

While ProcessExists($gpid_rehash)

Sleep(1000)

WEnd

$output_stream = StdoutRead($gpid_rehash)

ConsoleWrite($output_stream & @CRLF)

Exit

Share this post


Link to post
Share on other sites



what about this version ?:

$return_code = RunWait(@ComSpec & ' /c "' & $c_rehash_executable_path_default & '" -none -crc32 -tiger "' & $s_hash_file & '" > "' & $gs_temp_hash_file & '"', $s_hash_folder, @SW_HIDE)

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

what about this version ?:

$return_code = RunWait(@ComSpec & ' /c "' & $c_rehash_executable_path_default & '" -none -crc32 -tiger "' & $s_hash_file & '" > "' & $gs_temp_hash_file & '"', $s_hash_folder, @SW_HIDE)
Thanks but...

No that that form is only for executing commands built into the DOS shell. The Rehash command is like any installed executable (just happens not have a GUI).

Its wierd that it works in an AutoIt script except when I use the command option to output to a file...

Bob

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Thanks but...

No that that form is only for executing commands built into the DOS shell. The Rehash command is like any installed executable (just happens not have a GUI).

Its wierd that it works in an AutoIt script except when I use the command option to output to a file...

Bob

AFAIK the PIPE ">" function is a function of the CMD shell so I expect you require that to make the ">" work.

I have reread your initial post and am kinda lost on what format you are really looking for now.

Do you want to use the PIPE to file of do you want to use the Build-in STDIO functionality ?

Edited by Jos

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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
Sign in to follow this  
Followers 0