How to launch .exe file with run - autoit

I tried to launch a program with Run & Runwait but the program don't appear
Run & Runwait command
Run('R:\Windows\Bureau\Hoop Bot\lib\scrcpy-win64\scrcpy-noconsole.exe')
Or
Run('#Scriptdir\lib\scrcpy-win64\scrcpy-noconsole.exe')
same with runwait
No error messages

Try setting the working dir for the program.
Run('R:\Windows\Bureau\Hoop Bot\lib\scrcpy-win64\scrcpy-noconsole.exe', 'R:\Windows\Bureau\Hoop Bot\lib\scrcpy-win64\')
And if you are using #ScriptDir it should go like this:
Run(#Scriptdir & '\lib\scrcpy-win64\scrcpy-noconsole.exe', 'R:\Windows\Bureau\Hoop Bot\lib\scrcpy-win64\')

Related

Autoit launches batchfile passing variable

I'm currently trying to create an installation tool. I have a a batch file calling some sqlcmd commands and I'd like to trigger it from Autoit. It works.
Now, I'd like to set a variable in Autoit (by getting it from a GUI) and pass it to the batch file when calling it. It should be something like this :
RunWait('path_of_file\mybat.bat' & %myVar%)
I read a lot from the Autoit community without finding the answer. I got things like :
RunWait('path_of_file\mybat.bat' & " " & $myVar) <- This solution didn't work for me
or
RunWait(#ComSpec & " /k "...) <- This one didn't suit what I'd like to do, as I'm
launching a batchfile and not a cmd command.
If anyone has an idea !
Thanks in advance :)
This should work:
Autoit works
Local $myVar = "ipconfig"
RunWait('mybat.bat ' & $myVar)
Autoit works too
ShellExecute("mybat.bat", $myVar)
mybat.bat
#echo off
echo %1
%1
ping 127.0.0.1 -n 6 > nul

Why cant I run my application with a default file like that of notepad?

Why cant I run my application with a default file like that of Notepad ?
AutoIt sample code below :
Example()
Func Example()
; Run Notepad
Run("Notepad.exe " & "C:\Users\judith_francis\Desktop\dd.txt")
Run("C:\Program Files (x86)\abc\abc.exe" & "C:\Users\xyz\Desktop\test_image.tif")
EndFunc
This line:
Run("C:\Program Files (x86)\abc\abc.exe" & "C:\Users\xyz\Desktop\test_image.tif")
Runs the command
C:\Program Files (x86)\abc\abc.exeC:\Users\xyz\Desktop\test_image.tif
Which Windows will interpret as
C:\Program
Try instead
Run('"C:\Program Files (x86)\abc\abc.exe" ' & '"C:\Users\xyz\Desktop\test_image.tif"')
Which adds the necessary space & quotes & will be executed as
"C:\Program Files (x86)\abc\abc.exe" "C:\Users\xyz\Desktop\test_image.tif"

How to Run Testcomplete from command line

I have a project in test complete that contains only Test scripts no keyword testing.
When i run my main script from command line it gives compiler error "file missing". I want to catch this error in cmd and close test complete.
"C:\Program Files (x86)\SmartBear\TestComplete 11\Bin\TestComplete.exe" "C:\Users\Username\Desktop\project\TestProject1\BLABLABLA" /r /p:projectname /u:Scriptname /rt:MainScriptRoutine /run /exit
If you want to make sure that TestComplete is not just stopped with the error message displayed during your night tests, you can run it with the /SilentMode command-line parameter. In this case, TestComplete will not show any GUI dialogs and messages.

command prompt, opening a csv file?

how do i open a file csv ? with the last command here vi
it open it the command prompt, but how do i open it on csv file normarlly
without open it on the command prompt?
[#dc1-ora rci]$ ls
backup diamond20130306.csv
diamond2012_04_30_dev.csv diamond_points_20120820.csv
diamond20120801.csv diamond_points_20120827.csv
diamond20120802.csv diamond_points_20120828.csv
diamond20120803.csv diamond_points_20121217.csv
diamond20120804.csv diamond_points_20130129.csv
diamond20120806.csv diamond_points_20130130.csv
diamond20120807.csv diamond_points_20130205.csv
diamond20120808.csv diamond_points_20130306.csv
diamond20120828.csv diamond_points_20130326.csv
diamond20120906.csv diamond_points_20130410.csv
diamond20121025.csv diamond_rental_20121219.csv
diamond20121029.csv diamond_rental_20121220.csv
diamond20121218.csv diamond_rental_20121221.csv
diamond20130128.csv ilx_final_lead_merge.csv
diamond20130129.csv test_diamond20120820.csv
diamond20130130.csv test_diamond20120827.csv
diamond20130131.csv test_diamond20120828.csv
diamond20130205.csv test.txt
diamond20130219.csv THH_RCT_RCI_EDM_FILE_01_28_13.csv
[#dc1-ora rci]$ vi test_diamond20120820.c
sv
( opens file here on the command prompt)
On windows/cmd you should do:
start notepad++ test_diamond20120820.csv
in your case:
start Excel.exe test_diamond20120820.csv
or for the default application associated with it use :
start test_diamond20120820.csv
(didn't test I am using linux maybe I will test it later if I reboot)
But I suspect you don't mean command prompt but a linux terminal (because of your tags):
you can use any of those:
gedit test_diamond20120820.csv &
nedit test_diamond20120820.csv &
etc depending on the programs you have installed
or for the default application associated with it use :
xdg-open test_diamond20120820.csv
if you are remotely logged in using ssh make sure you have X enabled

Why does SendKeys produce an error in Windows 7?

I am trying to run this code:
SendKeys "copy /b /y " & outputfile & " " & printerid & "{Enter}", 1.
It runs fine in Windows XP but in Windows 7 it gives an error.
I am trying to copy a string into cmd and execute it.
The "{Enter}" part is giving error.
Please help.
A quick test on Windows 7 gives me:
'sendkeys' is not recognized as an internal or external command,
operable program or batch file.
If that's the same error that you're getting, it means you don't have the program. Try copying it over from XP and see if that works.
If you've already copied it, it might not be in your PATH. Try this:
set PATH=%PATH%;C:\Path\to\SendKeys\
where C:\Path\to\SendKeys is the folder that contains SendKeys.exe.

Resources