Eng Posted April 30, 2017 Share Posted April 30, 2017 Hi dear community, Before starting this topic, I've searched on manuals, examples and forums but I couldn't find. In my opinion this should be a fundamental request. For my part all newbies are curious about this. Batch processes are big deal. Could you explain simply by giving an example? How can we do the following loop: List files on specific directory (maybe by extension, for example *.txt) Take the first file, open it with an external application. Send keystrokes or anything... on the external application. End the process of the external application. Take the 2nd file, and open... I really appreciate any help you can provide. Link to comment Share on other sites More sharing options...
Developers Jos Posted April 30, 2017 Developers Share Posted April 30, 2017 Open the Helpfile and search for: FileFindFirstFile / FileFindNextFile / _FileListToArray Run / ShellExecute Send() / ControlSend() ProcessClose() For ... Next Can't be that hard Jos 232showtime and Eng 2 SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Eng Posted April 30, 2017 Author Share Posted April 30, 2017 Thanks for replying, sir. Do not be annoyed with me. Without an example I do not understand. So I tried changing the example in the help file. The end part is wrong, of course. expandcollapse popup#include <MsgBoxConstants.au3> Example() Func Example() Local $hSearch = FileFindFirstFile("*.txt") ; Check if the search was successful, if not display a message and return False. If $hSearch = -1 Then MsgBox($MB_SYSTEMMODAL, "", "Error: No files/directories matched the search pattern.") Return False EndIf ; Assign a Local variable the empty string which will contain the files names found. Local $sFileName = "", $iResult = 0 While 1 $sFileName = FileFindNextFile($hSearch) ; If there is no more file matching the search. If @error Then ExitLoop ; Do it ShellExecute ($sFileName) Sleep(2000) Send("^k") Sleep(1000) Send("{ENTER}") Sleep(1000) Send("{ENTER}") Send("!{F4}") Sleep(2000) ExitLoop; WEnd ; Close the search handle. FileClose($hSearch) EndFunc ;==>Example Link to comment Share on other sites More sharing options...
Developers Jos Posted April 30, 2017 Developers Share Posted April 30, 2017 I assume it only does one file? That last ExitLoop looks wrong and should be removed. Else describe if you still have a question or not. Jos Eng 1 SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Eng Posted April 30, 2017 Author Share Posted April 30, 2017 Wow thank you! It works. By the way your brain works like a compiler. I feel very stupid myself. Why am I trying so hard to understand the commands? Best regards. Link to comment Share on other sites More sharing options...
Developers Jos Posted April 30, 2017 Developers Share Posted April 30, 2017 21 minutes ago, Eng said: Wow thank you! It works. By the way your brain works like a compiler. They didn't tell you on your way in? ... I am a robot. Eng and kylomas 2 SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. 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