Traveler Posted January 26, 2012 Posted January 26, 2012 Hi Can someone maybe help me build an AutoIT, where I can start a program 'example.exe' and the directory is unknown ? If AutoIT can do it like this from c:\ 1. dir example.exe /s /x > c:\fil.txt This search for the program called example.exe and, if found, puts the path into a file called fil.txt. 2. find "c:\" /i fil.txt This shows the path where the program is located. 3. Start the program somehow ?? Hope you can help.
Moderators JLogan3o13 Posted January 26, 2012 Moderators Posted January 26, 2012 Hi, Traveler. Can you clarify a little bit, so we can better assist? Are you looking for an interactive script? If so you could use FileOpenDialog from the helpfile to have the user browse for the file and click on it. If you are looking for a silent execution of the .exe, do you know anything about where it will be? It is much easier to do a system search for the file if you know it'll be somewhere in C:Program Files, vs. could be anywhere on the PC "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
Traveler Posted January 26, 2012 Author Posted January 26, 2012 Hi Sure. The problem is, that I have different places on different PCs, so in advance, I do not know where the program is located. And the AutoIT should be started by the user, and it should run silently untill executed successfully. The program is always located on c:
Moderators JLogan3o13 Posted January 26, 2012 Moderators Posted January 26, 2012 Hi, Traveler. You could do something like this (it will give you a start anyway).#include <array.au3>; #include <FileListToArrayEx.au3> $hFilesFolders = _FileListToArrayEx(@ProgramFilesDir, '*.exe') For $i = 0 To $hFilesFolders If Not StringInStr($hFilesFolders[0], "Test1.exe") Then _ArrayDelete($hFilesFolders, $i) EndIf Next Run(_ArrayToString($hFilesFolders), "")Note: this borrows heavily from SmokeN's great FileListtoArrayEX UDF. You can find that in this thread: "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
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