|
|
|||||||
Is there an easy way to get them to not show up in the console window when the script runs? I get 2 "0's" at the begining of the script [from the SetTitle and SetConsole] And 4 "0's" when I check for the NAV update at the bottom of the script. Any hep will be appreciated. Rocco ;================================================ ;(Re)Set Ctrl-C/Break handling. ;================================================ BREAK ON ;================================================ ;Setting console window title and making sure ;it is always on top of other windows while open. ;================================================ SetTitle ("School Specialty Login Script") SetConsole ("ALWAYSONTOP") ;================================================ ;Setting Global Variables to be used in the script ;================================================ $NL = Chr(13) + Chr(10) ;================================================ ;Beginning of script... ;================================================ ? "[ Start SSI Login Script... ]" ;================================================ ;Checking for RAS/VPN. RAS/VPN will be greater ;than 0 if it is being used. If true the script ;goes to 'END' and exits without running. ;================================================ :RAS IF (@RAS > 0) ? "[ You are logging in through VPN/RAS... ]" ? "[ The Login Script will exit without running... ]" SLEEP 5 GOTO END ENDIF ;================================================ ;Checking for Citrix System Drives. If found ;script goes to 'END' and Exits without running. ;================================================ :CITRIX IF (%SYSTEMDRIVE% = L:) ? "[ You are logging into a Citrix Server... ]" ? "[ The Login Script will exit without running... ]" GOTO END ENDIF IF (%SYSTEMDRIVE% = M:) ? "[ You are logging into a Citrix Server... ]" ? "[ The Login Script will exit without running... ]" GOTO END ENDIF IF (%SYSTEMDRIVE% = N:) ? "[ You are logging into a Citrix Server... ]" ? "[ The Login Script will exit without running... ]" GOTO END ENDIF ;================================================ ;Greeting the user ;================================================ ? "[ Greetings, @FULLNAME... ]" ? "[ The current Local PC time is ( @TIME )... ]" ;================================================ ;Checking for OS. Run WINSET if Windows 95/98 is ;found. ;[ 1 ] = Windows NT [ 2 ] = Windows 9x ;May not have to use WINSET from now on, since ;KixTart will do all the login functions. ;================================================ IF (@INWIN = 1) ? "[ You are running Windows NT... ]" GOTO LSERV ELSE IF (@INWIN = 2) ? "[ You are running Windows 95/98... ]" ; ? "Running WINSET for Win95/98." ; SHELL "winset.exe USERNAME=@USERID" ; SHELL "Winset.exe COMPUTERNAME=@WKSTA" GOTO LSERV ENDIF ENDIF ;================================================ ;Setting LOGON Server for location and mapping ;drives to LOGON Server. ;================================================ :LSERV SELECT CASE INGROUP ("Mansfield") $SERVER = "\\MANFP1NT" ? "[ Your Logon Server is = ( $SERVER )... ]" ? "[ Mapping H: to Users on ( $SERVER )... ]" USE H: "$SERVER\Users" ? "[ Mapping P: to Public on ( $SERVER )... ]" USE P: "$SERVER\Public" SELECT CASE INGROUP ("Mansfield IT") ? "[ Mapping S: to IT on ( $SERVER )... ]" USE S: "$SERVER\it" ENDSELECT SELECT CASE INGROUP ("Mansfield SSBIDS") ? "[ Mapping S: to SSBids on ( $SERVER )... ]" USE S: "$SERVER\SSBids" ENDSELECT SELECT CASE INGROUP ("Mansfield Collections") ? "[ Mapping S: to Collections on ( $SERVER )... ]" USE S: "$SERVER\Collections" ENDSELECT SELECT CASE INGROUP ("Mansfield PBD") ? "[ Mapping S: to PBD on ( $SERVER )... ]" USE S: "$SERVER\PBD" ENDSELECT SELECT CASE INGROUP ("Mansfield SSCS") ? "[ Mapping S: to SSCS on ( $SERVER )... ]" USE S: "$SERVER\SSCS" ENDSELECT SELECT CASE INGROUP ("Mansfield Maintenace") ? "[ Mapping S: to Maintenance on ( $SERVER )... ]" USE S: "$SERVER\Maintenance" ENDSELECT SELECT CASE INGROUP ("Mansfield Payroll") ? "[ Mapping S: to Payroll on ( $SERVER )... ]" USE S: "$SERVER\Payroll" ENDSELECT SELECT CASE INGROUP ("Mansfield FE") ? "[ Mapping S: to FE on ( $SERVER )... ]" USE S: "$SERVER\FE" ENDSELECT SELECT CASE INGROUP ("Mansfield SSHR") ? "[ Mapping R: to SSHR on ( $SERVER )... ]" USE R: "$SERVER\SSHR" ENDSELECT SELECT CASE INGROUP ("Mansfield Warehouse") ? "[ Mapping S: to Warehouse on ( $SERVER )... ]" USE S: "$SERVER\Warehouse" ENDSELECT SELECT CASE INGROUP ("Mansfield Frey VM") ? "[ Mapping S: to FREYVM on ( $SERVER )... ]" USE S: "$SERVER\FREYVM" ENDSELECT SELECT CASE INGROUP ("Mansfield Frey Purch") ? "[ Mapping S: to FREYPURCH on ( $SERVER )... ]" USE S: "$SERVER\FREYPURCH" ENDSELECT SELECT CASE INGROUP ("Mansfield Frey CS") ? "[ Mapping S: to FreyCS on ( $SERVER )... ]" USE S: "$SERVER\FreyCS" ENDSELECT SELECT CASE INGROUP ("Mansfield Frey Admin") ? "[ Mapping R: to Freyadmin on ( $SERVER )... ]" USE R: "$SERVER\Freyadmin" ENDSELECT SELECT CASE INGROUP ("Junebox") ? "[ Mapping H: to Users on ( $SERVER )... ]" USE H: "$SERVER\JUNusers" ? "[ Mapping P: to Public on ( $SERVER )... ]" USE P: "$SERVER\Public" ENDSELECT IF EXIST ("C:\ETIME\APPS") ? "[ Mapping X: for ETIME... ]" USE X: "$SERVER\ETIME" ENDIF IF EXIST ("C:\CFWY") ? "[ Mappig V: for OmniRate... ]" USE V: "$SERVER\CFOMNIRATE" ENDIF GOTO DDM ;================================================ CASE INGROUP ("Appleton") $SERVER = "\\APPFP1NT" ? "[ Your Logon Server is = ( $SERVER )... ]" ? "[ Mapping H: to Users on ( $SERVER )... ]" USE H: "$SERVER\users" ? "[ Mapping P: to Data on ( $SERVER )... ]" USE P: "$SERVER\Data" GOTO DDM ;================================================ CASE INGROUP ("Junebox") $SERVER = "\\APPIIS1NT" ? "[ Your Logon Server is = ( $SERVER )... ]" ? "[ Mapping H: to JUNUsers on ( $SERVER )... ]" USE H: "$SERVER\JUNusers" ? "[ Mapping P: to General on ( $SERVER )... ]" USE P: "$SERVER\General" GOTO DDM ;================================================ CASE INGROUP ("Cary") $SERVER = "\\CARBDC1NT" ? "[ Your Logon Server is = ( $SERVER )... ]" ? "[ Mapping H: to Users on ( $SERVER )... ]" USE H: "$SERVER\users" GOTO DDM ;================================================ CASE INGROUP ("Cedar Falls") $SERVER = "\\CEDFP1NT" ? "[ Your Logon Server is = ( $SERVER )... ]" ? "[ Mapping H: to CEDUsers on ( $SERVER )... ]" USE H: "$SERVER\CEDusers" ? "[ Mapping P: to CEDData on ( $SERVER )... ]" USE P: "$SERVER\CEDData" GOTO DDM ;================================================ CASE INGROUP ("Fremont") $SERVER= "\\FREFP1NT" ? "[ Your Logon Server is = ( $SERVER )... ]" ? "[ Mapping H: to FREUsers on ( $SERVER )... ]" USE H: "$SERVER\FREusers" GOTO DDM ;================================================ CASE INGROUP ("Fresno") $SERVER = "\\FRSRT1NT" ? "[ Your Logon Server is = ( $SERVER ) ]" GOTO DDM ;================================================ CASE INGROUP ("Lyons") $SERVER = "\\LYNFP1NT" ? "[ Your Logon Server is = ( $SERVER )... ]" ? "[ Mapping H: to LYNUsers on ( $SERVER )... ]" USE H: "$SERVER\LYNusers" ? "[ Mapping P: to LYNPublic on ( $SERVER )... ]" USE P: "$SERVER\LYNPublic" GOTO DDM ;================================================ CASE INGROUP ("Ontario") $SERVER = "\\ONTFP1NT" ? "[ Your Logon Server is = ( $SERVER )... ]" ? "[ Mapping H: to ONTUsers on ( $SERVER )... ]" USE H: "$SERVER\ONTusers" ? "[ Mapping P: to Public on ( $SERVER )... ]" USE P: "$SERVER\Public" GOTO DDM ;================================================ CASE INGROUP ("Southeaven") $SERVER = "\\SOUFP1NT" ? "[ Your Logon Server is = ( $SERVER )... ]" ? "[ Mapping H: to SOUUsers on ( $SERVER )... ]" USE H: "$SERVER\SOUusers" ? "[ Mapping P: to SOUData on ( $SERVER )... ]" USE P: "$SERVER\SOUData" GOTO DDM ;================================================ CASE INGROUP ("Sportime") $SERVER = "\\SPTFP1NT" ? "[ Your Logon Server is = ( $SERVER )... ]" ? "[ Mapping H: to SPTUsers on ( $SERVER )... ]" USE H: "$SERVER\SPTUsers" ? "[ Mapping P: to SPTPublic on ( $SERVER )... ]" USE P: "$SERVER\SPTPublic" ? "[ Mapping S: to SPTDepts on ( $SERVER )... ]" USE S: "$SERVER\SPTDepts" SELECT CASE INGROUP ("SPTkp") ? "[ Mapping K: to SPTAPPS on ( $SERVER )... ]" USE K: "$SERVER\SPTAPPS" ENDSELECT GOTO DDM ENDSELECT ;================================================ ;Setting Departmental Drive Mappings... ;================================================ :DDM SELECT CASE INGROUP ("Sales Admin") ? "[ Mapping S: to Sales on ( \\appfp1nt )... ]" USE S: "\\appfp1nt\sales" ENDSELECT GOTO CADM ;================================================ ;Setting Custom Application Drive Mappings... ;================================================ :CADM SELECT CASE INGROUP ("FRX") ? "[ Mapping W: to frx55 on ( \\appsql1nt )... ]" USE W: "\\appsql1nt\frx55" ENDSELECT GOTO AUXSCR ;================================================ ;Running AUX Scripts... ;================================================ :AUXSCR ? "[ Running AuditWizard Scanner... ]" RUN "\\appcitrix1nt\scanners\netlogon\scan32.exe" ;================================================ ;[ SHELL ] will run the app and the script will ;pause till the app has finnished before ;continuing. ;[ RUN ] will start the app and the script will ;continue without waiting. ;================================================ ;================================================ ;Norton Virus Definition Update ;================================================ ? "[ Checking for AntiVirus Update... ]" $NAVFILE = Dir("$SERVER\netlogon\_auxfiles\*.exe") IF EXIST ("C:\NAV") GOTO FVAR ELSE MD "C:\NAV" GOTO FVAR ENDIF :FVAR IF EXIST ("C:\NAV\$NAVFILE.log") GOTO NOUPD ELSE DEL "C:\NAV\*.log" OPEN(1,"C:\NAV\$NAVFILE.log",5) WRITELINE(1,"Your NAV Definitions were updated with.... " + $NL) WRITELINE(1,"[ $NAVFILE ] at [ @TIME @DATE ]") CLOSE(1) ? "[ Updating AntiVirus with ( $NAVFILE )... ]" RUN "$SERVER\netlogon\_auxfiles\$NAVFILE /q" GOTO END ENDIF :NOUPD ? "[ Your AntiVirus Definitions are up to date... ]" GOTO END ;================================================ ;End of Script... ;================================================ :END ? "[ Finish SSI Login Script... ]" + $NL SLEEP 5 EXIT [ 03 April 2002, 18:48: Message edited by: Rocco Capra ] |
||||||||
|
|
|||||||
Rocco, Welcome to the board. You know, this is a very frequently asked question. You'd think someone would have the answer in the FAQ section. All KiX functions return results. You can either wrap them in IF statements, or assign then to a variable. $RC = SetConsole ("ALWAYSONTOP") |
||||||||
|
|
|||||||
As Les mentioned, in your script the functions SetTitle(), SetConsole(), Open(), Close(), and WriteLine() all will return values. You need to capture the result in a variable in order to suppress the value printing on the screen. If you don't mind, I have reposted your script with the following changes: * Used indentation to make the CASE SELECT and IF statements more readable. * Banished almost all of the GOTO statements and their corresponding labels. * Used Null ($) to capture results of Kixtart functions. code:Please test this if you are going to use it. I hope this helps!;================================================ |
||||||||
|
|
|||||||
Using '$=SetTitle("School Specialty Login Script")' is a big NO-NO. The '$' character is a reserved character if you so will. Anyway, always assign a properly formatted variable name and do not use '$' as a variable name. Therefore, it sound be '$retcode=SetTitle("School Specialty Login Script")' |
||||||||
|
|
|||||||
Jens - Thanks for the info. I've seen code on the BB using this format. Rocco - You will want to know the value of the variable for checking the success or failure of the functions. |
||||||||
|
|
|||||||
As soon as I get back to work tomarrow I'll try this stuff out. Um the "sleep 5" is there for testing only the script is not being used by the users yet. I have a bat file for each "Group" right now and it gets messy, that's why I made this one file in KIX for all users. Oh and the original file has tabulation in it (TextPad). It just removed the tabs when I copied and pasted it in the post. Rocco [ 02 April 2002, 01:55: Message edited by: Rocco Capra ] |
||||||||
|
|
|||||||
Dean: It's just a bad programming practice and might lead to problems. I believe in proper coding to prevent errors in the first place. Additionally, if you are using a dummy variable like $dummy or $retcode then you know that it is a dummy variable when you reread your code six months after writing it. |
||||||||
|
|
|||||||
Why is $= a bad thing ? -Shawn |
||||||||
|
|
|||||||
The '$' sign is the indicator for a variable, it is not a variable itself. Thus one shouldn't be able to use it as a variable. Also, if '$' is a variable , then code:might have two meanings. The output could be either$aa='abcabc' code:orbbaa code:Not knowing how the inner workings of Kixtart are I think it is safer to not use '$' as a variable to prevent potential problems. I am sure Ruud will be able to give us the definite answer on how '$' as a variable would affect Kixtart scripts.abcabc |
||||||||
|
|
|||||||
Isn't $ a variable ? -Shawn I'm just pulling your chain there Jens. I know $= isn't best practice (there are other problems with it as well). Maybe I'm just making excuses for my own terrible coding style [ 02 April 2002, 05:10: Message edited by: Shawn ] |
||||||||
|
|
|||||||
OR maybe you're just trying to raise your post count? |
||||||||
|
|
|||||||
Jens, Shawn's jerking yer chain fer sure. It was he and someone (who, I can't remember) that taught me $ is a valid variable. I couldn't find the thread so will reiterate. A simple snippet of code like this will confirm: break on $="test" $ ? "\\Server\Users\@UserID$" ? "\\Server\Users\@UserID$$" ? get $_ IF you assign a string or value to $, then if you use sloppy coding for say, hidden shares, it will give you grief. If $ is assigned as a string, then: Use "H:" "\\Server\Users\@UserID$" Would concatenate the @UserID and the $ as if it were: "\\Server\Users\" + @UserID + $ The manual states that if a $ is used within quotes that it should be $$, as in: Use "H:" "\\Server\Users\@UserID$$" |
||||||||
|
|
|||||||
I think a lot of questions might be cleared up with the $= topic by looking at Ruud's responses to my questions posted over on the KiXtart forum at www.scriptlogic.com Specifically... http://www.scriptlogic.com/support/forums/display_message.asp?mid=2525 |
||||||||
|
|
|||||||
Les, Let's see here two FAQs.. You are doing good here. (1) How to suppress results from SETITLE, WRITEPROFILESTRING, WRITELINE, etc.? (2) What makes a good variable, when it is not used, but we still need to supress the results? Thanks! - Kent |
||||||||
|
|
|||||||
brian, indeed that discussion is what i've been thinking of... actually I were wondering before that behaviour of kix accepting $-variable and thought that it must be kind off null pointer and have threated it as one since then (some 5 months now). and as such I do not see it bad coding at all, vise versa. cheers all goodfellas, |
||||||||
|
|
|||||||
I've encountered some problems using $=.. as a NULL pointer ! Since then i'm suing $RC as default return value. As i remember it had something to do with returnvalues being set by a function, redirected to $=, but seemed to be used in a following expression |
||||||||
|
|
|||||||
hmm... about it being used in following expression points to same thing les was talking about. about using $-sign in expression or string... which then is also bad coding, something that manual is against and as so wrong. when used as null pointer, it's just undocumented not wrong. am I right? and even thou I might not be, I could throw my 300cent(meter)s... sjdhjklyf, |
||||||||
|
|
|||||||
I agree with Lonkero, I love the $= and have been using it way too long to stop now. I think it makes code less cluttered and a bit easier to read (imho). Plus the fact that our production scripts are riddled with it`s usage. Sure, it may be a bit of a loaded gun, but if one appreciates and understands the mechanism (and the dangers), no bad will happen. For someone starting with a clean slate - I`d probably discourage the usage. -Shawn |
||||||||
|
|
|||||||
Wow, cool discussion. Didn't expect this. Anyway, thanks to everybody for the very educational responses. After reading this discussion, I'd like to propose a new topic called 'Good Programming Practices in Kixtart'. I'm sure we're going to agree to disagree on some programming styles but it might be a very educational exercise. |
||||||||
|
|
|||||||
Les, You know what? This is in the FAQ... Check this out: Debugging without user input.. Later, - Kent |
||||||||
|
|
|||||||
OK.. OK.. Made a new FAQ a bit more specific.. Suppressing Results when running scripts Thanks! - Kent |
||||||||
|
|
|||||||
Kent, OK, I'll see your Suppressing Results when running scripts and raise you one Why does the console display zeros and ones (amongst others)? |
||||||||
|
|
|||||||
WOW!!! My first post and I get a FAQ named after me.[well, almost]. LOL Rocco |
||||||||
|
|
|||||||
it seems that you boys are having fun writing those faqs... maybe after some other duplicants you may send them to us and we vote for the best one |
||||||||
|
|
|||||||
Ok How do I shut the email notification off on this thread? I can't keep up with all the mail. Rocco |
||||||||
|
|
|||||||
Sorry Bud, As far as I know, the email notification cannot be toggled per thread. Your only option is to close the topic (if you have that permission), or try the global setting on your profile. |