Running XPA with TaskScheduler and occasional error #xpa


Adrian Wick
 

Ok.

Will add a logical parameter to the program and put this parameter in Open/Close window. When called from main, the parameter will get "False". This way
windows wont open up.

Thank you.
A


Steven Blank
 

Adrian,

IMO, tasks that are launched by Windows Task Scheduler should never open a window nor attempt to interact with the desktop in any way. By definition, Scheduled Tasks are unsupervised and must be able to be executed even when no user is logged in on the computer that is running the task.

My suggestion to you would be to add a command line switch to the Scheduled Task's command line such as ... /Silent=Yes. Then, in the called programs, place a condition that only allows an open window when /Silent!=Yes.

To facilitate this behavior, I would also submit that the batch task itself should NEVER open a window, and if you want/need to display a counter, I recommend to display it in the calling program's window, which window can then be conditioned by the command line switch's value.

HTH.

Steven G. Blank
Ξ SGBlank Consulting


On 11/3/2022 9:34 PM, Adrian Wick wrote:

1. All programs are batches, but some do have "open and close task window" set to "Yes". So when i run the app manually i see a counter ... But when the 
app is run via task scheduler, it's run in the back and I don't see an XPA loading up.

2. It is run as a runtime, not as background mode for the reason above. Some programs opens up task windows to show the counters and if run the app in a
background mode, than for every task that does open up a window, i get an warning in error log saying "no windows should be opened in background mode"
or something like that ... 

Maybe it's better to get the warning in error log as background mode and the app will always run and not fail due to the error I mentioned in 1st post?

A


Keith Canniff
 

It's possibly because it runs in either background mode or when the user on the server is not logged in and it's trying to display a message that requires a user to do something, like press an Ok button. 


From: main@magicu-l.groups.io <main@magicu-l.groups.io> on behalf of Adrian Wick <adrian.wick2015@...>
Sent: Friday, November 4, 2022 12:34:19 AM
To: main@magicu-l.groups.io <main@magicu-l.groups.io>
Subject: Re: [magicu-l] Running XPA with TaskScheduler and occasional error #xpa
 
1. All programs are batches, but some do have "open and close task window" set to "Yes". So when i run the app manually i see a counter ... But when the 
app is run via task scheduler, it's run in the back and I don't see an XPA loading up.

2. It is run as a runtime, not as background mode for the reason above. Some programs opens up task windows to show the counters and if run the app in a
background mode, than for every task that does open up a window, i get an warning in error log saying "no windows should be opened in background mode"
or something like that ... 

Maybe it's better to get the warning in error log as background mode and the app will always run and not fail due to the error I mentioned in 1st post?

A


Adrian Wick
 

1. All programs are batches, but some do have "open and close task window" set to "Yes". So when i run the app manually i see a counter ... But when the 
app is run via task scheduler, it's run in the back and I don't see an XPA loading up.

2. It is run as a runtime, not as background mode for the reason above. Some programs opens up task windows to show the counters and if run the app in a
background mode, than for every task that does open up a window, i get an warning in error log saying "no windows should be opened in background mode"
or something like that ... 

Maybe it's better to get the warning in error log as background mode and the app will always run and not fail due to the error I mentioned in 1st post?

A


Steven Blank
 

Adrian,

This is a total WAG, but the fact that the error message mentions GUI and MessageBox suggests to me that the program is attempting to open a window or dialog box and is prevented from doing so.

Does the program in question open a window, either directly or via a Verify operation?

Is the runtime engine that handles the request being executed in Background mode?

Steven G. Blank
Ξ SGBlank Consulting


On 11/2/2022 11:31 PM, Adrian Wick wrote:

Hello,

i am using taskscheduler to run XPA at a certain time at night that does a couple of batch programs. Here and there the magic simply does not start
and writes this to the error log:

[MgGui.dll] System.InvalidOperationException : 
   at System.Windows.Forms.MessageBox.ShowCore(IWin32Window owner, String text, String caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton, MessageBoxOptions options, Boolean showHelp)
   at com.magicsoftware.unipaas.gui.low.GuiInteractive.writeToMessageBox(Form form, String title, String str, Int32 mode)
   at com.magicsoftware.unipaas.gui.low.GuiInteractive.onMessageBox()
   at com.magicsoftware.unipaas.gui.low.GuiInteractiveBase.Run()
In order to fix this i only need to run the app manually ... And the error is gone and the next schedule runs without any problems. 

Does this have to do anything with small windows server updates? 

Regards,
A


Adrian Wick
 

Hello,

i am using taskscheduler to run XPA at a certain time at night that does a couple of batch programs. Here and there the magic simply does not start
and writes this to the error log:

[MgGui.dll] System.InvalidOperationException : 
   at System.Windows.Forms.MessageBox.ShowCore(IWin32Window owner, String text, String caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton, MessageBoxOptions options, Boolean showHelp)
   at com.magicsoftware.unipaas.gui.low.GuiInteractive.writeToMessageBox(Form form, String title, String str, Int32 mode)
   at com.magicsoftware.unipaas.gui.low.GuiInteractive.onMessageBox()
   at com.magicsoftware.unipaas.gui.low.GuiInteractiveBase.Run()
In order to fix this i only need to run the app manually ... And the error is gone and the next schedule runs without any problems. 

Does this have to do anything with small windows server updates? 

Regards,
A