Page 1 of 2 12>
Topic Options
#81379 - 2002-11-26 11:45 PM Need ShortFileName("File") Function
Crazy Eddie Offline
Starting to like KiXtart

Registered: 2002-11-20
Posts: 105
Loc: Sacramento, CA USA
No UDF is available for this, and it would be great if it were included in the Built-in functions.

Several old utilities (ProfGen for one) choke on long file names.
_________________________
{Insert your favorite Witty Tag Line here}

Top
#81380 - 2002-11-27 12:15 AM Re: Need ShortFileName("File") Function
kholm Offline
Korg Regular
*****

Registered: 2000-06-19
Posts: 714
Loc: Randers, Denmark
If you surround the 'long' filename by double quoutes and use 'Start' the short filename will be translated correctly!

Example:
code:
Shell '%COMSPEC% /C Start ProfGen "C:\Long name for directory\Long filename.ini"'

-Erik

Top
#81381 - 2002-11-27 12:19 AM Re: Need ShortFileName("File") Function
MightyR1 Offline
MM club member
*****

Registered: 1999-09-09
Posts: 1264
Loc: The Netherlands
True,

but if you remember the inst.kix script from bbChecker, it uses addprogramitem which requires a shortname for the icon.

Will try to write a UDF for you guys.

Anyone know how shortnames are determined by the OS?
_________________________
Greetz,
Patrick Rutten

- We'll either find a way or make one...
- Knowledge is power; knowing how to find it is more powerful...
- Problems don't exist; they are challenges...

Top
#81382 - 2002-11-27 02:27 AM Re: Need ShortFileName("File") Function
Chris S. Offline
MM club member
*****

Registered: 2002-03-18
Posts: 2368
Loc: Earth
Sure...basically its first six letters of the folder (no spaces) a ~ then a number.

So...

C:\A Long Folder

would be...

C:\alongf~1

Top
#81383 - 2002-11-27 02:55 AM Re: Need ShortFileName("File") Function
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11623
Loc: CA
C:\A Long Folder
would be
C:\alongf~1

C:\A Long Folder is here
would be:
C:\alongf~2

C:\A Long Folder is here to stay
would be:
C:\alongf~3

However, here is a MS KB on the subject.
Short (8.3) File Names May Change When Copied

A DIR /X will show the short file names

FindFile/FindNextFile Query or DIR Query Does Not Return the Correct Set of Files

How to Disable Automatic Short File Name Generation
NOTE: Existing files using the short name format will still be available to 32-bit programs, but all files created after this change is implemented will be unavailable to older 16-bit programs.

Top
#81384 - 2002-11-27 05:14 AM Re: Need ShortFileName("File") Function
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
Profgen?

Have used it fine with LFNs..

If you are having trouble, have you tried surrounding your LFN with ""'s. In other words:

This is a long filename

to be:

"This is a long filename"

HTH,

Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#81385 - 2002-11-27 07:40 AM Re: Need ShortFileName("File") Function
MightyR1 Offline
MM club member
*****

Registered: 1999-09-09
Posts: 1264
Loc: The Netherlands
Guys,

I knew about the ~; spaces and other illegal 8.3 chars are to be removed too. Also all dots except the last should be removed.

What puzzles me is the "MS logic" i.e. in short names for folders like "a b" and "q w".
DOn't see it...

Anyone does???
_________________________
Greetz,
Patrick Rutten

- We'll either find a way or make one...
- Knowledge is power; knowing how to find it is more powerful...
- Problems don't exist; they are challenges...

Top
#81386 - 2002-11-27 10:17 AM Re: Need ShortFileName("File") Function
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
you mean like with dir /x:
code:
27.11.2002  11:18       <KANSIO>                       .
27.11.2002 11:18 <KANSIO> ..
27.11.2002 11:18 <KANSIO> AD0949~1 a d
27.11.2002 11:17 <KANSIO> AS093A~1 a s
27.11.2002 10:05 891 ASIAKI~1.TXT Asiakirja.txt
27.11.2002 10:35 <KANSIO> BBCHEC~1 BBChecker



[ 27. November 2002, 10:18: Message edited by: Lonkero ]
_________________________
!

download KiXnet

Top
#81387 - 2002-11-27 10:23 AM Re: Need ShortFileName("File") Function
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
[Eek!]

that'd make it a tiny bit harder to code the udf for it

[ 27. November 2002, 10:24: Message edited by: jpols ]
_________________________



Top
#81388 - 2002-11-27 11:25 AM Re: Need ShortFileName("File") Function
Lee Wilmott Offline
Starting to like KiXtart

Registered: 2002-09-17
Posts: 106
Loc: Bristol, UK
(Crazy) Eddie,

Have a look at http://www.kixtart.org/cgi-bin/ultimatebb.cgi?ubb=get_topic&f=12&t=000307.

You may find it helpful.

Lee

Top
#81389 - 2002-11-27 11:28 AM Re: Need ShortFileName("File") Function
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
Hehe,

shipping around the logical cliffs of creation by using things already available ... Cool

{My vote for that !}

[ 27. November 2002, 11:29: Message edited by: jpols ]
_________________________



Top
#81390 - 2002-11-28 12:22 AM Re: Need ShortFileName("File") Function
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
already avail?
just added...
and I can't use it as it's wsh...
_________________________
!

download KiXnet

Top
#81391 - 2002-11-27 03:15 PM Re: Need ShortFileName("File") Function
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11164
Loc: Boston, MA, USA
I have the same problem of not being able to use it because I actively disable the creation of DOS-compatible (short) filenames under NTFS in order to increase file I/O performance.
_________________________
There are two types of vessels, submarines and targets.

Top
#81392 - 2002-11-27 03:29 PM Re: Need ShortFileName("File") Function
Crazy Eddie Offline
Starting to like KiXtart

Registered: 2002-11-20
Posts: 105
Loc: Sacramento, CA USA
Wow...thanks for the replies.

Let's take them apart:
1) The WSH option is a decent one, but I was looking for a KIX-only solution.
2) The use of double "" does not properly work for profgen. My command is "{path}profgen.exe {path}newprof.exe -P {path}my.prf {switches} -T {path}TempDir" If any of the second or more pathes have spaces, the command chokes. Quotes in a variety of ways have been tried...doesn't work. Short name pathing does work. However, as described, you can't reliably figure out MS's method for determining a short name, just by knowing the long name.
3) Dir/x works okay, execept when trying to get the short name for a directory itself. It will return the contents of the directory.
4) If a short name is not available because it has been disabled - that's a problem.

Basicly, we need KIX to query the file system/OS to return a short name (if available) for a long name provided. That's what WSH is doing in the provided example.

Great conversation!
Ed

[ 27. November 2002, 15:30: Message edited by: Crazy Eddie ]
_________________________
{Insert your favorite Witty Tag Line here}

Top
#81393 - 2002-11-27 03:43 PM Re: Need ShortFileName("File") Function
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11164
Loc: Boston, MA, USA
Please post the PROFGEN line that doesn't work. So far, any time I've had space in a pathname I was able to use quotes to properly use the pathname.

DOS-compatible filenames are a legacy issue and one should get rid of those as fast as possible.

[ 27. November 2002, 15:44: Message edited by: sealeopard ]
_________________________
There are two types of vessels, submarines and targets.

Top
#81394 - 2002-11-27 04:34 PM Re: Need ShortFileName("File") Function
Crazy Eddie Offline
Starting to like KiXtart

Registered: 2002-11-20
Posts: 105
Loc: Sacramento, CA USA
The code at this point looks like this:

code:
   IF "%USERPROFILE%"=""
$TestKey="HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\ProfileReconciliation\"
$TestValue="ProfileDirectory"
$PROFILEDir=ReadValue($TestKey,$TestValue)
$USERPROFDir="$Profile"
ELSE
$USERPROFDir="%USERPROFILE%"
ENDIF

$MAPILOC=C:\scripts\OUTLOOK
COPY "$MAPILOC\OUTLOOK.PRF" "$USERPROFDir\@userid.PRF"
SHELL '$MAPILOC\PROFGEN.EXE "$MAPILOC\NEWPROF.EXE" -P "$USERPROFDir\@userid.PRF" -R -T "$USERPROFDir"'

This fails.

If you attempt to do the exact same thing in a command prompt, same effect. If you replace all of the LFNs with SFNs, it works. This is a DOS/Profgen issue, not a KIX issue.

NOTE: The reason I am using $UserProfDir for the PRF and the temp directory is to handle multiple logins on a Citrix/TS environment, to ensure the files are not overwritten by other users. (That's my attempt, anyway.)

Ed

ps: SSN-638 and SSN-751 were in my past [Smile]
_________________________
{Insert your favorite Witty Tag Line here}

Top
#81395 - 2002-11-27 04:50 PM Re: Need ShortFileName("File") Function
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
could we continue this in scripts:
http://www.kixtart.org/cgi-bin/ultimatebb.cgi?ubb=get_topic&f=2&t=004001

as this problem has not so much to do with the suggestion.
_________________________
!

download KiXnet

Top
#81396 - 2002-12-07 11:18 AM Re: Need ShortFileName("File") Function
MCA Offline
KiX Supporter
*****

Registered: 2000-04-28
Posts: 5152
Loc: Netherlands, EU
Dear,

On this forum we had made also a request about shortcut names (KIX-FUNCTION: con-
version of long/short filenames to short/long filenames
). At this moment Ruud doesn't
implement something like that.

It looks like that a lot of new suggestions are copies of old ones.
Possible that someone can reread this forum about all interesting suggestions, which
aren't implementing at this moment. As list we can ask Ruud for his comment about
it. In some situation he had return already comment on some of those oldies.
greetings.

(TO_DO)

[ 07. December 2002, 11:25: Message edited by: MCA ]
_________________________
email scripting@wanadoo.nl homepage scripting@wanadoo.nl | Links | Summary of Site Site KiXforms FAQ kixtart.org library collection mirror MCA | FAQ & UDF help file UDF kixtart.org library collection mirror MCA | mirror USA | mirror europe UDF scriptlogic library collection UDFs | mirror MCA

Top
#81397 - 2002-12-08 12:00 AM Re: Need ShortFileName("File") Function
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
already really many of those is included in:
http://www.kixtart.org/board/ultimatebb.php?ubb=get_topic;f=4;t=000282
_________________________
!

download KiXnet

Top
#81398 - 2002-12-07 02:31 PM Re: Need ShortFileName("File") Function
MCA Offline
KiX Supporter
*****

Registered: 2000-04-28
Posts: 5152
Loc: Netherlands, EU
Dear,

We know, but it isn't in a very readable format for Ruud.
greetings.
_________________________
email scripting@wanadoo.nl homepage scripting@wanadoo.nl | Links | Summary of Site Site KiXforms FAQ kixtart.org library collection mirror MCA | FAQ & UDF help file UDF kixtart.org library collection mirror MCA | mirror USA | mirror europe UDF scriptlogic library collection UDFs | mirror MCA

Top
Page 1 of 2 12>


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

Who's Online
2 registered (morganw, mole) and 414 anonymous users online.
Newest Members
gespanntleuchten, DaveatAdvanced, Paulo_Alves, UsTaaa, xxJJxx
17864 Registered Users

Generated in 0.073 seconds in which 0.025 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