rootx Posted May 13, 2014 Share Posted May 13, 2014 Hello everyone, I need help to send from Autoit GUI input.text a var value to my batch... example... My windows batch program set /p sourcedir= and than FOR /f %%a IN ('dir /b /a-d "%sourcedir%*.jpg" ') DO ( etc...... ......................... Autoit ?? Local $sourcedir= InputBox("My program", "past source path.", "") This is because I would like to have a graphical user interface. Thanks. Link to comment Share on other sites More sharing options...
Tobei291 Posted May 13, 2014 Share Posted May 13, 2014 You don't need a batch file. Autoit can send commands like a console, and you can pull off the for statement in a similar manner. That being said... set /p sourcedir=%%1* then when you run the batch file from within the script, just supply the $sourcedir variable as it's argument (use quotes around it). ShellExecute ("list-pics.bat",$sourcedir,"","open",@SW_HIDE) Link to comment Share on other sites More sharing options...
jguinch Posted May 13, 2014 Share Posted May 13, 2014 (edited) You probably can replace the batch file by an AutoIt script, using functions like FileSelectFolder(), _FileListToArray(), and a loop... For example : #Include <File.au3> Local $sourcedir= FileSelectFolder("Choose a folder", "", "", @ScriptDir) If $sourcedir = "" Then Exit Local $aFiles = _FileListToArray ( $sourcedir, "*.jpg", 1, 1) For $i = 1 To $aFiles[0] ; Do wha you want with $aFiles[$i] Next Edited May 13, 2014 by jguinch Spoiler Network configuration UDF, _DirGetSizeByExtension, _UninstallList Firefox ConfigurationArray multi-dimensions, Printer Management UDF Link to comment Share on other sites More sharing options...
rootx Posted May 14, 2014 Author Share Posted May 14, 2014 Tanks, jguinch, Tobei291 Well my program run very well inside dos shell, rewrite all ..... is very expensive! My solution?..... easy, write one init txt file with Autoit, then read all variable from it ;explode Local $sourcedir= FileSelectFolder("Choose a folder", "", "", @ScriptDir) If $sourcedir = "" Then Exit ;build txt init FileWrite($file, $page) FileWrite($file, @CRLF) FileWrite($file, $title) FileWrite($file, @CRLF) FileWrite($file, $imgfolder) FileWrite($file, @CRLF) FileWrite($file, $descr) FileWrite($file, @CRLF) FileWrite($file,$sourcedir) FileClose($file) My last question .... it is possible to run exe in hide mode? 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