Omehatl Posted April 12, 2020 Posted April 12, 2020 Hello guys, I have some doubts. I want to make a code for navigating an application, saving X amount of files with correct numeration (x1, x2, x3), however I run with some problems: *Can I create a Send command that will allow me to type ("Image 1") when x=1, ("Image 2") x=2, and so on? Sometimes I need to save up to 50 files so its important to have it work semi-automatic like that. *When the file is being saved (its actually rendering an image, but anyways) the application will open another window to do the render. How can I reference this new window using something like ProcessWaitClose ? That is all for now, thank you very much for the help!
Omehatl Posted April 12, 2020 Author Posted April 12, 2020 I cant seem to be able to edit my own post, but I solved the "x" counter part, however I still dont know how to solve the second issue. Btw, this is my code if it helps: Sleep(5000); Local $name = InputBox (" Confirmacion ", " ¿Cual nombre quieres para la imagen? / How do you want your image to be named?"); Local $numberofrenders = InputBox (" Confirmacion ", " ¿Cuantas imagenes desea renderizar?/ How many renders do you wish to create?"); Local $x = Int (1); While $x<=$numberofrenders Send("!f"); Send("B"); Sleep(2000); Send($name); Send($x); Send(".png"); Send("{ENTER}"); ProcessWaitClose(); $x++; Send("{LEFT}"); WEnd;
Subz Posted April 12, 2020 Posted April 12, 2020 You can use WinWaitClose or if you know the name of the window title, class etc... You can also use the following for a loop: Recommend using ControlSend rather than Send, use the AutoIt Window Info tool to find the window info. If you want to use ProcessWaitClose you would need to know the process id, you maybe able to do this with WinList, when using WinWait.. ProcessWait.. would recommend using a timeout otherwise the script will halt until that window or process becomes available. Local $sFileName = InputBox (" Confirmacion ", " ¿Cual nombre quieres para la imagen? / How do you want your image to be named?"); Local $iNumberOfRenders = InputBox (" Confirmacion ", " ¿Cuantas imagenes desea renderizar?/ How many renders do you wish to create?"); For $i = 1 To $iNumberOfRenders _Render($sFileName & $i & ".png") Next Func _Render($_sFileName) ControlSend("Title", "", "!f") ControlSend("Title", "", "B") Sleep(2000) ControlSend("Title", "", $_sFileName) ControlSend("Title", "", "{ENTER}") WinWaitClose("Title", "", 5) ControlSend("Title", "", "{LEFT}") EndFunc
Omehatl Posted April 12, 2020 Author Posted April 12, 2020 Thank you! Regrettably, I couldnt use ControlSend for most of the typing, because it seems even if I write exactly the application's window title (that i've got with AutoIt window tool), it wont detect it and the process wont work. But I can make it work for the "$_sFileName" line because that is another window. I had this trouble with the "WinWaitClose" command too, the name the tool provides isnt detected by the program. So I cant set any restriction and can just guess for now Other thing that I noticed is that Send {LEFT} comand wont work. Regrettably, this is the only thing preventing the code from actually working. All the other errors only impact time effectiveness. So to make it work, the code looks like this for now Local $_sPictureName = InputBox (" Confirmacion ", " ¿Cual nombre quieres para la imagen? / How do you want your image to be named?"); Local $iNumberOfRenders = InputBox (" Confirmacion ", " ¿Cuantas imagenes desea renderizar?/ How many renders do you wish to create?"); sleep(5000) For $i = 0 To $iNumberOfRenders _Render($_sPictureName & $i & ".png") Next Func _Render($_sPictureName) Send("!f"); Sleep(500) Send("B"); Sleep(1000) ControlSend("render to picture file", "", "", $_sPictureName) Send("{ENTER}") sleep(10000) Send("{LEFT}") EndFunc
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