start GUI program from non-interactive session

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
lazna
Posts: 53
Joined: 27 Dec 2012 10:54

start GUI program from non-interactive session

#1 Post by lazna » 12 May 2022 03:24

Have set of batch scripts powered CGI based web system, web server running under SYSTEM account. As result of one script, physical document should be printed. Because of document layout, I choosed program https://github.com/kendallb/PrintHtml for printing, it starting fom console with parameters.

There is a problem the PrintHTML is not a console program as its author state: "Unfortunately this program is not a console program, as it needs access to Windows UI components in order to print."

Is it possible to start such program (only start with parameters, no need any response from it) from non-interactive session? Playing with PSEXEC option -i but have no luck. Also thinking about to create Schedule task and start it by "schtasks /run" but not tested yet.

System is running on W7/32bit with specific user autologon on startup.

Any ideas?

lazna
Posts: 53
Joined: 27 Dec 2012 10:54

Re: start GUI program from non-interactive session

#2 Post by lazna » 15 May 2022 16:51

SOLVED:

Create Scheduled task and start it via 'schtasks /RUN' solve this isssue.

aGerman
Expert
Posts: 4654
Joined: 22 Jan 2010 18:01
Location: Germany

Re: start GUI program from non-interactive session

#3 Post by aGerman » 16 May 2022 03:47

Thanks for the update. I haven't had any good idea since manyfold things can prevent you to get this working.

Just a side note if you want to tell the developer - every GUI process can attach the console window of the parent process in order to make it a console program, too. I find it a bad design if the tool is controlled via command line, but it doesn't report back to the command line interface. This makes automation rather obscure.

Steffen

lazna
Posts: 53
Joined: 27 Dec 2012 10:54

Re: start GUI program from non-interactive session

#4 Post by lazna » 16 May 2022 06:40

Already solve monitoring of started printing task:

As anything else do not acccess printer on this machine but my script, processing output of following command

Code: Select all

powershell.exe "Get-WinEvent -MaxEvents 4 -FilterHashTable @{ LogName = 'Microsoft-Windows-PrintService/Operational'; ID = 800,801,805,307} | Select-Object -Property TimeCreated,Message | ft -HideTableHeader | Out-String -width 999"
to monitor printing task as next step in my script.

Andrew92
Posts: 8
Joined: 26 Apr 2022 09:15

Re: start GUI program from non-interactive session

#5 Post by Andrew92 » 22 May 2022 09:02

lazna wrote:
12 May 2022 03:24
Have set of batch scripts powered CGI based web system, web server running under SYSTEM account. As result of one script, physical document should be printed. Because of document layout, I choosed program https://github.com/kendallb/PrintHtml for printing, it starting fom console with parameters.

There is a problem the PrintHTML is not a console program as its author state: "Unfortunately this program is not a console program, as it needs access to Windows UI components in order to print."

Is it possible to start such program (only start with parameters, no need any response from it) from non-interactive session? Playing with PSEXEC option -i but have no luck. Also thinking about to create Schedule task and start it by "schtasks /run" but not tested yet.

System is running on W7/32bit with specific user autologon on startup.

Any ideas?
Hey, This link doesnt seem to be working. Just wondering if its a problem on my end?

aGerman
Expert
Posts: 4654
Joined: 22 Jan 2010 18:01
Location: Germany

Re: start GUI program from non-interactive session

#6 Post by aGerman » 22 May 2022 09:57

It's a peculiarity of this forum that external links are only accessible if you open them in a new tab or window.

Steffen

Andrew92
Posts: 8
Joined: 26 Apr 2022 09:15

Re: start GUI program from non-interactive session

#7 Post by Andrew92 » 25 May 2022 07:27

Ah yes, it worked now. I'm not sure why that is though? Never seen anything like it before.

Post Reply