B4J Question How to access B4J program started via 'scheduled tasks' before login Windows

amorosik

Expert
Licensed User
I wrote a B4J program for receiving customer orders from external smartphones
A single form in which the received orders appear and the activity performed by the program itself
The program works correctly
A new icon is initialized in the tray bar when it is started, some entries have been added to impart the basic commands, and then the main form is hidden
This is the code

B4X:
    tray.Initialize
    Dim MenuItems() As String = Array As String("View", "Hide","Configuration", "-", "Exit")
    icon1.Initialize("icon1", WSConnected, MenuItems)
    icon1.ToolTip = "WEB SOCKET RECEIVER - DoubleClick to View. RightClick Menu."
    tray.AddTrayIcon(icon1)
   
    Dim stage As JavaObject = MainForm
    stage.GetFieldJO("stage").RunMethod("setIconified", Array(True))
   
    Dim mf As JavaObject = MainForm.RootPane
    mf.RunMethodJO("getScene",Null).RunMethodJO("getWindow",Null).RunMethod("hide",Null)

After verifying that the operation is correct, I inserted a new line in the Windows 'scheduled tasks' to start the procedure automatically when the PC starts
Everything works correctly, in the sense that even after starting the PC, without logging in as a Windows user, the procedure for receiving orders is running and does its job of receiving orders from outside and printing them as soon as they are received
But if I log in as a Windows user, I can't see the icon in the tray bar that allows me to view the form
The question is: by starting the procedure for receiving orders using the 'scheduled tasks' of Windows, when the PC starts up, how can I view the form when I log in as a Windows user?
 

Daestrum

Expert
Licensed User
Longtime User
Not sure if this helps
Start the Scheduled Tasks application (go to Start, Programs, Administrative Tools, and click Scheduled Tasks). Highlight the name of the scheduled task you want to change, go to the File menu and click Properties, and select the Task tab. In the "Run as" box, type the account name to use.
 
Upvote 0

amorosik

Expert
Licensed User
Thanks for the reply, but the procedure is already starting correctly, using the account of one of the users present
Which is the same account I use when I log in
But after logging user into Windows, I don't see the icon on the tray bar, as I usually see if I start the procedure when logged in already
 
Upvote 0

Daestrum

Expert
Licensed User
Longtime User
Reading up on this further, others have the similar problem, the icon is missing. They suggest a delay of 30 sec.

from here : this
 
Upvote 0

amorosik

Expert
Licensed User
I can't find that article at the link indicated
However I also tried to start the program with the task scheduler after 30 seconds from the system startup
But no icon appears on the tray bar after user login
 
Upvote 0

teddybear

Well-Known Member
Licensed User
Now that you have added your app to the scheduled tasks, why not also add the app to the startup.
 
Upvote 0
Top