|
|
|||||||
Hi@all, we have a new network-environment. In our concept, we use 10 characters for the pc-name. The problem is: our old enterprise-software has to identify the PC from a variable but can only handle 8 characters. What i want to do is, to read the pc-name (10char), shorten 2 characters and write the new string (8char) to a environment-variable "term". the name is e.g ROCDTWT012 and shoult be shortened to RODWT012. Is there a way to solve that problem? I'm a noob in scripting and kixstart, so is there somebody who has a script or who can tell me how to do? thanks a lot, bene |
||||||||
|
|
|||||||
Howdie, Q: is it always the 3rd and 5th char to be removed? if so: Code:
|
||||||||
|
|
|||||||
Hi Patrick, thanks for the fast help. Yes, it's always the same characters to be cut off. Unfortunately, it doesn't work. I added these lines to my loginscript: ; Set Term ID IF INGROUP ("PO-TermID") <tab>$=@WKSTA <tab>$=SubSTR($,1,2)+SubSTR($,4,1)+SubSTR($,6) <tab>Set "term="+$ , but the whole workstationname is set to term. I dont understand line 2 of your script - would it be complicated to explain for me ( = bloody noob) thx Bene |
||||||||
|
|
|||||||
substr() - returns a substring of string RETURN_VALUE = substr(STRING_TO_CUT,START_POSITION,LENGTH_OF_SELECTION) substr($,1,2)+SubSTR($,4,1)+SubSTR($,6) is: substring from $ (which is workstation-name) characters 1-2 and 4 and 6 and anything beyond. so, character 3 and 5 are subtracted. |
||||||||
|
|
|||||||
thank you, jooel! sounds easy and logical. but it still doesn't work. the whole pc-name with 10 letters is written to temp. any ideas? |
||||||||
|
|
|||||||
well, I bet that instead of writing it to term, the term never gets changed at all. so, simply add after: Set "term="+$ this: "the Term should be: $ ? get $ with this you can debug what the outcome really is. |
||||||||
|
|
|||||||
Where are you going to use the environment variable? If you are going to spawn a process using Shell or Run you may need to use "SetL" rather than "Set". The same applies if you intend to use %TERM% later in the KiXtart script |
||||||||
|
|
|||||||
Seems, that I'm too stupid for that At least, I arrived to register my name for that Board I also tried to Print $ in a Message-Box with the command MESSAGEBOX (Term is $,termvariable, 0) I do not get any output from Kix. Is there a command like "pause" and "echo" in winnt-commandline? I think I'll have to read a lot to understand, how kixstart is working. damn, i don't have the time for that - i thought, i could just add those two lines to our loginscript and thats it. what should i do now? @richard: our enterprise-software needs to identify the pc to send the printjobs to the right printer. the variable is easiest to be handled as environment-variable |
||||||||
|
|
|||||||
Quote: why not substr($,1,2)+SubSTR($,4,1)+SubSTR($,6,5) Is the command case-sensitive? |
||||||||
|
|
|||||||
It is not case sensitive. Before trying to implement it into the logon script, try it first as a short scriptlet run from a DOS prompt. |
||||||||
|
|
|||||||
Quote: I tried to do so, but nothing happend. How can i test the basic funcionality of Kix? I dont know if it's usefull: im running W2k SP4 as client w2k3 as server |
||||||||
|
|
|||||||
Create a KiX folder on the root of C: Put a copy of KiX32.exe in it In Notepad, write your scriptlet Save the file as "C:\KiX\test.kix" ;make sure to put quotes around the name so it doesn't change ot to test.kix.txt goto Start | Run | CMD in the DOS box, enter the command: CD\KiX enter the command: kix32 test.kix |
||||||||
|
|
|||||||
thats exactly what i did (from a network drive) - now i know that this doesn't work. but on the local drive of the server it also didn't work i did what you said. a tiny mistake in the script and now im getting a result. $ is the name with the cut of letters (lines 1 and 2 are working), but the variable is not set. the output from line 4 works. now, the syntax of the script is: " $=@WKSTA $=SubSTR($,1,2)+SubSTR($,4,1)+SubSTR($,6) Set "term="+$ "the Term should be: "$ ? get $ @kix " is the command Set "term="+$ correct? |
||||||||
|
|
|||||||
it's correct. read above, and check the manual. it is depending where you want to see the env var should you use set or setL or setM |
||||||||
|
|
|||||||
firstly, in Line 4, there was a " missing- there was no output, so i thought, the script wouldn't run at all. then, i tried to run kix32 from a mapped network-drive. and finaly, using a variable needs a logoff after creating it! => I am so stupid! Thank you for all your help an patience, sorry for wasting your time!!! I think, now I can test and implement that to my loginscript, myself. Have a nice evening, Bene |
||||||||
|
|
|||||||
Using the environment variable depends on when you're going to use it. Are you going to use it during the logon script or after? From the manual Quote: Here is some example code to allow you to use the environment AFTER the logon script completes. Code: Break On |
||||||||
|
|
|||||||
Would not the line: If $Admin return true regardless of 'Yes' or 'No'? |
||||||||
|
|
|||||||
Yes, you're correct Les. Thanks I corrected the code above. |
||||||||
|
|
|||||||
Hi NTDOC, thanks for your suggestions, but the variable will be set while first login after installation, the user needs it earliest after 3rd login. so i'll keep it as simple as possible. I completed the script: to work on terminalservers, I need to identify the name of the client-pc. we have old clients (name less than 8char) and new clients (exactly 10 char) so for a user, i have to decide, wether he is working on terminalserver or localPC. if working on terminalservers i have to decide, wether a new pc (10char) or a old pc (<8char) is in use. so the script is something like this: If not "%Clientname%"="" $="%Clientname%" $x=len(%clientname%) IF $x<9 Set "term="+$ Else $=SubSTR($,1,2)+SubSTR($,4,1)+SubSTR($,6) Set "term="+$ EndIF Else $=@WKSTA $=SubSTR($,1,2)+SubSTR($,4,1)+SubSTR($,6) Set "term="+$ EndIF Perhaps not the best way to solve that, but it seems to work... greetz from bavaria, bene |
||||||||
|
|
|||||||
what version of kix you have, btw? in some newer version there was problem with the set... |
||||||||
|
|
|||||||
i had 4.22, since yesterday i use 4.23. perhaps, that was an other problem ... |