nceipr Posted June 16, 2013 Share Posted June 16, 2013 (edited) Try to combine my recorded script and this one But mine has bunch of errors: 1."While" statement has no matching "Wend" statement 2.Func has no matching "EndFunc" Google don't Opt("WinTitleMatchMode", 2) HotKeySet ( "!^{q}", "_doit" ) HotKeySet("!{ESC}", "Terminate") While 1 Func _doit() _WinWaitActivate("FastStone Image Viewer 4.2","") Send("{F2}") _WinWaitActivate("Rename","") Send("{HOME}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{SHIFTDOWN}{END}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{SHIFTUP}{CTRLDOWN}c{CTRLUP}{ESC}") _WinWaitActivate("FastStone Image Viewer 4.2","") Send("{ENTER}") _WinWaitActivate(".jpg - FastStone Image Viewer 4.2","") Send("{F2}") _WinWaitActivate("Rename","") Send("{CTRLDOWN}v{CTRLUP}{ENTER}") _WinWaitActivate(".jpg - FastStone Image Viewer 4.2","") Send("{BACKSPACE}") _WinWaitActivate("FastStone Image Viewer 4.2","") Send("{RIGHT}") Func Terminate() Exit 0 EndFunc WEnd Edited June 16, 2013 by nceipr Link to comment Share on other sites More sharing options...
TheSaint Posted June 16, 2013 Share Posted June 16, 2013 (edited) Basically you don't have an EndFunc before the Wend, which is throwing the While - Wend error too. This is a pretty basic error, so I'm wondering if you actually know how to script and if these are code you actually wrote yourself? Forget most of that, I just re-read your post, so undoubtedly you are a beginner. Researching those keywords in the Help file is always a good place to start, and may have given you the clues to determine my explanation of the errors. I suggest you do the freely available tutorials here, which will help you make sense of the stuff you are recording. However, I really do not recommend that you start your experience with AutoIt, using Recorder programs. They are better used once you have a grasp of some of the basics. Edited June 16, 2013 by TheSaint Make sure brain is in gear before opening mouth! Remember, what is not said, can be just as important as what is said. Spoiler What is the Secret Key? Life is like a Donut If I put effort into communication, I expect you to read properly & fully, or just not comment. Ignoring those who try to divert conversation with irrelevancies. If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it. I'm only big and bad, to those who have an over-active imagination. I may have the Artistic Liesense to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage) Link to comment Share on other sites More sharing options...
nceipr Posted June 16, 2013 Author Share Posted June 16, 2013 Basically you don't have an EndFunc before the Wend, which is throwing the While - Wend error too. This is a pretty basic error, so I'm wondering if you actually know how to script and if these are code you actually wrote yourself? Forget most of that, I just re-read your post, so undoubtedly you are a beginner. Researching those keywords in the Help file is always a good place to start, and may have given you the clues to determine my explanation of the errors. I suggest you do the freely available tutorials here, which will help you make sense of the stuff you are recording. However, I really do not recommend that you start your experience with AutoIt, using Recorder programs. They are better used once you have a grasp of some of the basics. OK I have edited code, but error still occur Yes, I'm a newbie, but have experience with the AHK Link to comment Share on other sites More sharing options...
water Posted June 16, 2013 Share Posted June 16, 2013 Welcome to AutoIt and the forum! To create more reliable scripts I suggest to move from Send/WinWait commands to the Control* commands. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
czardas Posted June 16, 2013 Share Posted June 16, 2013 (edited) Do not put the Func keyword inside a loop. Opt("WinTitleMatchMode", 2) HotKeySet ( "!^{q}", "_doit" ) HotKeySet("!{ESC}", "Terminate") While 1 Sleep(10) WEnd Func _doit() _WinWaitActivate("FastStone Image Viewer 4.2","") Send("{F2}") _WinWaitActivate("Rename","") Send("{HOME}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{SHIFTDOWN}{END}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{SHIFTUP}{CTRLDOWN}c{CTRLUP}{ESC}") _WinWaitActivate("FastStone Image Viewer 4.2","") Send("{ENTER}") _WinWaitActivate(".jpg - FastStone Image Viewer 4.2","") Send("{F2}") _WinWaitActivate("Rename","") Send("{CTRLDOWN}v{CTRLUP}{ENTER}") _WinWaitActivate(".jpg - FastStone Image Viewer 4.2","") Send("{BACKSPACE}") _WinWaitActivate("FastStone Image Viewer 4.2","") Send("{RIGHT}") EndFunc Func Terminate() Exit EndFunc Edited June 16, 2013 by czardas operator64 ArrayWorkshop Link to comment Share on other sites More sharing options...
nceipr Posted June 16, 2013 Author Share Posted June 16, 2013 (edited) Now it's work but not loop. Opt('WinWaitDelay',200) Opt('WinDetectHiddenText',1) Opt('MouseCoordMode',0) Opt("WinTitleMatchMode", 2) HotKeySet ( "!^{q}", "_doit" ) HotKeySet("!{ESC}", "Terminate") While 1 Sleep(10) WEnd Func _doit() _WinWaitActivate("FastStone Image Viewer 4.2","") Send("{F2}") _WinWaitActivate("Rename","") Send("{HOME}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{SHIFTDOWN}{END}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{SHIFTUP}{CTRLDOWN}c{CTRLUP}{ESC}") _WinWaitActivate("FastStone Image Viewer 4.2","") Send("{ENTER}") _WinWaitActivate(".jpg - FastStone Image Viewer 4.2","") Send("{F2}") _WinWaitActivate("Rename","") Send("{CTRLDOWN}v{CTRLUP}{ENTER}") _WinWaitActivate(".jpg - FastStone Image Viewer 4.2","") Send("{BACKSPACE}") _WinWaitActivate("FastStone Image Viewer 4.2","") Send("{RIGHT}") EndFunc Func Terminate() Exit 0 Endfunc Edited June 16, 2013 by nceipr Link to comment Share on other sites More sharing options...
czardas Posted June 16, 2013 Share Posted June 16, 2013 Put a loop inside the function. operator64 ArrayWorkshop Link to comment Share on other sites More sharing options...
nceipr Posted June 16, 2013 Author Share Posted June 16, 2013 Put a loop inside the function. I'm sorry but I don't understand - I'm not native speaker. Can u code it? Link to comment Share on other sites More sharing options...
czardas Posted June 16, 2013 Share Posted June 16, 2013 (edited) where are you from? Edited June 16, 2013 by czardas operator64 ArrayWorkshop Link to comment Share on other sites More sharing options...
nceipr Posted June 16, 2013 Author Share Posted June 16, 2013 Ethiopia Link to comment Share on other sites More sharing options...
czardas Posted June 16, 2013 Share Posted June 16, 2013 (edited) So I guess you speak Amharic. Perhaps this dictionary will help. Replace this part. Func _doit() While 1 _WinWaitActivate("FastStone Image Viewer 4.2","") Send("{F2}") _WinWaitActivate("Rename","") Send("{HOME}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{SHIFTDOWN}{END}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{SHIFTUP}{CTRLDOWN}c{CTRLUP}{ESC}") _WinWaitActivate("FastStone Image Viewer 4.2","") Send("{ENTER}") _WinWaitActivate(".jpg - FastStone Image Viewer 4.2","") Send("{F2}") _WinWaitActivate("Rename","") Send("{CTRLDOWN}v{CTRLUP}{ENTER}") _WinWaitActivate(".jpg - FastStone Image Viewer 4.2","") Send("{BACKSPACE}") _WinWaitActivate("FastStone Image Viewer 4.2","") Send("{RIGHT}") WEnd EndFunc Edited June 16, 2013 by czardas operator64 ArrayWorkshop Link to comment Share on other sites More sharing options...
TheSaint Posted June 16, 2013 Share Posted June 16, 2013 (edited) @nceipr While 1 _doit() Sleep(10) WEnd Or the loop version given by czardas. Do not put the Func keyword inside a loop. Oops, sometimes we (I) miss the obvious. EDIT Edited because it didn't read right. Edited June 16, 2013 by TheSaint Make sure brain is in gear before opening mouth! Remember, what is not said, can be just as important as what is said. Spoiler What is the Secret Key? Life is like a Donut If I put effort into communication, I expect you to read properly & fully, or just not comment. Ignoring those who try to divert conversation with irrelevancies. If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it. I'm only big and bad, to those who have an over-active imagination. I may have the Artistic Liesense to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage) Link to comment Share on other sites More sharing options...
nceipr Posted June 16, 2013 Author Share Posted June 16, 2013 So I guess you speak Amharic. Perhaps this dictionary will help. Replace this part. Func _doit() While 1 _WinWaitActivate("FastStone Image Viewer 4.2","") Send("{F2}") _WinWaitActivate("Rename","") Send("{HOME}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{SHIFTDOWN}{END}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{SHIFTUP}{CTRLDOWN}c{CTRLUP}{ESC}") _WinWaitActivate("FastStone Image Viewer 4.2","") Send("{ENTER}") _WinWaitActivate(".jpg - FastStone Image Viewer 4.2","") Send("{F2}") _WinWaitActivate("Rename","") Send("{CTRLDOWN}v{CTRLUP}{ENTER}") _WinWaitActivate(".jpg - FastStone Image Viewer 4.2","") Send("{BACKSPACE}") _WinWaitActivate("FastStone Image Viewer 4.2","") Send("{RIGHT}") WEnd EndFunc Everytime closes right after open Or the loop version given by czardas. Oops, sometimes we (I) miss the obvious. EDIT Edited because it didn't read right. It's work but immediately without hotkey. Link to comment Share on other sites More sharing options...
czardas Posted June 16, 2013 Share Posted June 16, 2013 (edited) Everytime closes right after open Then there is something wrong with the method you are using. It's work but immediately without hotkey. Are you sure it works? - because there is not much difference between the two examples, The only difference is Sleep(10). Edited June 16, 2013 by czardas operator64 ArrayWorkshop Link to comment Share on other sites More sharing options...
nceipr Posted June 16, 2013 Author Share Posted June 16, 2013 Then there is something wrong with the method you are using. Are you sure it works? - because there is not much difference between the two examples, The only difference is Sleep(10). Yes, autoit closes immediately. Link to comment Share on other sites More sharing options...
Solution czardas Posted June 16, 2013 Solution Share Posted June 16, 2013 (edited) I don't think you replaced the code like I said, which would explain why AutoIt exits. Opt("WinTitleMatchMode", 2) HotKeySet ( "!^{q}", "_doit" ) HotKeySet("!{ESC}", "Terminate") While 1 Sleep(10) WEnd Func _doit() While 1 _WinWaitActivate("FastStone Image Viewer 4.2","") Send("{F2}") _WinWaitActivate("Rename","") Send("{HOME}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{SHIFTDOWN}{END}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{SHIFTUP}{CTRLDOWN}c{CTRLUP}{ESC}") _WinWaitActivate("FastStone Image Viewer 4.2","") Send("{ENTER}") _WinWaitActivate(".jpg - FastStone Image Viewer 4.2","") Send("{F2}") _WinWaitActivate("Rename","") Send("{CTRLDOWN}v{CTRLUP}{ENTER}") _WinWaitActivate(".jpg - FastStone Image Viewer 4.2","") Send("{BACKSPACE}") _WinWaitActivate("FastStone Image Viewer 4.2","") Send("{RIGHT}") WEnd EndFunc Func Terminate() Exit EndFunc Edited June 16, 2013 by czardas operator64 ArrayWorkshop Link to comment Share on other sites More sharing options...
nceipr Posted June 16, 2013 Author Share Posted June 16, 2013 2 czardas: Thanks a lot, good man I also add Opt("SendKeyDelay", 1) and it's work perfectly Link to comment Share on other sites More sharing options...
czardas Posted June 16, 2013 Share Posted June 16, 2013 (edited) I'm happy you understand now. Here's a link for you to practise your English. http://elt.oup.com/student/headway/elementary/e_games/?cc=gb&selLanguage=en Edited June 16, 2013 by czardas operator64 ArrayWorkshop Link to comment Share on other sites More sharing options...
nceipr Posted June 16, 2013 Author Share Posted June 16, 2013 Nice one, and here's for amharic (if somebody interested): http://famdliflc.lingnet.org/products/amharic/ac_bc_LSK/default.html czardas 1 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