Subject |
Re: Computer serial number |
From |
RACHHPAL S GILL <rachhpalg@yahoo.com> |
Date |
Sat, 20 Apr 2024 10:22:16 -0400 |
Newsgroups |
dbase.getting-started |
Perfect. Thanks
Akshat Kapoor Wrote:
> Good Evening Everone,
>
> > Thanks everybody.
> > The following code works but when it displays the serial number every digit has space in between.
> > ///////////
> > run("wmic bios get serialnumber > c:\temp\serial_no.txt")
> > f = new file()
> > f.open("c:\temp\serial_no.txt")
> > mserial_head = f.gets() // first line in text file is heading "Serial number"
> > mserial_no = f.gets()
> > f.close()
> > clear
> > ? mserial_head
> > ? mserial_no
>
> I just ran the above code and checked the file in an online hex editor.
> There were plenty of junk special characters.
>
> I am not even a rookie at this so cannot understand why this is so.
>
> Anyway The following code will remove the extra characters. It will
> remove everything other than numbers and alphabets.
>
>
> set procedure to :duflp:miscapi.prg
> runhidden("wmic bios get serialnumber >
> c:\dbasetutorial\muneemado\news\serial_no.txt")
> f = new file()
> f.open("c:\dbasetutorial\muneemado\news\serial_no.txt")
> f2 = new file()
> f2.create("c:\dbasetutorial\muneemado\news\serial_n.txt")
> do while not f.eof()
> c = f.read(1)
> if asc(c) = 10 or asc(c) = 13 or c $
> 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'
> f2.write(c)
> endif
> enddo
> f2.close()
> f.close()
> f.open("c:\dbasetutorial\muneemado\news\serial_n.txt")
> mserial_head = f.gets() // first line in text file is heading "Serial
> number"
> mserial_no = f.gets()
> f.close()
> clear
> ? mserial_head
> ? mserial_no
>
> The above program should give the desired info.
> Changing run to runhidden removes the dos window popup.
>
> I hope this helps.
>
> Regards
> Akshat
|
|