I have problem with Planet Press Connect project where I would like to execute Shell.Object from VBS script.
For example we have:
Option Explicit
Dim shl
Set shl = CreateObject("Shell.Application")
shl.ShellExecute "notepad.exe", "", "", "open", 1
And when I run this script using DEBUG mode then Notepad will be opened correctly.
When want to use Planet Press services, then cant.
Also inside Event VIewer have following errors:
The description for Event ID 1 from source PPWatch8 cannot be found. Either the component that raises this event is not installed on your local computer or the installation is corrupted. You can install or repair the component on the local computer.
If the event originated on another computer, the display information had to be saved with the event.
It would be attempting to open notepad for the service account in a non-interactive desktop session. Even if it were to open, you’d never see it since it would be in the service account’s session and not yours. Logging in as the service account won’t help either, again because Windows keeps these sessions separated.
What are you trying to do with notepad, exactly? Or is that just an example? What’s your real goal here?
The Notepad is just an example, I am sending PDF documents to printer using Shell Execute script.
It works fine without any issues in debug mode, but when I want to use service to run Planet Press project, it stuck on this script. (Hangs) and nothing is sent to printer.
It looks like this:
Set shl = CreateObject("Shell.Application")
'send all files to printer
for i = 0 to Ubound(filesName)-1
shl.ShellExecute filesName(i), "", "", "print", 0
next
Its WIndows 10 environement, 64 bit, user is admin
Whenever you use ShellExecute, an application opens up in order to print (even it it is “invisible”, it still opens up). This application is almost certainly attempting to display a dialog window, but you cannot see that window because a service runs on a different desktop than the normal user desktop.
You will probably tell me that in debug mode, the application doesn’t display any dialogs, so there’s no reason why it would display one in service mode. But the problem is: you don’t know that! Perhaps there is no default printer available to the service session. Or it might be some other kind of confirmation.
Anyway: run the process in service mode. Once the process gets “stuck”, open the Windows Task manager and look for the executable application that has opened up in order to print the file (e.g. if it’s an xls file, look for Excel), and then kill that task: your process should resume. Obviously, if the process has captured several files, you’ll need to kill the task as many times as there are files, so run the test with a single file.
That should demonstrate that the issue is with the external application waiting for some kind of input, which you can’t provide.
Did you run the test I requested in my previous post? Did you see the app started in Task Manager? Did killing that task “unfreeze” the Workflow process?