Open pdf in foreground

Hi,

When I run my bot in unattended mode on a VM, I open pdf file as part of process.
The pdf does not open in foreground.
I have tried

  1. Activate window
  2. Attach window + minimize & maximise
  3. Attach window + Maximise
  4. Attach window + Hot Key (Windows + Up)
  5. Left mouse Click - works sometimes on VM (not always), many times it make a right click instead of left. Click works perfectly on my machine every time but not on VM.

Selectors is below.
image

Acrobat version is 2020

Any help is highly appreciated.

Hi @sushildarveshi,

Using Attach Window followed by an Activate usually works, another option is to use the Invoke method and call the “BringToForeground” method (which is the same as Activate activity)

Invoke method
TargetType = (null)
TargetObject = WindowVariable
MethodName = BringToForeground

As for the selector please validate on that VM the process details for Acrobat, in some cases, it can be app=‘acrord32.exe’ depending on the product version. The title attribute can be fine-tuned as well
… title='Order*Adobe Acrobat*' />

Regards,
PD

1 Like

I tried Activate + Attach over the weekend. It did not gave any issue in testing. I have deployed it, will check over next 1 week if there is any issue.

If it doesn’t work, will try Attach + Activate (other way in sequence)

Thanks for the suggestion.

Studio version on my machine - 2019.4.4
Studio version on VM - 2019.10.4

When I run the bot from my machine through Studio - it runs fine.
I copied my development files on bot’s VM - ran the bot through Studio - it works fine.
If I release the bot from VM’s Studio to Orchaestrator and ran the bot on VM - it works fine.

However if I release the bot from my machine and ran the bot on VM - it doesn’t work.
Is this Studio version possible cause for this discrepancy ?

@sushildarveshi:
When you say you’re running Unattended mode, I was under the impression that you have an Unattended “Robot” running the nuget package on the VM, not as XAML files.

So do you have 2 Studios - one on your machine and the other one on VM?

Ensure the following:

  • If you have Studio and a Robot then make sure they are the same version.

  • Also make sure the Orchestrator version is also compatible. Here is the link to Compatibility Matrix

Regards,
PD

As a production process, I would run the bot in unattended mode on VM.

Below were the scenarios that I have tried and their corresponding output

  1. Running bot on my machine via Studio - pdf opened in foreground
  2. Running bot on VM via bot’s Studio - pdf opened in foreground
  3. Released the bot to Orchaestrator from VM’s Studio and ran it on VM - pdf opened in foreground
  4. Released the bot to Orchaestrator from my machine’s Studio and ran it on VM - pdf did not opened in foreground.

Thanks for the Compatibility matrix - will check it out

Whether you tried to open the pdf file using powershell command, @sushildarveshi
Check the below command,
“Start-Process ((Resolve-Path ‘FullFilePath’).Path)”

will check out with this command. If possible can u provide some more info / sample.
Can’t understand Resolve-Path
I am opening the pdf as below

Use Invoke-Powershell Activity and check the IsScript property in the properties panel, @sushildarveshi

same result :frowning:
works fine when bot is ran from Studio of my machine or Studio of VM - pdf opened in foreground.
But when I release the project to Orchestrator from my machine, and run it on VM via robot tray / Orchaestrator schedule job - pdf doesnt open in foreground.

This workaround worked-

  1. Minimize screen using Send Hotkey activity as Win + d
  2. Start Process

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