Display a drop down with active printer names

Is there a way to display a drop down to a user with all of the active printer names that they could choose from to print a specific file. I am planning on taking this information and then passing it through a power shell command to print documents.

use select item activity and pas the input to that

hi @
can you try using select item
if it not works
2. use find children and use get attritube

Hope this will helps

@Grey_Angel

If you are usinbfg powershell…first get all the active printer names…and pass them as semicolon separated values to the input dialog activity…which will display all the active printers as dropdown

Or else we can create a form as well and pass the values to form and display

Cheers

Thank you for the advice. How do pass the powershell values to the input dialog box? I am guessing my first activity is to invoke a powershell and use this command “wmic printer list brief.” I found other plug-ins that could help but those are all written in windows legacy… My project is not windows legacy.

@Grey_Angel

Use invoke power shell activity which has output parameters…configure use them in next activity

cheers

grafik

Using the above building block we can do:

grafik

by:
grafik

System.Drawing.Printing.PrinterSettings.InstalledPrinters.Cast(Of String).toArray

I got the following error when I tried to copy “System.Drawing.Printing.PrinterSettings.InstalledPrinters.Cast(Of String).toArray”

To which compatibility is your project set (Legacy, Windows, Cross-Plattform)?

Yeah it is set to that…

we crosschecked on a Windows set project and it was working. Just delete it and retype it manually again (we encoutered more often that valid statements did fall in blocks and we unblocked it with the retyping)

Here is my file I tried to re-type it and it still didn’t work. Is it because I am missing a dependency?

Main.xaml (3.9 KB)

you have to place it within the option field, not within the field which is expecting the options as a flatten string:

grafik

grafik

Also do not miss to set properly the output of the user dropdown selection

Well that explains it… Thank you for all of your help.

Perfect, so the topic can be closed:
Forum FAQ - How to mark a post as a solution - News / Tutorials - UiPath Community Forum

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.