codehtcmail Posted April 1, 2015 Share Posted April 1, 2015 Hello, I have many tabs that I wish to "Print", they contain .swf files, they need to be printed in order, I can print them all at once but they come in disorder which not good for me. The tasks that I need to be in auto are thes in order: 1- Right click inside tab 2- Chose "Print", whish is number five in the context menu list after clicking the right mouse button 3- Press "Return" for printing 4- A box will appear wher i can eaither go with the mouse and click on "Prin" or simply press "Return" on my keyboard 5- Go to next tab in the browser with "Ctrl+Tab" 6- Return to step 1 and repeat until all tabs are printed. I have to tell you that it might be some occasion where a slow down in memory or the printing process causes me to have to press "Return" more than once before going to the next tab. I hope I have been clear enough for you to help me create a script to do this tedious task as sometimes I have to print 50 tabs at once. To make things clear, there is nothing illegal in what I am doing, I work for an insurance company and at the end of the day we do a back-up print of all our new sold contracts for archiving. Normally we should print the back-up whenever a new contract is done, but due to sometimes having many clients in the queue we skip this step and leave it for later for the customers not to get bored waiting too much. Thank you. Link to comment Share on other sites More sharing options...
water Posted April 1, 2015 Share Posted April 1, 2015 Welcome to AutoIt and the forum! Isn't a backup something your software should do as soon as you have sold a contract? A backup should never be a manual task! 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...
codehtcmail Posted April 1, 2015 Author Share Posted April 1, 2015 When we do a new contract it prints 4 copies on paper, and the tabs I'm talking about are an extra copy that we can chose to print or not, as we had a flood last year and lostmany of our archive, this fifth copy will be printed in digital form and saved on a cloud drive. So help me do this, I am the lowest worker in the office and the tedious tasks fall on me, they go to launch or go home at the end of the day and leave me with all the tabs to print, the files to sort and so on, so please help me make it easier. Link to comment Share on other sites More sharing options...
SorryButImaNewbie Posted April 1, 2015 Share Posted April 1, 2015 (edited) Hi, and welcome to the forums. I'm not very good with autoit yet, and you don't really give to much information. First I would suggest to download autoit window info, with it you can find most of the control handels you need. I had a problem with a program, where I couldn't indentify the "tabs" as separet controls. I ended up using WinMove to take the window to 0,0 coordinates and from there a MouseClick with coordinates where the tab should be if the window is at 0,0. This isn't a 100% trustable solution (well, it works 100% for me, but i think there could be potential problems with it) You can either try to stick with MouseClick or Send (since the focus should be on our window after the above operations), but I would generally recommend ControlClick if you can get the handle of the control you want to click on. I'm not sure how would I go about the 6. point, maybe just putting the whole thing into a loop, try out what will happen when there are no more tabs, and leave the loop when that happens. Dont forget to add sleeps, winwaitactivate so the script. I hope I helped a bit, but others most likely will have better solutions, the only advantage of mine is that is probably quite simple Edited April 1, 2015 by SorryButImaNewbie Link to comment Share on other sites More sharing options...
codehtcmail Posted April 1, 2015 Author Share Posted April 1, 2015 (edited) Thank you SorryButImaNewbie. I will try what you said but not the WinMove, the mouse should stay in the middle of the tab page for the step 1, I don't want the mouse to be moving that's why I chose to use keyboard shortcuts. I don't know the exact function of sleeps winwaitactivate, does it wait for the step to be completed before going to the next ? Also what part is not clear ? I thought I gave step by step what needs to be automated, and a loop is basically what I need as it's repetitive and very tiring after a full day work. Edited April 1, 2015 by codehtcmail Link to comment Share on other sites More sharing options...
SorryButImaNewbie Posted April 1, 2015 Share Posted April 1, 2015 Sleep(x) is wait x milliseconds befor continuing with the script (usefull for different scenarios, for example if you are in a loop checking for something to happen, you dont wanna overtax the CPU, without sleep it would check as fast as he possible could), winwaitactivate stops the execution of the script until the specified window is active (without a timeout, it waits forever). I suggest to read through the help file (f1), autoit's help is really really good. It helped me a lot and still do. If you select a word in the code and press f1 it automaticly open the assosiated help window. Link to comment Share on other sites More sharing options...
water Posted April 1, 2015 Share Posted April 1, 2015 As SorryButImaNewbie suggested. Use the AutoIt Window Info Tool to get the ID of the Controls. Then it is possible to automate the GUI just by using some of the Control* functions of AutoIt without moving the mouse or sending keys. I would first do a "proof of concept" to check if your application can be automated thw way we suggested. 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...
water Posted April 1, 2015 Share Posted April 1, 2015 Example how to automate the Page Setup dialog of Notepad: Run("notepad.exe") WinWait("[CLASS:Notepad]", "") WinMenuSelectItem("[CLASS:Notepad]", "", "&File", "Page Set&up...") SorryButImaNewbie 1 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...
SorryButImaNewbie Posted April 1, 2015 Share Posted April 1, 2015 Today I learned the function WinMenuSelectItem, today was a good day. (This should be usefull in your script) Link to comment Share on other sites More sharing options...
water Posted April 1, 2015 Share Posted April 1, 2015 Great 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...
codehtcmail Posted April 1, 2015 Author Share Posted April 1, 2015 I'm gonna appraoch this differently with you guys, I will ask for every action alone and try your answers. Now first, Lest's say I am in Google Chrome, I want to do "click right button of the mouse", what should I write in Notepad ? 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