Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Interacting with other applications (like clicking a button)

I'm trying to automate many repetitive tasks at work and this small problem got me stumped.

We are using an application for printing out labels for online-orders, the process is like this.

  1. Click the order
  2. Check order details and Click "Finish"
  3. 5 seconds of the program calculating
  4. Confirm that you wish to print the label
  5. Label prints and you're done

On busy days we gotta go trough this process for over 500 orders, because this task consumes a lot of useless time because of step 3. The user has to wait those 5 seconds before being able to click the Print button. Let's say we have 500 orders, that's 500 times 5 seconds, that's about 40 minutes. The entire sending process costs 2 hours, so 33% of all time is lost because of people waiting to click the button.

I'm trying to find a way to automate step 4 so users can stop interacting with the application after completing step 2.

So is there a way using C# to click a button in another form from a different application? The event has to trigger when the confirmation screen pops up. Note that this confirmation screen is not the default windows printing dialog, but a part of the application, so no messing with the preferences.

like image 429
Pieter888 Avatar asked Feb 24 '23 20:02

Pieter888


2 Answers

I think you should look into the UI scripting tools like AutoIt and AutoHotkey instead of writing your own.

like image 170
Zruty Avatar answered Mar 08 '23 12:03

Zruty


This article on CodeProject might be useful to you:

  • Automating Windows Applications by injecting COM objects into the process
like image 24
Colin Pickard Avatar answered Mar 08 '23 13:03

Colin Pickard