Page 1 of 1 1
Topic Options
#206973 - 2013-03-26 07:24 PM Windows 7 %USERNAME% variable
joshuaer Offline
Fresh Scripter

Registered: 2006-02-09
Posts: 15
Hello

I am trying to edit a .ini file, currently it opens the FSP.ini file and looks for to entries labled LastUser and PCAlias and replaces the values with %USERNAME%

This works great except I need it to limit the characters being put in by %USERNAME% to only 8 characters. So if a persons username is 9 or 10 characters it will only show 8 of them. Is there a way to do this?

Break on

$inifile = "C:\Fsp.ini"

$value = ReadProfileString($inifile, "UBS", "LastUser=")

$rc = WriteProfileString($inifile, "UBS", "LastUser", ""%USERNAME%")

$value = ReadProfileString($inifile, "UBS", "PCAlias=")

$rc = WriteProfileString($inifile, "UBS", "PCAlias", "%USERNAME%")
EndIf
_________________________
www.omfgservers.com

Top
#206975 - 2013-03-26 07:28 PM Re: Windows 7 %USERNAME% variable [Re: joshuaer]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4574
Loc: USA
left("%username%",8)

or using the macro in kix
left(@userid,8)
_________________________
(... better days ahead)

Top
#206977 - 2013-03-26 07:53 PM Re: Windows 7 %USERNAME% variable [Re: Allen]
joshuaer Offline
Fresh Scripter

Registered: 2006-02-09
Posts: 15
Thank you so much, worked like a charm
_________________________
www.omfgservers.com

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 2312 anonymous users online.
Newest Members
fgarcia, Viginette, ManuvdWielNL, Sir_Barrington, batdk82
17889 Registered Users

Generated in 0.056 seconds in which 0.028 seconds were spent on a total of 13 queries. Zlib compression enabled.

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