#include <GUIConstants.au3>
#include <WindowsConstants.au3>
If UBound($CmdLine) > 1 Then
Global $sFile = $CmdLine[1]
Else
Exit
EndIf
If WinExists('Form1#!*', '') Then Exit
$aXY = MouseGetPos()
$hTrayWnd= WinGetPos('[CLASS:Shell_TrayWnd]')
$hProgman = WinGetPos('[CLASS:Progman]')
$w = $hProgman[2]
$h = $hProgman[3]- $hTrayWnd[3]
If $aXY[1] + 320 > $h Then $aXY[1] = $aXY[1] + ($h - $aXY[1] - 320)
If $aXY[0] + 140 > $w Then $aXY[0] = $aXY[0] + ($w - $aXY[0] - 300)
$Form1 = GUICreate('Form1#!*', 140, 320, $aXY[0] + 20, $aXY[1], BitOR($WS_POPUP, $WS_BORDER))
$nClose_Button = GUICtrlCreateButton('X', 121, 1, 18, 18)
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor(-1, 0xFF0000)
GUICtrlCreateLabel('', 0, 0, 140, 20, $WS_CLIPSIBLINGS, BitOR($WS_EX_DLGMODALFRAME, $GUI_WS_EX_PARENTDRAG))
$Button1 = GUICtrlCreateButton('Фильм', 20, 25, 101, 45, 0)
$Button2 = GUICtrlCreateButton('Сериал', 20, 85, 101, 45, 0)
$Button3 = GUICtrlCreateButton('Музыка', 20, 145, 101, 45, 0)
$Button4 = GUICtrlCreateButton('Игра', 20, 205, 101, 45, 0)
$Button5 = GUICtrlCreateButton('Разное', 20, 265, 101, 45, 0)
GUISetState(@SW_SHOW)
While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE, $nClose_Button
Exit
Case $Button1
_Copir(1)
Case $Button2
_Copir(2)
Case $Button3
_Copir(3)
Case $Button4
_Copir(4)
Case $Button5
_Copir(5)
EndSwitch
WEnd
Func _Copir($iV)
$aPath = _PathSplitByRegExp($sFile)
Switch $iV
Case 1
$f = FileMove($sFile, 'C:\Фильм\' & $aPath[5], 1)
Case 2
$f = FileMove($sFile, 'C:\Сериал\' & $aPath[5], 1)
Case 3
$f = FileMove($sFile, 'C:\Музыка\' & $aPath[5], 1)
Case 4
$f = FileMove($sFile, 'C:\Игра\' & $aPath[5], 1)
Case 5
$f = FileMove($sFile, 'C:\Разное\' & $aPath[5], 1)
EndSwitch
If $f = 1 Then Exit
EndFunc ;==>_Copir
Func _PathSplitByRegExp($sPath)
If $sPath = '' Or(StringInStr($sPath, "\") And StringInStr($sPath, "/")) Then Return SetError(1, 0, -1)
Local $aRetArray[8], $pDelim = ""
If StringRegExp($sPath, '^(?i)([A-Z]:|\\)(\\[^\\]+)+$') Then $pDelim = "\"
If StringRegExp($sPath, '(?i)(^.*:/)(/[^/]+)+$') Then $pDelim = "//"
If $pDelim = "" Then $pDelim = "/"
If Not StringInStr($sPath, $pDelim) Then Return $sPath
If $pDelim = "\" Then $pDelim &= "\"
$aRetArray[0] = $sPath ;Full path
$aRetArray[1] = StringRegExpReplace($sPath, $pDelim & '.*', $pDelim) ;Drive letter
$aRetArray[2] = StringRegExpReplace($sPath, $pDelim & '[^' & $pDelim & ']*$', '') ;Path without FileName and extension
$aRetArray[3] = StringRegExpReplace($sPath, '\.[^.]*$', '') ;Full path without File Extension
$aRetArray[4] = StringRegExpReplace($sPath, '(?i)([A-Z]:' & $pDelim & ')', '') ;Full path without drive letter
$aRetArray[5] = StringRegExpReplace($sPath, '^.*' & $pDelim, '') ;FileName and extension
$aRetArray[6] = StringRegExpReplace($sPath, '.*' & $pDelim & '|\.[^.]*$', '') ;Just Filename
$aRetArray[7] = StringRegExpReplace($sPath, '^.*\.', '') ;Just Extension of a file
Return $aRetArray
EndFunc ;==>_PathSplitByRegExp