jhansenjr
(Fresh Scripter)
2003-07-28 07:09 PM
Delele Program Group

Can anyone tell me why this script works if I run it manually but not through the actual logon script? The script runs during the login process but it doesn't do anyhting. It just exits. The program was not installed to a common group.

If DelProgramGroup("Sentry Spelling Checker Engine", 0) = 0
?"Spell Checker Program Group Deleted...."
EndIf

Thanks


Sealeopard
(KiX Master)
2003-07-28 07:12 PM
Re: Delele Program Group

Check the @ERROR/@SERROR error code, it'll tell you why it fails.
code:
$rc=DelProgramGroup("Sentry Spelling Checker Engine", 0)
? 'Error '+@ERROR+' - '+@SERROR

And take a look at the FAQ Forum!


jhansenjr
(Fresh Scripter)
2003-07-28 07:19 PM
Re: Delele Program Group

Ran your code and did not get any errors. But the program group does not delete.

Les
(KiX Master)
2003-07-28 07:24 PM
Re: Delele Program Group

Maybe the program group is not available at logon.

Topic: Sequence of events during logon


Sealeopard
(KiX Master)
2003-07-28 07:24 PM
Re: Delele Program Group

You should have at least gotten an 'Error 0 - ...' !

jhansenjr
(Fresh Scripter)
2003-07-28 07:35 PM
Re: Delele Program Group

Any other suggestions?

Les
(KiX Master)
2003-07-28 07:37 PM
Re: Delele Program Group

Sorry, crystal ball is in the shop now. [Frown]

Howard Bullock
(KiX Supporter)
2003-07-28 07:39 PM
Re: Delele Program Group

Maybe the the problem is somewhere else in your code?

Sealeopard
(KiX Master)
2003-07-28 07:39 PM
Re: Delele Program Group

Recommendation: The most basic of any debugging procedures.

Put a DEBUG ON into the first line of your code and step through it, you'll then see where it'll fail.


jhansenjr
(Fresh Scripter)
2003-07-28 07:39 PM
Re: Delele Program Group

Meaning?

Les
(KiX Master)
2003-07-28 08:31 PM
Re: Delele Program Group

Meaning that you are not providing enough information for us to help you.

Jens suggested you you check @Error. Instead of reporting back what it returned, you simply said "did not get any errors". The line had to return something but without your co-operation we can't say much more.

I suggested that it may be a "Sequence" issue but you did not acknowledge it let alone describe what you did to disprove it.

So... as you see, without your co-operation, all we have to go by is our crystal balls.


Sealeopard
(KiX Master)
2003-07-28 08:40 PM
Re: Delele Program Group

And essential things like reading the KiXtart Manual and the FAQ Forum are normally a given.

jhansenjr
(Fresh Scripter)
2003-07-28 08:55 PM
Re: Delele Program Group

I did read the manual and the example I used from the manual doesn't work. Anyway, the code below works fine.

If Exist ("%USERPROFILE%\Start Menu\Programs\Sentry Spelling Checker Engine")
Shell 'CMD /C RD /s /q "%USERPROFILE%\Start Menu\Programs\Sentry Spelling Checker Engine"'
EndIf


Howard Bullock
(KiX Supporter)
2003-07-28 09:02 PM
Re: Delele Program Group

Just to understand this. The correct usage of the code to return the error is not @error. The function return zero for success and the errorcode if it fails according to the manual.

So could you run this code and tell me what happens?


? "KiXtart version: " +@kix
$rc = DelProgramGroup("Sentry Spelling Checker Engine", 0) = 0
If $rc = 0
? "Spell Checker Program Group Deleted...."
Else
? "DelProgramGroup ERROR: " + $rc
EndIf


jhansenjr
(Fresh Scripter)
2003-07-28 09:42 PM
Re: Delele Program Group

Ok. When I run your code through the script it displays Kixtart Version 4.02 Spell Checker Program Group Deleted.... But it really doesn't delete the group. When I run your code manually I get Kixtart Version 4.02 DelProgramGroup ERROR:1. Running it this way deletes the group.

Howard Bullock
(KiX Supporter)
2003-07-28 09:49 PM
Re: Delele Program Group

Looks to me like you may have found a KiXtart 4.02 bug either in the function or documentation. The 4.21 docs also show it this way. Could you retest using 4.21 to see if the behavior is the same or different?

I am still confused by the fact that your behavior is different inside and outside your script. Without seeing the balance of your code I can't comment any further.

The behavior should be the same.

[ 28. July 2003, 22:02: Message edited by: Howard Bullock ]


Howard Bullock
(KiX Supporter)
2003-07-28 09:53 PM
Re: Delele Program Group

When you run the code in your other script is it executing in a manual mode or as a logon script during logon?

If it is during logon then you have some OS level thing happening causing the different behavior. You didn't specify what OS you were testing with in any previous post that I saw.


jhansenjr
(Fresh Scripter)
2003-07-28 10:04 PM
Re: Delele Program Group

Same exact result with version 4.21.

Sealeopard
(KiX Master)
2003-07-28 10:05 PM
Re: Delele Program Group

Is the following registry value implemented: W2k/XP - Keep the Window visible on login?

jhansenjr
(Fresh Scripter)
2003-07-28 10:08 PM
Re: Delele Program Group

The problem occurs with W2k SP3 and WinXP SP1. The only way it works, including your code, is manually. Maybe it is a bug.

Howard Bullock
(KiX Supporter)
2003-07-28 10:12 PM
Re: Delele Program Group

And you have

ReadValue($hklms+"\Microsoft\Windows NT\CurrentVersion\Winlogon", "RunLogonScriptSync") set to 1 on your computers?

Please check and let us know.

The return code of 1 seems to be a bug in either docs or the function. We will need some clarification from Ruud on that.


Sealeopard
(KiX Master)
2003-07-28 10:14 PM
Re: Delele Program Group

The delete during login will not work if RunLoginScriptSync=0, thus it would not be an error as the user profile is not loaded by the time the deleet is issued.

Thus, please answer the question!


jhansenjr
(Fresh Scripter)
2003-07-28 10:16 PM
Re: Delele Program Group

Yes, I have that value set to 1 already.

Howard Bullock
(KiX Supporter)
2003-07-28 10:19 PM
Re: Delele Program Group

Jens, based in the test code I furnished and the posted results, I think that the DelProgramGroup function is returning 0=fail 1=success. DOCs are wrong in this case.

I agree with you that the RunLoginScriptSync setting could be skewing the problem by changing the ability to delete the group. In this case the function is reporting 0=Fail and pring the text of the supposed action.

[ 28. July 2003, 22:20: Message edited by: Howard Bullock ]


Howard Bullock
(KiX Supporter)
2003-07-29 03:12 PM
Re: Delele Program Group

So to get both the return code and error code could you run this code and report the report?

Run it both at the command line and as part of a logon script. Use KiXtart 4.21 if possible.


? "KiXtart version: " + @kix
? "OS: " + @DOS
? "Product: " + @ProductType
? "LogonMode: @LogonMode"
?
$rc = DelProgramGroup("Sentry Spelling Checker Engine", 0) = 0
If $rc = 0
? "Spell Checker Program Group Deleted...."
? "DelProgramGroup Result: " + $rc
? "Errorcode: @error @serror"
Else
? "DelProgramGroup Result: " + $rc
? "Errorcode: @error @serror"
EndIf


[ 29. July 2003, 15:13: Message edited by: Howard Bullock ]


jhansenjr
(Fresh Scripter)
2003-07-29 04:30 PM
Re: Delele Program Group

Command Prompt: Deletes Group
KiXtart version: 4.21
OS: 5.0
Product: Windows 2000 Professional
LogonMode:

DelProgramGroup Result: 1
Errorcode: 0 The operation completed successfully.

Logon Scrip: Does not Delete Group
KiXtart version: 4.21
OS: 5.0
Product: Windows 2000 Professional
LogonMode:

Spell Checker Program Group Deleted....
DelProgramGroup Result: 0
Errorcode: 2


Howard Bullock
(KiX Supporter)
2003-07-29 04:43 PM
Re: Delele Program Group

These results confirm that the documentation is incorrect.

DelProgramGroup return 1=success or 0=fails and sets @error.

The function fails in the logon script becuase it encounters error 2 "The system cannot find the file specified."

Apparently the path to the file is not known at the time of execution during the logon script. You could possibly try to provide the full path using variable (determined from the registry or Environment).

The inability to find the file in itself does not seem to be a KiXtart error to me. Anybody else have thoughts?


Howard Bullock
(KiX Supporter)
2003-07-29 04:46 PM
Re: Delele Program Group

I also find it strange that the macro @LogonMode did not return a value. Is this a bug in 4.21?

Sealeopard
(KiX Master)
2003-07-29 04:49 PM
Re: Delele Program Group

Check for the existance of the folder via EXIST before doing the DELPOROGRAMGROUP. Maybe the profile is not fully loaded by the time the DELPROGRAMGROUP is issued. However that would contradict the statement that RunLoginScriptSync=1 is implemented for all users.

Les
(KiX Master)
2003-07-29 05:03 PM
Re: Delele Program Group

Jens,
I think you may have the logic reversed on RunLogonScriptSync. If set to 1 then the profile does not load until after the logon script completes. If set to 0, the profile start to load in sync but there is still no guarantee as it still depends on timing.


Sealeopard
(KiX Master)
2003-07-29 05:08 PM
Re: Delele Program Group

I was alwasy under the impression that RunLoginScriptSync=1 will result in the following login process events:
a) Load profile if necessary
b) Start login script after profile finished loading
c) Start Run/RunOnce registry keys after logins cript finished
d) Start the shell