View Full Version : I need help with %UserName%
stoja
11-17-2004, 12:26 PM
Hi!
I need help with %UserName% variable.
Example:
If Username of computer (%UserName%) is stoja then continue installation
of
If is another user, (%UserName%) abort installation
(Is user of the computer)
Is that possible????
Thank you!!!!!!!!!!!!!
Oscar.
stoja
11-26-2004, 06:01 PM
Hi again,
Sorry, the variable is %RegOwner%.
The examples:
- If in %RegOwner% the user is demo then continue installation.
- Or if in %RegOwner% the user is another then abort installation.
Can anyone help me?
Thanks.
Oscar
Corey
11-26-2004, 06:07 PM
Hi. No need to check both, just check for a negative, continuance is by default if no error occurs, i.e.
if %RegOwner% ~= "stoja" then
Application.Exit();
end
Hope that helps. :)
stoja
11-27-2004, 04:19 AM
Hi!
This code is compatible on SF 6 or 7?
How to put the code?
Thanks :D
Oscar
Corey
11-27-2004, 04:21 AM
Oops, sorry, that was for 7.0... :rolleyes
stoja
11-27-2004, 04:31 AM
Hi!
No problem, but in Actions if i put:
if %RegOwner% ~= "stoja" then
Application.Exit();
end
Shows a error in %
Help me in the variable!!!!
Thanks
Oscar
Corey
11-27-2004, 04:54 AM
Hi. I don't have a copy of Setup Factory 6.0 in front of me, but I'll be sure to check into it on Monday and let you know. :yes
stoja
11-27-2004, 07:33 AM
Hi:
Oh, in the Setup Factory 7?
can you probe it?
Thanks
Oscar.
csd214
11-27-2004, 10:30 AM
The SUF60 syntax is:
IF (!(%RegOwner% = "stoja"))
Abort Setup
END IF
You don't prefer to use %LANUser%?
stoja
11-27-2004, 02:21 PM
Hi!
VERY THANKS for the code.
I have another question...
For example if the user is not stoja then close installation, but doesn't show an error.
How to show a error before closes the setup?
Thanks.
Oscar
csd214
11-28-2004, 03:18 AM
Yes, you are right Oscar. Never shut down the app without telling the user WHY.
Use the Show Message Box action with a message like this:
Sorry, only stoja is allowed to run this app.
The program will now exit.
The Message Box is really useful when you need to debug your app (to check the content of a variable at different stages).
Another tip: You want to display a message in a screen. You can build your message through several IF statements by using a variable like %MyMessage%. To obtain the layout you want, it's useful to have a 'new line' code available.
Example:
Prjoject>Settings>Deisgn Time Constants: Add two values, #ASC_LF# = 10 and #ASC_CR# = 13.
Assign Value(%NL% = #ASC_CR##ASC_LF#)
Assign Value(%MyMessage% = The machine is owned by %RegOwner%) [Evaluate value as expression is UNCHECKED]
Assign Value(%MyMessage% = %MyMessage% + %NL% + "Are you a pretender, " + %LANUser% + "?" + %NL% [Evaluate value as expression is CHECKED]
Assign Value(%MyMessage% = %MyMessage% + %NL% + "You KNOW you are not allowed to run this app!" + %NL% [Evaluate value as expression is CHECKED]
Assign Value(%MyMessage% = %MyMessage% + "We are going to EXIT" [Evaluate value as expression is CHECKED]
Show Message Box(%MyMessage%)
I loved SUF60; but SUF70 is a NEW WORLD though...
stoja
12-05-2004, 02:05 PM
Hi csd214!
For SUF6 the code is
IF (!(%RegOwner% = "stoja"))
Abort Setup
END IF
but..
What is the code for the SUF7 ?
Thanks.
Oscar
csd214
12-05-2004, 04:48 PM
Hi Oscar,
the SUF70 code:
if SessionVar.Expand("%RegOwner%") ~= "stoja" then
Dialog.Message("Warning", "Only stoja has permission to run this app"
.."\r\nWe are going to close the program", MB_OK, MB_ICONSTOP, MB_DEFBUTTON1);
Application.Exit();
end
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.