weiny Posted May 20, 2008 Share Posted May 20, 2008 I just recently discovered AutoIt and have my first script below. It uses the program Image Grabber to extract images from all the .avi files in a directory. Below are two images that should help visualize the process. http://i27.tinypic.com/opr7cx.pnghttp://i26.tinypic.com/288m3qc.pngAll seems to be okay except that the strings seem to change cases occasionally as shown below. I'm not touching the keyboard during the process at all if that rules out anything.http://i27.tinypic.com/dwbepl.pngI'm not sure if it's the ControlListView() or something like that that is causing the problem. In my test runs, the underscore sometimes gets changed to a hyphen and essentially halts the program because that filename doesn't exist and can't be opened.http://i31.tinypic.com/244qvrb.pngIf there's a possible explanation or another way to do this, I'm open to suggestions. Thanks.Please ignore any inefficiencies that I'm sure I have. The 'loop' essentially runs once beforehand just to use the GetItemCount to loop through the rest. I'm using version 3.2.12.0 from May 16th, 2008.expandcollapse popup$delaytime = 100;ms Run("Image Grabber.exe") WinWaitActive("Image Grabber") sleep($delaytime) $filenum = 0 ControlClick("Image Grabber", "", "[CLASSNN:Button1]");Open Button WinWaitActive("Open") sleep($delaytime) WinActivate("[CLASS:SysListView321]") $files = ControlListview("Open", "", "SysListView321", "GetItemCount") $filename = ControlListView("Open", "", "SysListView321", "GetText", $filenum, 0) ControlSend("Open", "", "[CLASSNN:Edit1]",$filename) sleep($delaytime) ControlClick("Open", "", "[CLASSNN:Button2]") WinWaitActive("Image Grabber") sleep($delaytime) ControlClick("Image Grabber", "", "[CLASSNN:Button2]");Save Button sleep($delaytime) $length = StringLen($filename) $filename = StringLeft($filename, $length - 4);Subtract '.avi' extension because error saving .jpg otherwise ControlSend("Save As", "", "[CLASSNN:Edit1]",$filename) WinWaitActive("Save As") sleep($delaytime) ControlClick("Save As", "", "[CLASSNN:Button2]") WinWaitActive("Finished!") ControlClick("Finished!", "", "[CLASSNN:Button1]") $filenum = $filenum + 1 ;;;;;;;;;;;;;;;;;;;;; while $filenum < $files ControlClick("Image Grabber", "", "[CLASSNN:Button1]") WinWaitActive("Open") sleep($delaytime) WinActivate("[CLASS:SysListView321]") $filename = ControlListView("Open", "", "SysListView321", "GetText", $filenum, 0) ControlSend("Open", "", "[CLASSNN:Edit1]",$filename) sleep($delaytime) ControlClick("Open", "", "[CLASSNN:Button2]") WinWaitActive("Image Grabber") sleep($delaytime) ControlClick("Image Grabber", "", "[CLASSNN:Button2]") sleep($delaytime) $length = StringLen($filename) $filename = StringLeft($filename, $length - 4) ControlSend("Save As", "", "[CLASSNN:Edit1]",$filename) WinWaitActive("Save As") sleep($delaytime) ControlClick("Save As", "", "[CLASSNN:Button2]") WinWaitActive("Finished!") ControlClick("Finished!", "", "[CLASSNN:Button1]") $filenum = $filenum + 1 wend WinClose("Image Grabber") Link to comment Share on other sites More sharing options...
Zedna Posted May 20, 2008 Share Posted May 20, 2008 This is known AutoIt Send(),ControlSend() limitation related to non-US keyboard layouts.As workaround just useControlSetText("Save As", "", "[CLASSNN:Edit1]",$filename)instead ofControlSend("Save As", "", "[CLASSNN:Edit1]",$filename)Look here at old topics about that:http://www.autoitscript.com/forum/index.php?showtopic=32584http://www.autoitscript.com/forum/index.ph...st&p=215442 Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
weiny Posted May 20, 2008 Author Share Posted May 20, 2008 This is known AutoIt Send(),ControlSend() limitation related to non-US keyboard layouts.I'm using the Dvorak layout which must've been the reason. Works excellent now. Thanks! 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