 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
SKAN
Joined: 26 Dec 2005 Posts: 7609
|
Posted: Thu Aug 30, 2007 2:17 pm Post subject: |
|
|
| Andreone wrote: | | Actually, c:\\ or c:\\dir\file are still valid paths. However, I understand it can be seen as dirty. |
Honestly, I thought a little more than of cosmetic value, like it could create some problems in specific situations:
| Code: | | hModule := DllCall( "LoadLibrary", Str,WhereIs("MyThirdParty.DLL") ) |
Well! It works fine with double slash! Still, I prefer the function to conform to regular standard.
| Quote: | | During testing, I felt that msgboxes appeared faster when not calling PathAddBackslashA. |
Oh! I will also experiment with RegEx ( I remember PhiLho giving me one )
 |
|
| Back to top |
|
 |
tic
Joined: 22 Apr 2007 Posts: 1502
|
Posted: Thu Aug 30, 2007 2:33 pm Post subject: |
|
|
| Code: | StringRight, CheckLastSlashSource, Source, 1
If CheckLastSlashSource = \
StringTrimRight, Source, Source, 1 |
 |
|
| Back to top |
|
 |
SKAN
Joined: 26 Dec 2005 Posts: 7609
|
Posted: Thu Aug 30, 2007 2:38 pm Post subject: |
|
|
@tic: I know as that is the documented method.  |
|
| Back to top |
|
 |
tic
Joined: 22 Apr 2007 Posts: 1502
|
Posted: Thu Aug 30, 2007 2:49 pm Post subject: |
|
|
sorry! was just wondering what all the commotion was about |
|
| Back to top |
|
 |
SKAN
Joined: 26 Dec 2005 Posts: 7609
|
Posted: Thu Aug 30, 2007 3:47 pm Post subject: |
|
|
| tic wrote: | | wondering what all the commotion was about |
We were tinkering a good idea and hence the commotion.
Anyways, here is a shortened version:
| Code: | WhereIs( File ) {
SplitPath, A_AhkPath,, A_AhkDir
EnvGet, Dos, Path
sPath=%A_WorkingDir%;%A_ScriptDir%;%A_AhkDir%;%A_AhkDir%\Lib;%A_MyDocuments%\AutoHotkey\Lib;%Dos%
Loop, Parse, sPath, `;
IfNotEqual, A_LoopField,, IfExist, %A_LoopField%\%File%
Return, RegExReplace( A_LoopField "\" File, "\\\\", "\" )
RegRead, AppPath, HKLM, SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\%File%
IfExist, %AppPath%, Return, AppPath
} |
Credit: I borrowed the function name and the Registry path from this <external link>
 |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|