How to pass ctrl p in invoke code in uipath

Goal is to print page, in this case send hot key is not working or not supporting so finding alternative way to Ctrl P
looking for a Vb.net or C# code for Ctrl P (print page) that can be used in invoke code activity.
Should work in back ground.

Hi @Ameya_Ghorpade,

What about using the Type Into activity, as bellow?

sol

ā€œdā€ is for saying to press down the key mentioned within the brackets

Best regards,
Marius

If it is a webpage, try inserting JavaScript to the webpage with the following code.

function PrintPage(){
   window.print();
}
1 Like

tried this it failed in background

@Ameya_Ghorpade,

For VB, you could try SendKeys "^{P}"
Refer to https://docs.microsoft.com/en-us/office/vba/language/reference/user-interface-help/sendkeys-statement

For C#, you could try SendKeys.Send("^{P}");
Refer to https://docs.microsoft.com/en-us/dotnet/api/system.windows.forms.sendkeys.send?view=net-5.0

Best regards,
Marius

p is lowercase, special is not selected

hresult e_fail returned from a call to a com component
Giving this error

@Ameya_Ghorpade

give a try on send hot key:
grafik

it is important to use small case p. Using upper case P would result to following: CTRL+SHIFT+ā€œpā€

You should add the script as a function. I assumed you knew it. Check the updated answer.