Jump to content

Search the Community

Showing results for tags '_splitpath'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

Found 1 result

  1. Hello, i just found the dll function _splitpath(), testet it and made a faster _PathSplit() function with the same results as the original. #include <File.au3> ;~ Global $sFile = "C:\Program Files/Another Dir\AutoIt3\AutoIt3.chm" ;~ Global $sFile = @ScriptFullPath ;~ Global $sFile = "\\127.0.0.1/SharedDocs/foo.txt" Global $sFile = "\\127.0.0.1/SharedDocs\ggg/foo.txt" Global $szDrive, $szDir, $szFName, $szExt Global $iStart, $iLoop = 10000 ConsoleWrite("_PathSplit" & @LF) $iStart = TimerInit() For $i = 1 To $iLoop _PathSplit($sFile, $szDrive, $szDir, $szFName, $szExt) Next ConsoleWrite(TimerDiff($iStart) & @LF) ConsoleWrite($szDrive & @LF) ConsoleWrite($szDir & @LF) ConsoleWrite($szFName & @LF) ConsoleWrite($szExt & @LF) ;~ MsgBox(48, $sFile, $szDrive & @LF & $szDir & @LF & $szFName & @LF & $szExt) ConsoleWrite(@LF) $szDrive = "" $szDir = "" $szFName = "" $szExt = "" ConsoleWrite("_PathSplit2" & @LF) $iStart = TimerInit() For $i = 1 To $iLoop _PathSplit2($sFile, $szDrive, $szDir, $szFName, $szExt) Next ConsoleWrite(TimerDiff($iStart) & @LF) ConsoleWrite($szDrive & @LF) ConsoleWrite($szDir & @LF) ConsoleWrite($szFName & @LF) ConsoleWrite($szExt & @LF) ;~ MsgBox(48, $sFile, $szDrive & @LF & $szDir & @LF & $szFName & @LF & $szExt) Func _PathSplit2($szPath, ByRef $szDrive, ByRef $szDir, ByRef $szFName, ByRef $szExt) Local $sTemp, $pos, $pos2 Local $aRet = DllCall("MSVCRT.DLL", "none:cdecl", "_wsplitpath", "wstr", $szPath, "wstr", "", "wstr", "", "wstr", "", "wstr", "") If $aRet[2] = "" Then ; UNC path $sTemp = StringTrimLeft($aRet[3], 2) $pos = StringInStr($sTemp, "\") $pos2 = StringInStr($sTemp, "/") If $pos = 0 And $pos2 = 0 Then $szDrive = "" $szDir = $aRet[3] Else If $pos <> 0 And $pos < $pos2 Then $szDrive = StringLeft($aRet[3], $pos + 1) $szDir = StringTrimLeft($aRet[3], $pos + 1) Else $szDrive = StringLeft($aRet[3], $pos2 + 1) $szDir = StringTrimLeft($aRet[3], $pos2 + 1) EndIf EndIf Else $szDrive = $aRet[2] $szDir = $aRet[3] EndIf $szFName = $aRet[4] $szExt = $aRet[5] EndFunc
×
×
  • Create New...