Sign in to follow this  
Followers 0
joeloyzaga

running exe with parameters

10 posts in this topic

was looking at internet and found this to run via command line and wondered how to do it via autoit

C:pathbin>call mdrv.exe -usr "c:testtestFotMdrv.usr"

tried doing this and its come up with syntax errors (see attachment)

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****

#AutoIt3Wrapper_Outfile_type=a3x
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
Run (C:Program Files (x86)HPUnified Functional Testingbinmdrv.exe -usr , "C:pwcPWC-QTPPWC-QTP.usr")

post-47107-0-49969900-1410306517_thumb.j

Share this post


Link to post
Share on other sites



Try something like this:

$sPath = "C:\Program Files (x86)\HP\Unified Functional Testing\bin\mdrv.exe"
ShellExecute($sPath, ' -usr , "C:\pwc\PWC-QTP\PWC-QTP.usr"')
 If @error Then ConsoleWrite("Run failed with error: " & @error & @CRLF)

√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

#include <MsgBoxConstants.au3>

$Path = "C:\path\bin\"
$Exe = "call mdrv.exe"
$Switch1 = "-usr"
$Switch2 = '"' & "" & 'c:\test\testForMdv.usr' & '"'

MsgBox(0,"",$Path & $Exe & " " & $Switch1 & " " & $Switch2)

Here's a dirtier way of doing it.


Get Scite to add a popup when you use a 3rd party UDF -> http://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/user-calltip-manager.html

Share this post


Link to post
Share on other sites

Are you trying to make a Rube Goldberg script?!


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

I did not get an error it could capture - but 
I did get an error

see attached

post-47107-0-00668100-1410327353_thumb.j

Share this post


Link to post
Share on other sites

So that tells you that the first half of the ShellExecute (the path to the file) is correct. You have an error in the command line parameters. Is there supposed to be a space between -user and the comma? Can you verify the 'C:pwcpwc-qtppwc-qtp.usr' file exists?


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

this is the code now

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Outfile_type=a3x
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
$sPath = "C:Program Files (x86)HPUnified Functional Testingbinmdrv.exe"
ShellExecute($sPath, ' -usr "C:pwcPWC-QTPPWC-QTP.usr"')
 If @error Then ConsoleWrite("Run failed with error: " & @error & @CRLF)
 
seems to run it but nothing is started
>"C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "C:UsersJoe LoyzagaDesktopRun UFT.au3" /UserParams    
+>09:35:57 Starting AutoIt3Wrapper v.14.801.2025.0 SciTE v.3.4.4.0   Keyboard:00000409  OS:WIN_7/Service Pack 1  CPU:X64 OS:X64    Environment(Language:0409)
+>         SciTEDir => C:Program Files (x86)AutoIt3SciTE   UserDir => C:UsersJoe LoyzagaAppDataLocalAutoIt v3SciTEAutoIt3Wrapper   SCITE_USERHOME => C:UsersJoe LoyzagaAppDataLocalAutoIt v3SciTE 
>Running AU3Check (3.3.12.0)  from:C:Program Files (x86)AutoIt3  input:C:UsersJoe LoyzagaDesktopRun UFT.au3
+>09:36:02 AU3Check ended.rc:0
>Running:(3.3.12.0):C:Program Files (x86)AutoIt3autoit3.exe "C:UsersJoe LoyzagaDesktopRun UFT.au3"    
--> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop
+>09:36:03 AutoIt3.exe ended.rc:0
+>09:36:03 AutoIt3Wrapper Finished.
>Exit code: 0    Time: 6.028

Share this post


Link to post
Share on other sites

Is the error message still coming up?


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

yes

this is the actual command I use on the windows command line

C:Program Files (x86)HPUnified Functional Testingbin>call mdrv.exe -usr "c:pwcPWC-QTPPWC-QTP.usr"

How can I run it via autoit then? use the Run function? keep getting the syntax wrong

Share this post


Link to post
Share on other sites

Try

Shellexecute('C:Program Files (x86)HPUnified Functional Testingbinmdrv.exe','-usr "c:pwcPWC-QTPPWC-QTP.usr"','C:Program Files (x86)HPUnified Functional Testingbin')

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