Skip to main content

Notifications

Community site session details

Community site session details

Session Id : V35hbYbaqW7g8Mmge8THpR
Power Automate - Power Automate Desktop
Suggested answer

Waiting for Printer Status

Like (2) ShareShare
ReportReport
Posted on 21 Feb 2025 03:22:15 by 4
Hello I am trying to find a way to Wait for Printer Status to be completed before continuing to next action although I cannot find a clean way to do this without just adding a 15 sec wait inbetween actions. 
 
I found a setting in my printer properties to display the status although the UI selector is not able to detect the text in the UI element, alternatively I set the "Wait Until window:" to "Doesn't Contain UI Element" so after the status message disappears it will continue the flow although I don't like that because that takes to long. 
 
there must be a better way to handle this task, any suggestions would be greatly appreciated. 
Categories:
  • WillSG Profile Picture
    352 Super User 2025 Season 1 on 21 Feb 2025 at 06:05:21
    Waiting for Printer Status
    Hi @  I hope you are doing well.
     
    This can be achieved using Power Shell because it provides a straight forward approach to connect with the windows printers.

    Here is an image of how it looks:




    And here is the snippet code, this one can be modified as needed.

    LOOP WHILE (is_printing) <> ($'''NO''')

        Workstation.GetDefaultPrinter PrinterName=> PrinterName
        @@copilotGeneratedAction: 'False'
    Scripting.RunPowershellScript.RunPowershellScript Script: $'''$printerName = \"%PrinterName%\"
    $printer = Get-WmiObject -Query \"SELECT * FROM Win32_Printer WHERE Name = \'$printerName\'\"

    if ($printer) {
        $status = $printer.PrinterStatus
        switch ($status) {
            3 { Write-Output \"Printer \'$printerName\' is idle.\" }
            4 { Write-Output \"Printer \'$printerName\' is printing.\" }
            5 { Write-Output \"Printer \'$printerName\' is stopped.\" }
            default { Write-Output \"Printer \'$printerName\' has an unknown status: $status.\" }
        }
    } else {
        Write-Output \"Printer \'$printerName\' not found.\"
    }''' ScriptOutput=> PowershellOutput ScriptError=> ScriptError
        IF NotContains(PowershellOutput, $'''printing''', True) THEN
            SET is_printing TO $'''NO'''
        END
    END
    Display.ShowMessageDialog.ShowMessage Title: $'''YOU ROCK!''' Message: $'''Printing Completed!''' Icon: Display.Icon.None Buttons: Display.Buttons.OK DefaultButton: Display.DefaultButton.Button1 IsTopMost: True ButtonPressed=> ButtonPressed 
     
    Hope this helps,

    If I have addressed your inquiry successfully, kindly consider marking my response as the preferred solution. If you found my assistance helpful, a 'Thumbs Up' would be greatly appreciated.
     
    Additionally, I you have any questions, please feel free to DM me, and we can initiate a discussion.
     
    Kind regards,
     
    Will SG
    Senior Automation Lead at RAMS CR (Robotic Automation)
    LinkedIn Profile
  • Suggested answer
    trice602 Profile Picture
    13,768 Super User 2025 Season 1 on 21 Feb 2025 at 04:50:37
    Waiting for Printer Status
    Hi,
     
    Or try wait for image to disappear.
     
     

    ------------------------------------------------

     

     

    ⭐ If this was helpful, please like and mark as a verified answer to help others find this too!

     

     

    Always glad to help! 💯💯💯💯💯

     

    Tom

     

    Follow me on LinkedIn - Thomas Rice, PMP | LinkedIn

  • Suggested answer
    trice602 Profile Picture
    13,768 Super User 2025 Season 1 on 21 Feb 2025 at 04:48:41
    Waiting for Printer Status
    Hi,
     
    Please consider trying if image, I think this will work better for you.
     
     
     
     

    ------------------------------------------------

     

     

    ⭐ If this was helpful, please like and mark as a verified answer to help others find this too!

     

     

    Always glad to help! 💯💯💯💯💯

     

    Tom

     

    Follow me on LinkedIn - Thomas Rice, PMP | LinkedIn

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Power Automate - Power Automate Desktop

#1
eetuRobo Profile Picture

eetuRobo 18 Super User 2025 Season 1

#2
Nived_Nambiar Profile Picture

Nived_Nambiar 10 Super User 2025 Season 1

#3
stampcoin Profile Picture

stampcoin 6

Overall leaderboard
Loading started
Loading complete