wzc0014 Posted May 30, 2012 Share Posted May 30, 2012 I am working on an experiment for my research. I want to automate the following since I will be collecting 10000's samples. I am new to AutoIt but willing to learn, and I have a feeling that this is very simple to the experienced user unlike myself. 1. I want to click "Fire" in the software to fire my laser - My laser will then fire and trigger my CCD camera to open the shutter and capture an image... 2. The image stays active in the window of the acquisition program. - Currently, I have to click the save icon, enter the file name, and click save. - This is the step I want to automate since I will be having to save 10000's files, and I need it to loop save file1, file2, file3... etc. 3. Finally, I want to Loop this sequence of firing my laser and then saving the image x number of times Any help, and/or suggestions on where to look or what to read to figure this out for myself would be greatly appreciated. Walter Link to comment Share on other sites More sharing options...
wzc0014 Posted May 30, 2012 Author Share Posted May 30, 2012 In case anyone is interested I have solved my problem, maybe this can help some people. Local $i = 0 Do WinActivate("SeriCon - New") WinWaitActive("SeriCon - New", "Send") Send("{ENTER}") WinActivate("SonyIIDC - [No Sony camera in system]") WinWaitActive("SonyIIDC - [No Sony camera in system]") ControlClick("SonyIIDC - [No Sony camera in system]", "SAVE", 1170) WinWaitActive("Save As") Send("{" & $i & "}") Send("{ENTER}") $i = $i + 1 Sleep(1000) Until $i = 10 Link to comment Share on other sites More sharing options...
lark Posted May 31, 2012 Share Posted May 31, 2012 Just to point it out, it would be much more simple to use a for...next loop instead of a do...until. For $i = 0 To 10 WinActivate("SeriCon - New") WinWaitActive("SeriCon - New", "Send") Send("{ENTER}") WinActivate("SonyIIDC - [No Sony camera in system]") WinWaitActive("SonyIIDC - [No Sony camera in system]") ControlClick("SonyIIDC - [No Sony camera in system]", "SAVE", 1170) WinWaitActive("Save As") Send("{" & $i & "}") Send("{ENTER}") Sleep(1000) Next Link to comment Share on other sites More sharing options...
wzc0014 Posted May 31, 2012 Author Share Posted May 31, 2012 Thanks for the tip, but I am possibly missing something. What is the advantage of the for..next over the do..until? By much more simple, the only difference I can see is that it's two lines shorter... Link to comment Share on other sites More sharing options...
Mechaflash Posted May 31, 2012 Share Posted May 31, 2012 meh... gives you the same results, but reading the `for` on the first line, knowing how many times you are iterating before going to the end of the code helps for readability. Spoiler “Hello, ladies, look at your man, now back to me, now back at your man, now back to me. Sadly, he isn’t me, but if he stopped using ladies scented body wash and switched to Old Spice, he could smell like he’s me. Look down, back up, where are you? You’re on a boat with the man your man could smell like. What’s in your hand, back at me. I have it, it’s an oyster with two tickets to that thing you love. Look again, the tickets are now diamonds. Anything is possible when your man smells like Old Spice and not a lady. I’m on a horse.” Link to comment Share on other sites More sharing options...
wzc0014 Posted May 31, 2012 Author Share Posted May 31, 2012 Ok, thanks. Next issue..with what I currently have is sending the incremental number to the save as file name. Is there an easy way to add a time stamp to the file name that I am saving? Link to comment Share on other sites More sharing options...
Mechaflash Posted May 31, 2012 Share Posted May 31, 2012 msgbox(0,"",@YEAR & @MON & @MDAY & @HOUR & @MIN) Spoiler “Hello, ladies, look at your man, now back to me, now back at your man, now back to me. Sadly, he isn’t me, but if he stopped using ladies scented body wash and switched to Old Spice, he could smell like he’s me. Look down, back up, where are you? You’re on a boat with the man your man could smell like. What’s in your hand, back at me. I have it, it’s an oyster with two tickets to that thing you love. Look again, the tickets are now diamonds. Anything is possible when your man smells like Old Spice and not a lady. I’m on a horse.” 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