| View previous topic :: View next topic |
| Author |
Message |
olle
Joined: 11 Aug 2009 Posts: 1
|
Posted: Tue Aug 11, 2009 7:49 pm Post subject: Problem with IfExist Command and file extensions |
|
|
Just now I was testing a script that used the IfExist command. I was using a line exactly like the one in the help file only with the extension .MSI (IfExist, D:\Docs\*.msi).
I had an .msi file in the directory that met the criteria and the test worked.
However, when I renamed the file and added a 1 to the end of the extension (e.g. test.msi1), the file was still found even though I was declaring to only look for .MSI
I renamed the file .MSI_TEST and it was still found. No matter what the extension was, as long as it started with .MSI the file was found.
The command seems to be actually behaving like this: IfExist, D:\Docs\*.msi*
I'm using AHK Ver: 1.0.48.03
AHK is great! Thought you would appreciate the info. Please have a look as time permits. Thanks. |
|
| Back to top |
|
 |
HotKeyIt
Joined: 18 Jun 2008 Posts: 4652 Location: AHK Forum
|
|
| Back to top |
|
 |
haichen
Joined: 05 Feb 2007 Posts: 189 Location: Osnabrück, Germany
|
Posted: Tue Aug 11, 2009 9:20 pm Post subject: |
|
|
| Code: | file test.msi1
ifexist , *.msi1 ;found only this but no .msi
file test.msi1bla
ifexist , *.msi1 ; not found
ifexist , *.msi ; found the file |
Strange. |
|
| Back to top |
|
 |
Lexikos
Joined: 17 Oct 2006 Posts: 7295 Location: Australia
|
Posted: Sun Aug 23, 2009 1:18 pm Post subject: |
|
|
See 8.3 filename. A file named "test.msiblablabla" may in fact have an associated short filename "TEST~1.MSI", in which case it would be matched by *.msi.
| Code: | Loop *.msi
MsgBox % A_LoopFileShortName "`n" A_LoopFileName "`n" A_LoopFileExt
| One possible solution:
| Code: | exist := false
Loop *.msi
if A_LoopFileExt = msi ; Uses extension as seen in long filename.
{
exist := true
break
}
MsgBox % exist |
|
|
| Back to top |
|
 |
|