schmelle Posted August 30, 2008 Share Posted August 30, 2008 (edited) Hi all, nice to be back again. I've got a big problem running openssl.exe from an Autoit script. I want to automate decrypting files with Autoit. This works, but User must press one time any key: #include <Process.au3> AutoItSetOption ("MustDeclareVars",0) Dim $OWNSSLKEY = "my_private_SSL-Key" Dim $SSLPATH = "C:\Program Files\OPENSSL\bin" Dim $keyfile = "C:\Temp\Key.txt.enc" Dim $decryptkeyfile = "" $decryptkeyfile = RunWait (@ComSpec&" /c "&"pause | "&Chr(34)&$SSLPATH&Chr(34)&"\openssl.exe enc -d -bf -in "&Chr(34)&$keyfile&Chr(34)&" -out "&Chr(34)&@WorkingDir&"\Key.txt"&Chr(34)&" -k "&$OWNSSLKEY) This should be the reason, but nothing happens (the output file is not created): #include <Process.au3> AutoItSetOption ("MustDeclareVars",0) Dim $OWNSSLKEY = "my_private_SSL-Key" Dim $SSLPATH = "C:\Program Files\OPENSSL\bin" Dim $keyfile = "C:\Temp\Key.txt.enc" Dim $decryptkeyfile = "" $decryptkeyfile = RunWait (@ComSpec&" /c "&Chr(34)&$SSLPATH&Chr(34)&"\openssl.exe enc -d -bf -in "&Chr(34)&$keyfile&Chr(34)&" -out "&Chr(34)&@WorkingDir&"\Key.txt"&Chr(34)&" -k "&$OWNSSLKEY) The difference ist the "pause" command at the beginning of RunWait command after @ComSpec. Thanks for help. schmelle Edited August 31, 2008 by schmelle [font="Courier New"]Tell it - and I will forget it...Show it - and I will remember me...Share it - and I will understand it![/font] Link to comment Share on other sites More sharing options...
Zedna Posted August 30, 2008 Share Posted August 30, 2008 Try: $decryptkeyfile = RunWait (@ComSpec & ' /c "' & $SSLPATH & '\openssl.exe" enc -d -bf -in ' & $keyfile & '" -out "' & @WorkingDir & '\Key.txt"' & " -k " & $OWNSSLKEY) Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
schmelle Posted August 31, 2008 Author Share Posted August 31, 2008 Thanks for your reply. Trying your code does not resolve my problem. The file Key.txt is not created. Any other suggestions? BR schmelle [font="Courier New"]Tell it - and I will forget it...Show it - and I will remember me...Share it - and I will understand it![/font] Link to comment Share on other sites More sharing options...
martin Posted August 31, 2008 Share Posted August 31, 2008 Hi all, nice to be back again. I've got a big problem running openssl.exe from an Autoit script. I want to automate decrypting files with Autoit. This works, but User must press one time any key: #include <Process.au3> AutoItSetOption ("MustDeclareVars",0) Dim $OWNSSLKEY = "my_private_SSL-Key" Dim $SSLPATH = "C:\Program Files\OPENSSL\bin" Dim $keyfile = "C:\Temp\Key.txt.enc" Dim $decryptkeyfile = "" $decryptkeyfile = RunWait (@ComSpec&" /c "&"pause | "&Chr(34)&$SSLPATH&Chr(34)&"\openssl.exe enc -d -bf -in "&Chr(34)&$keyfile&Chr(34)&" -out "&Chr(34)&@WorkingDir&"\Key.txt"&Chr(34)&" -k "&$OWNSSLKEY) This should be the reason, but nothing happens (the output file is not created): #include <Process.au3> AutoItSetOption ("MustDeclareVars",0) Dim $OWNSSLKEY = "my_private_SSL-Key" Dim $SSLPATH = "C:\Program Files\OPENSSL\bin" Dim $keyfile = "C:\Temp\Key.txt.enc" Dim $decryptkeyfile = "" $decryptkeyfile = RunWait (@ComSpec&" /c "&Chr(34)&$SSLPATH&Chr(34)&"\openssl.exe enc -d -bf -in "&Chr(34)&$keyfile&Chr(34)&" -out "&Chr(34)&@WorkingDir&"\Key.txt"&Chr(34)&" -k "&$OWNSSLKEY) The difference ist the "pause" command at the beginning of RunWait command after @ComSpec. Thanks for help. schmelleInstead of RunWait, test your script but using ConsoleWrite or MsgBox and then you will be able to see what is wrong. MsgBox( 0,"result is", @ComSpec&" /c "&Chr(34)&$SSLPATH&Chr(34)&"\openssl.exe enc -d -bf -in "&Chr(34)&$keyfile&Chr(34)&" -out "&Chr(34)&@WorkingDir&"\Key.txt"&Chr(34)&" -k "&$OWNSSLKEY) Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
schmelle Posted August 31, 2008 Author Share Posted August 31, 2008 Hi Martin, I've ckecked this before with MsgBox. It seems that there is a timing problem within the "Run.." Commands. I think that the command is sent before cmd.exe is ready to accept input. I tried it out with Run, RunWait and _RunDOS. Nothing works as expected. Then I tried it out was using a "dummy" command at first and then it works as expected. $decryptkeyfile = _RunDOS (@ComSpec&" /c "&"path | "&Chr(34)&$SSLPATH&Chr(34)&"\openssl.exe enc -d -bf -in "&Chr(34)&$keyfile&Chr(34)&" -out "&Chr(34)&@WorkingDir&"\Key.txt"&Chr(34)&" -k "&$OWNSSLKEY) Why ever it works now. Should I file a Bug Report? Thanks and BR schmelle [font="Courier New"]Tell it - and I will forget it...Show it - and I will remember me...Share it - and I will understand it![/font] Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now