Jump to content

FileGetShortName


Recommended Posts

Hi

I have had some trouble with a script, and now find this func has not beeen working for a directory [or filename?] past the first level? - goes back some versions, before Unicode change; maybe forever?

Run from helpfile; modified for an existing directory, thus;

;~ $a = FileGetShortName(@HomeDrive & "\Program Files")
$a = FileGetShortName("C:\Program Files\AutoIt3\Copy of Examples\")
ConsoleWrite("short file name="& $a&@LF)
msgbox(0,"short file name", $a)
;$a is probably "x:\PROGRA~1"
; But output is ; short file name=C:\PROGRA~1\AutoIt3\Copy of Examples\
Should be;

C:\PROGRA~1\AutoIt3\Copy~1\ -or similar?

Randall

Edited by randallc
Link to comment
Share on other sites

if it doesnt exist it cant shorten it, if it does, then it does

Not for me!

That's my point; see example in post 1; that directory does indeed exist on my computer.

Thanks, Randall

[]EDIT -PS it works OK an a different computer! -all XPSP2, although not the last few updates , last few weeks off broadband..]

Edited by randallc
Link to comment
Share on other sites

No problem here...

Posted Image

$a = FileGetShortName("C:\Program Files\AutoIt3\Examples\EzSkin\EzSkin_1-2-3-0-2.exe")
$b = FileGetShortName(@HomeDrive & "\Program Files\AutoIt3\Examples\EzSkin\EzSkin_1-2-3-0-2.exe")
If FileExists($a) Then
    ConsoleWrite("short file name=" & $a & @LF)
    MsgBox(0, @AutoItVersion & " short file name", $a & @CRLF & $B)
    ;$a is probably "x:\PROGRA~1"
Else
    MsgBox(0, "error", "short file name does not exist" & @CRLF & $a)
EndIf

folder or file

...

Win Xp SP2

Autoit 3.2.2.0

Beta 3.2.3.10

8)

Edited by Valuater

NEWHeader1.png

Link to comment
Share on other sites

If you open a cmd prompt and go into C:\Program Files\AutoIt3

Then do

Dir /X

Does it show a short file name entry for Copy of Examples?

I'll look ; not at that computer again till later; it does return @error=1, btw! [could there be a setting in XP or disc error on that computer stopping it working?]

Randall

Edited by randallc
Link to comment
Share on other sites

seems to work for me, example:

$a = FileGetShortName("C:\Program Files\AutoIt3\AutoIt Debugger\")
ConsoleWrite("short file name="& $a&@LF)
msgbox(0,"short file name", $a)

>"C:\Program Files\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "F:\Autoit_files\test2.au3" /autoit3dir "C:\Program Files\AutoIt3" /UserParams

+>20:27:06 Starting AutoIt3Wrapper v.1.8.4

>Running AU3Check (1.54.7.0) from:C:\Program Files\AutoIt3

+>20:27:06 AU3Check ended.rc:0

>Running:(3.2.4.6):C:\Program Files\AutoIt3\autoit3.exe "F:\Autoit_files\test2.au3"

short file name=C:\PROGRA~1\AutoIt3\AUTOIT~1\

+>20:27:09 AutoIT3.exe ended.rc:0

+>20:27:11 AutoIt3Wrapper Finished

>Exit code: 0 Time: 5.047

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

If you open a cmd prompt and go into C:\Program Files\AutoIt3

Then do

Dir /X

Does it show a short file name entry for Copy of Examples?

No it doesn't for any within that directory!

How annoying is that! - Do I need a computer tech or a new computer?

Randall

Link to comment
Share on other sites

No it doesn't for any within that directory!

How annoying is that! - Do I need a computer tech or a new computer?

Randall

I dont know how Autoit check filenames but if it takes them directly from the filesystem then are you sure you have creation of short filenames on??

In newer operating systems(for example win XP) you can turn it off by editing a registrykey and since this is a unneccessary burden on your comp many people turn it off. But as I said, I dont know how Autoit gets filenames.

Edit=Oh forgot to say that this is only on NTFS.

Edited by TzarAlkex
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...