Page 1 of 1 1
Topic Options
#9792 - 2001-06-21 06:08 PM Multiple get and gets commands
Anonymous
Unregistered


Hi, first of all let me say thanks for this great resource. I have written a little script to rename Windows 95 NetBios names. It works fine, but there is a silly little problem that I am trying to fix. When the script asks for a selection for the school. It goes to the proper section but then when I ask for input again the choice that I previously entered is at the start of where I have to type in the next gets command. Example I press a and then it prompts me to type in the users first letter and lastname the a I previously picked is the first character and I have to delete it with backspace. So what I'm looking for is a way to supress the first choice. The code is below. Thanks in advance for any help.

code
--------------------------------------------
:Set_name
Cls
Color g+/n
At (4,10) "Rename Computer Utility"
At ( 6,10) "Select Location...."
Color w+/n
At ( 8,10) "A.... Administration "
At ( 9,10) "B.... Baldwin "
At (10,10) "C.... Booker T. Washington"
At (11,10) "D.... Burling "
At (12,10) "E.... Carson "
At (13,10) "F.... Central "
At (14,10) "G.... Delair "
At (15,10) "H.... Fine "
At (16,10) "I.... Franklin "
At (17,10) "J.... Longfellow "
At (18,10) "K.... Roosevelt "
At (19,10) "L.... Middle School "
At (20,10) "M.... High School "
Color r+/n
At (22,10) "Q.... quit"
Color w+/n
Do
?"Make your Selection"
Get $entry
Until $entry = 'q' Or ($entry >='a' And $entry <= 'n')
Goto $entry
:q
Exit

:a
$Schl = AD
?"Enter users first letter and complete last name seperated by a hyphen:"
Gets $UName
Goto change_namead

:b
$Schl = BA
?"Enter room number:"
Gets $UName
?"Enter computer number"
Gets $No
Goto change_name

:c
$Schl = BW
?"Enter room number:"
Gets $UName
?"Enter computer number"
Gets $No
Goto change_name

:d
$Schl = BU
?"Enter room number:"
Gets $UName
?"Enter computer number"
Gets $No
Goto change_name

:e
$Schl = CA
?"Enter room number:"
Gets $UName
?"Enter computer number"
Gets $No
Goto change_name

:f
$Schl = CE
?"Enter room number:"
Gets $UName
?"Enter computer number"
Gets $No
Goto change_name

:g
$Schl = DE
?"Enter room number:"
Gets $UName
?"Enter computer number"
Gets $No
Goto change_name

:h
$Schl = FI
?"Enter room number:"
Gets $UName
?"Enter computer number"
Gets $No
Goto change_name

:i
$Schl = FR
?"Enter room number:"
Gets $UName
?"Enter computer number"
Gets $No
Goto change_name

:j
$Schl = LO
?"Enter room number:"
Gets $UName
?"Enter computer number"
Gets $No
Goto change_name

:k
$Schl = RO
?"Enter room number:"
Gets $UName
?"Enter computer number"
Gets $No
Goto change_name

:l
$Schl = PM
?"Enter room number:"
Gets $UName
?"Enter computer number"
Gets $No
Goto change_name

:m
$Schl = PH
?"Enter room number:"
Gets $UName
?"Enter computer number"
Gets $No
Goto change_name

:change_namead
WriteValue("HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\ComputerName\ComputerName","ComputerName","$Schl-$Uname","REG_SZ")
$new = $Schl+$uname
Goto end

:change_name
WriteValue("HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\ComputerName\ComputerName","ComputerName","$Schl-$Uname-$No","REG_SZ")
$new = $Schl+$uname+$No
:end
If @ERROR=0 ?"Success, Computer is now called $new"EndIf

If @ERROR=1 ?"Sorry did not work try again"EndIf

---------------------------------------------
end code

Top
#9793 - 2001-06-21 08:10 PM Re: Multiple get and gets commands
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Hey John,

I'm scratching my head over this... your script runs fine on my Win2k Kix 3.63 machine... my first take was to use FLUSHKB right after this line...

Until $entry = 'q' Or ($entry >='a' And $entry <= 'n')


What verison KiX yeah running ?

-Shawn

Top
#9794 - 2001-06-21 10:15 PM Re: Multiple get and gets commands
DrillSergeant Offline
MM club member
*****

Registered: 2004-07-09
Posts: 1164
Loc: Eijsden, the Netherlands
Hi John & Shawn,

This is a 'known issue' in Win9x boxes, it doesn't happen in WNT or W2K.

I hope I get some time tommorrow to convert this script with my 'Select' and 'input' routine.

For John: if you like to see these routines, visit http://home.wanadoo.nl/r.s.m.s.dejong/Kixtart.htm

I'll post something tommorrow.

------------------
Greetz,

Roger the Young
------------------------
The code is out there...
------------------------

_________________________
The Code is out there

Top
#9795 - 2001-06-23 06:27 PM Re: Multiple get and gets commands
DrillSergeant Offline
MM club member
*****

Registered: 2004-07-09
Posts: 1164
Loc: Eijsden, the Netherlands
Hi John,

I've tweaked your script 'a little'.

code:

; *** Display Box ***

:starthere
CLS
color Y+/n
$nul=box(3,3,17,26,"double")
$nul=box(3,28,9,59,"double")
color w+/n
AT (3-1,3)"Rename Computer Utility"
color w/n
AT (5,30)"Room number :"
AT (7,30)"Computer number :"

gosub firstroutine
gosub secondroutine

AT (12,29)"Your new computername will be: "
color w+/n
AT (14,29)"$Schl-$Rnum-$Cnum "
color w/n
AT (16,29)"Is this correct? Enter Y(es) or N(o)"

:correct
GET $correct
if $correct="N" or $correct="n" goto starthere endif
if $correct="Y" or $correct="y" goto changename endif
goto correct

:changename

WriteValue("HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\ComputerName\ComputerName","ComputerName","$Schl-$Rnum-$Cnum","REG_SZ")
if @ERROR=0
AT (16,29)"The computername has been changed. "
AT (17,29)"Press any key to continue."
GET $dummy
exit
else
AT (16,29)"Sorry, the Computername could not be changed. Please try again."
AT (17,29)"Press any key to continue."
GET $dummy
goto starthere
endIf

exit

:firstroutine

DIM $select[13]
DIM $result[13]

$select[0]=" Administration " $result[0]="AD"
$select[1]=" Baldwin " $result[1]="BA"
$select[2]=" Booker T. Washington " $result[2]="BW"
$select[3]=" Burling " $result[3]="BU"
$select[4]=" Carson " $result[4]="CA"
$select[5]=" Central " $result[5]="CE"
$select[6]=" Delair " $result[6]="DE"
$select[7]=" Fine " $result[7]="FI"
$select[8]=" Franklin " $result[8]="FR"
$select[9]=" Longfellow " $result[9]="LO"
$select[10]=" Roosevelt " $result[10]="RO"
$select[11]=" Middle School " $result[11]="PM"
$select[12]=" High School " $result[12]="PH"

; *** Define default variables ***

$crlf=chr(13)+chr(10)+chr(13)+chr(10)

$tline=0 $aline=4
; *** Add default Helptext ***

$helptext=" Valid keys are: "+$crlf+
" <Arrow Up> / <Arrow Down> "+$crlf+
" <Enter> = Exit with selection "+$crlf+
" <Esc> = Exit without answer "+$crlf


; *** Show lines ***

color w+/b AT ($tline+4,4)$select[$tline] color w/n

$tline=1

while $tline<13
AT ($tline+4,4)$select[$tline]
$tline=$tline+1
loop

AT (12,29)"Select your current location "

; *** Push Key Routine ***

:keyinput

get $key
select
case @ERROR=59 ; * Function key {F1} *
$nul=messagebox($helptext,"Select",32,0)
case $key="P" ; * ARROW DOWN *
if $aline<16
$aline=$aline+1
endif
case $key="H" ; * ARROW UP *
if $aline>4
$aline=$aline-1
endif
case $key=chr(27) ; * ESCAPE *
$Schl=""
exit
case $key=chr(13) ; * ENTER *
$Schl=$Result[$aline-4]
return
endselect

if $aline>4 AT ($aline-1,4)$select[$aline-5] endif
color w+/b AT ($aline,4)$select[$aline-4] color w/n
if $aline<16 AT ($aline+1,4)$select[$aline-3] endif

goto keyinput

:secondroutine

$Rnum=""
$Cnum=""

if $Schl="AD"
AT (5,30)"Users first name:"
AT (7,30)"Users last name :"
endif

:room

if $Schl="AD"
AT (12,29)"Enter your first name "
else
AT (12,29)"Enter your room number "
endif

color w+/n AT(5,48)$Rnum get $chr color w/n

$chr=ucase($chr)

select
case $chr=chr(8) ; * Backspace *
if len($Rnum)>0
$Rnum=substr($Rnum,1,len($Rnum)-1)
at(5,48)" "
endif
case $chr=chr(13) ; * Enter *
if len($Rnum)>0
goto computer
endif
case asc($chr)=>48 and asc($chr)<=57 ; * Number *
if len($Rnum)<10
$Rnum=$Rnum+$chr
endif
case asc($chr)=>65 and asc($chr)<=90 ; * Letter *
if len($Rnum)<10
$Rnum=$Rnum+ucase($chr)
endif
endselect
goto room

:computer

if $Schl="AD"
AT (12,29)"Enter your last name "
else
AT (12,29)"Enter your computer number "
endif

color w+/n AT(7,48)$Cnum get $chr color w/n

$chr=ucase($chr)

select
case $chr=chr(8) ; * Backspace *
if len($Cnum)>0
$Cnum=substr($Cnum,1,len($Cnum)-1)
at(7,48)" "
endif
case $chr=chr(13) ; * Enter *
if len($Cnum)>0
return
endif
case 48<=asc($chr) and asc($chr)<=57
if len($Cnum)<10
$Cnum=$Cnum+$chr
endif
case asc($chr)=>65 and asc($chr)<=90 ; * Letter *
if len($Cnum)<10
$Cnum=$Cnum+ucase($chr)
endif
endselect
goto computer

return


Let me know if you like it, or if you need any help tweaking it exactly to your needs.


------------------
Greetz,

Roger the Young
------------------------
The code is out there...
------------------------

_________________________
The Code is out there

Top
#9796 - 2001-06-23 07:44 PM Re: Multiple get and gets commands
Anonymous
Unregistered


I have had this same problem on win9x systems.
If you use a sendkeys(backspace) statement just before your all your get statements you will see this problem go away


Top
#9797 - 2001-06-23 11:58 PM Re: Multiple get and gets commands
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
Shawn,
just to remind : Flushkb never worked 'til today (not even in Kix 2001 )

Jochen

_________________________



Top
#9798 - 2001-06-24 12:16 AM Re: Multiple get and gets commands
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Jochen,

Oops - you're right - and I don't think anybody has posted a beta-bug about this !!!

-Shawn

p.s. How's your Euro-Conversion going ?

Top
#9799 - 2001-06-24 12:35 AM Re: Multiple get and gets commands
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
Shawn ,
Euro Conversion is running ...(all in schedule )
We're actually converting Italy's smart Centers ...

Yep, nobody has reported this by now ..
And nobody has suggested sleep to sleep in milliseconds ... hmmm , i think i'll do this right now !!!

Jochen

_________________________



Top
#9800 - 2001-06-25 03:21 PM Re: Multiple get and gets commands
Anonymous
Unregistered


DrillSergeant,

Thanks so much for taking the time to rewrite this script in a more professional manner. It works great. Thanks also go out to everyone else who took the time to reply to my post. Now I just have to figure out how you made it look so nice then my next script will look a lot better than my others.

John Pursglove


Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 764 anonymous users online.
Newest Members
ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder, M_Moore
17887 Registered Users

Generated in 0.058 seconds in which 0.025 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org