Nadrew
30th January 2004 07:12 UTC
Snippet works in "classic" but not "MUI"
UserInfo::GetAccountType
IfErrors Win9x
StrCmp$0 "Admin" 0 +3
MessageBox MB_YESNO
|MB_ICONINFORMATION "Your user account has administration power, do you want to create start menu items on all user accounts?" IDNO "nousers"
StrCmp $0 "Power" 0 +3
MessageBox MB_YESNO|MB_ICONINFORMATION "Your user account has administration power, do you want to create start menu items on all user accounts?" IDNO "nousers"
SetShellVarContext all
Win9x:
nousers:
SetShellVarContext current
>
Effectivly only asks you if you want to create start menu items on all accounts if you're running a non-Win9x system in "classic mode", but when I try the same thing in MUI mode, it asks you if you're using Win9x, when it shouldn't. Is there a difference that changes the behaviour in MUI mode? Or did I do something wrong?
Vytautas
30th January 2004 08:20 UTC
Have you tried calling "ClearErrors" before calling the UserInfo plugin?
Vytautas
Nadrew
30th January 2004 08:33 UTC
Yeah -- same problem.
deguix
30th January 2004 11:06 UTC
The first StrCmp everytime detects the user is "power user" if is not "admin".
Why?
On the first command StrCmp, when it is not admin will skip three commands after that part, it should be two. So the StrCmp for power users makes sense.
AND
The SetShellVarContext will ever be current.
Why?
You forgot to put the GoTo command after SetShellVarContext all, so it can skip the another one.
I fixed it:
UserInfo::GetAccountType
IfErrors Win9x
StrCmp$0 "Admin" 0 +2
MessageBox MB_YESNO
|MB_ICONINFORMATION "Your user account has administration power, do you want to create start menu items on all user accounts?" IDNO "nousers"
StrCmp $0 "Power" 0 +4
MessageBox MB_YESNO|MB_ICONINFORMATION "Your user account has administration power, do you want to create start menu items on all user accounts?" IDNO "nousers"
SetShellVarContext all
Goto+2
Win9x:
nousers:
SetShellVarContext current
>
Nadrew
30th January 2004 12:17 UTC
Ah, I see, simple enough, I knew it would be, thank you.
Vytautas
30th January 2004 12:24 UTC
I still think that its a good idea to ClearErrors before the call which you want to check if an error occoured. Since it might report an unrelated error flag generated earlier in the script.
Vytautas
Nadrew
30th January 2004 12:28 UTC
Yep, already doing that =D
kichik
30th January 2004 14:10 UTC
Originally posted by Vytautas
I still think that its a good idea to ClearErrors before the call which you want to check if an error occoured. Since it might report an unrelated error flag generated earlier in the script.
Not just a good idea, it's a must.