codehtcmail

I'm a noob who need help

11 posts in this topic

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. 

Share this post


Link to post
Share on other sites



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 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

#4 ·  Posted (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 by SorryButImaNewbie

Share this post


Link to post
Share on other sites

#5 ·  Posted (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 by codehtcmail

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Example how to automate the Page Setup dialog of Notepad:

Run("notepad.exe")
WinWait("[CLASS:Notepad]", "")
WinMenuSelectItem("[CLASS:Notepad]", "", "&File", "Page Set&up...")
1 person likes this

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Today I learned the function WinMenuSelectItem, today was a good day. (This should be usefull in your script)

Share this post


Link to post
Share on other sites

Great ;)


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

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 ?

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now