Snippets ( Network ): Difference between revisions

From AutoIt Wiki
Jump to navigation Jump to search
 
(Edited snippets to conform to template Snippet Header.)
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
<div class="center" style="width:auto; margin-left:auto; margin-right:auto;">'''Please always credit an author in your script if you use their code, Its only polite.'''</div>
__TOC__
__TOC__
===== <blockquote style="background-color:white; padding:1em; border:2px solid #8FBC8F">''' _IsNetworkShare() ~ Author - [http://www.autoitscript.com/forum/user/35302-guinness/ guinness] '''</blockquote> =====
[[category:Snippets]]
 
{{Snippet Credit Header}}
 
== _IsNetworkShare ==
 
{{Snippet Header
| AuthorURL = 35302-guinness
| AuthorName = guinness
| Desc = Check if a path is a network drive.
}}


<syntaxhighlight lang="autoit">
<syntaxhighlight lang="autoit">
Line 12: Line 21:
EndFunc  ;==>_IsNetworkShare
EndFunc  ;==>_IsNetworkShare
</syntaxhighlight>
</syntaxhighlight>
[[#top|Return To Contents]]


===== <blockquote style="background-color:white; padding:1em; border:2px solid #8FBC8F">''' _WinAPI_PathIsNetworkPath() ~ Author - [http://www.autoitscript.com/forum/user/35302-guinness/ guinness] '''</blockquote> =====
[[#top | Return To Contents]]
 
== _WinAPI_PathIsNetworkPath ==
 
{{Snippet Header
| AuthorURL = 35302-guinness
| AuthorName = guinness
}}


<syntaxhighlight lang="autoit">
<syntaxhighlight lang="autoit">
Line 27: Line 42:
EndFunc  ;==>_WinAPI_PathIsNetworkPath
EndFunc  ;==>_WinAPI_PathIsNetworkPath
</syntaxhighlight>
</syntaxhighlight>
[[#top|Return To Contents]]
 
[[#top | Return To Contents]]

Latest revision as of 20:16, 15 November 2012


Please always credit an author in your script if you use their code. It is only polite.


_IsNetworkShare

Author: guinness







Check if a path is a network drive.


; Check if a path is a network drive.

ConsoleWrite( _IsNetworkShare(@ScriptDir) & @CRLF)

Func _IsNetworkShare($sFilePath)
    Return (Not StringMid($sFilePath, 2, 1) = ":")
EndFunc   ;==>_IsNetworkShare

Return To Contents

_WinAPI_PathIsNetworkPath

Author: guinness








ConsoleWrite(_WinAPI_PathIsNetworkPath("C:\") & @CRLF)

Func _WinAPI_PathIsNetworkPath($sFilePath)
    Local $aReturn = DllCall("shlwapi.dll", "int", "PathIsNetworkPathW", "wstr", $sFilePath)
    If @error Then
        Return SetError(1, 0, 0)
    EndIf
    Return $aReturn[0]
EndFunc   ;==>_WinAPI_PathIsNetworkPath

Return To Contents