Page 1 of 1 1
Topic Options
#133075 - 2005-01-27 05:14 PM Script suspend on memory
BBQ Offline
Fresh Scripter

Registered: 2005-01-27
Posts: 6
I wrote a script with a pop-up MessageBox() for user interaction and the script will be scheduled to run by "Scheduled Tasks". I found that the script will be suspend on memeory when no user logon on console (MessageBox() wait for a user interaction). The messagebox still not appear when I logon system. It seem to be run on other session and I can only terminate the script on Task Manager.

I want to know
- Can I check a user already logon system?
- Who already logon?

Thanks all.

Top
#133076 - 2005-01-27 05:21 PM Re: Script suspend on memory
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Does adding the following "style" to your MessageBox style number help

2097152

?

For example:

$= MessageBox("Hello", "Test", 2097152)

???

Top
#133077 - 2005-01-27 05:35 PM Re: Script suspend on memory
BBQ Offline
Fresh Scripter

Registered: 2005-01-27
Posts: 6
Thanks for you help.
The problem can be solved by using the "timeout" function but I want to know how to check the logon status then the script can bypass the messagebox rather than use the "timeout" function.

Any idea how to do it? Thanks.

Top
#133078 - 2005-01-27 05:46 PM Re: Script suspend on memory
AzzerShaw Offline
Seasoned Scripter
****

Registered: 2003-02-20
Posts: 510
Loc: Cheltenham, England
How about using %Username%, i assume if there is no username then nothing will be returned. If there is then you get the currentley logged on user....

Just an idea

Aaron
_________________________
If at first you don't succeed, try again. Then quit. There's no use being a damn fool about it. - W.C Fields

Top
#133079 - 2005-01-27 06:01 PM Re: Script suspend on memory
BBQ Offline
Fresh Scripter

Registered: 2005-01-27
Posts: 6
I already tried to user @WUserID and @UserID to get user information. System only return the UserID who run that script. The current logon user can't be checked. Hm..... how can I get the %UserName% environment variable on KiXtart? And I also want to know what is the main different between @WUserID and @UserID? Thanks
Top
#133080 - 2005-01-27 06:27 PM Re: Script suspend on memory
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Since MessageBox() can only interact with a local user if the task runs under that same account, it is not the communication medium of choice for scheduled tasks. Try using SendMessage() instead.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#133081 - 2005-01-27 06:52 PM Re: Script suspend on memory
BBQ Offline
Fresh Scripter

Registered: 2005-01-27
Posts: 6
That's a good idea and let me try. Thanks.

Actually, the script is used for data backup and I want to display a messagebox() with a message "Backup finished! Do you want to check backup log". If yes, it will call the system to open the backup folder for further actions. That is good for me if I can check the current logon user.

Thanks

Top
#133082 - 2005-01-27 07:16 PM Re: Script suspend on memory
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
You cannot interact with a task that runs under a different account and SendMessage() is strictly a one-way message with no interaction.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#133083 - 2005-01-27 07:34 PM Re: Script suspend on memory
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
btw - my recommendation to use style 2097152 for the messagebox has nothing to do with the "timeout" value ... this "setting" specifies the following:

2097152:
Windows NT/2000/XP: The caller is a service notifying the user of an event. The function displays a message box on the current active desktop, even if there is no user logged on to the computer.

Top
#133084 - 2005-01-27 07:40 PM Re: Script suspend on memory
BBQ Offline
Fresh Scripter

Registered: 2005-01-27
Posts: 6
yes, you right. The messagebox() can only display the interactive box for the same logon user so I want to check if the logon user same as the user running the script. If yes, the script will continue to run the messagebox() for user interaction. Otherwise, the messagebox() will be ignored. I want to add some user friendly function and try to make it perfect. That is what I want to do. Now, I think I may not do it..... Anyway, thanks for all your help.
Top
#133085 - 2005-01-30 03:07 AM Re: Script suspend on memory
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Why the messagebox anyway if it's a scheduled task? And how are you going to schedule the task to run under another user's account? Do you know the account passwords for your users? Scripts executed via scheduled tasks should not require user interaction. There are UDFs that retrieve the interactively logged in user. that user will need to be identical to @USERID for your test to work.
_________________________
There are two types of vessels, submarines and targets.

Top
#133086 - 2005-01-30 07:42 PM Re: Script suspend on memory
BBQ Offline
Fresh Scripter

Registered: 2005-01-27
Posts: 6
Why the messagebox anyway if it's a scheduled task?
>> I am trying to make a backup job so the script must be placed in Scheduled Tasks. The messagebox is used for the admin to confirm if go the backup log folder for checking.

And how are you going to schedule the task to run under another user's account? Do you know the account passwords for your users?
>> There may be other admin to run that script. They may use other account to run that backup script e.g. bkupadmin and there are domain adminstator logon console. Then, the messagebox will be suspended on Task Manager. That's why I need to setup some condition to avoid a abnormal operation.

Scripts executed via scheduled tasks should not require user interaction
>> Thanks for your advice. I just want to make a user-friendly interface for administration.

There are UDFs that retrieve the interactively logged in user. that user will need to be identical to @USERID for your test to work.
>> Sorry, what's that mean?

Thanks

Top
Page 1 of 1 1


Moderator:  Arend_, Allen, Jochen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 633 anonymous users online.
Newest Members
ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder, M_Moore
17887 Registered Users

Generated in 0.062 seconds in which 0.024 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org