Shibuya Posted September 19, 2005 Share Posted September 19, 2005 I've got a DOS executable that needs to use short names when executed with RunWait or Run. The code is as follows: Dim $file_prn Dim $pl_txt Dim $data_extract ; Declare variables as constants $pl_txt = @ScriptDir & "\CACHE\PL_TXT.TXT" $data_extract = @ScriptDir & "\CACHE\DATA_EXTRACT.TXT" #include ".\FUNCTIONS\FILEOPENDIALOGUE.AU3" ProgressOn("Conversion in Progress...", "Converting...") RunWait(FileGetShortName(@ScriptDir & "\COM\REVPMAC.EXE") & " " & FileGetShortName($file_prn) & " " & FileGetShortName($pl_txt), "", @SW_HIDE) ProgressSet(100 , "Done", "Complete") sleep(1000) ProgressOff() Apparently, FileGetShortName($pl_txt) does not give me the short name but the original windows long name!! Can someone tell me what's wrong with my code or is it a bug?? The speed of sound is defined by the distance from door to computer divided by the time interval needed to close the media player and pull up your pants when your mom shouts "OH MY GOD WHAT ARE YOU DOING!!!" Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted September 19, 2005 Moderators Share Posted September 19, 2005 No Bug, your RunWait() doesn't look setup right.. You can see that it does get the short name if you debug a bit: $pl_txt = FileGetShortName(@ScriptDir & "\CACHE\PL_TXT.TXT") MsgBox(0, "", $pl_txt) Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Shibuya Posted September 19, 2005 Author Share Posted September 19, 2005 (edited) No Bug, your RunWait() doesn't look setup right..You can see that it does get the short name if you debug a bit: $pl_txt = FileGetShortName(@ScriptDir & "\CACHE\PL_TXT.TXT") MsgBox(0, "", $pl_txt)i did a test script as belowi've checked and it doesn't workyou all can try to verify?save the script on your desktop and run it.Dim $file_prn Dim $pl_txt Dim $data_extract ; Declare variables as constants $pl_txt = @ScriptDir & "\CACHE\PL_TXT.TXT" $data_extract = @ScriptDir & "\CACHE\DATA_EXTRACT.TXT" $file_prn = @ScriptDir & "\TEST.PRN" ;ProgressOn("Conversion in Progress...", "Converting...") MsgBox(0, "", FileGetShortName(@ScriptDir & "\COM\REVPMAC.EXE") & " " & FileGetShortName($file_prn) & " " & FileGetShortName($pl_txt)) ;RunWait(FileGetShortName(@ScriptDir & "\COM\REVPMAC.EXE") & " " & FileGetShortName($file_prn) & " " & FileGetShortName($pl_txt), "", @SW_HIDE) ;ProgressSet(100 , "Done", "Complete") ;sleep(1000) ;ProgressOff()I've figured out the problemIt seems that FileGetShortName requires an existing file and path indicated as in the script, else it will jus return the long name.Once the indicated file and path name exists, my script works fine.Is that how FileGetShortName is intended to work?Or is it a undiscovered bug? Edited September 19, 2005 by Shibuya The speed of sound is defined by the distance from door to computer divided by the time interval needed to close the media player and pull up your pants when your mom shouts "OH MY GOD WHAT ARE YOU DOING!!!" Link to comment Share on other sites More sharing options...
LxP Posted September 19, 2005 Share Posted September 19, 2005 It seems that FileGetShortName requires an existing file and path indicated as in the script, else it will jus return the long name.Once the indicated file and path name exists, my script works fine.Is that how FileGetShortName is intended to work?Or is it a undiscovered bug? It's not possible to determine the short name of a nonexistent file, because it's not as simple as (for instance) truncating the name to 6 characters and appending ~1 to the end. I would suggest adjusting your RunWait() line to create files with names of 8.3 format and then rename them to your desired name. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now