Code: Select all
If !WinExist("ahk_class FreeCommanderXE.SingleInst.1 ahk_exe FreeCommander.exe")
Return
SoundBeep, 1500
WinActivate
Send ^1
WinMinimize
Return
Code: Select all
If !WinExist("ahk_class FreeCommanderXE.SingleInst.1 ahk_exe FreeCommander.exe")
Return
SoundBeep, 1500
WinActivate
Send ^1
WinMinimize
Return
Code: Select all
shellWindows := ComObjCreate("Shell.Application").Windows
window := shellWindows.Item(ComObject(VT_UI4 := 0x13, SWC_DESKTOP := 8))
shellFolderView := window.Document
for item in shellFolderView.Folder.Items
items .= (!items ? "" : "`n") . item.Path
MsgBox, % items
Code: Select all
If !FileExist(dest := "M:\Backup") {
FileCreateDir, %dest%
If ErrorLevel {
MsgBox, 48, Error, An error occurred while creating the directory. Aborting.
ExitApp
}
}
tmstmp := SubStr(A_YYYY, 3) A_MM A_DD "-" A_Hour A_Min
For each, file in A_Args {
target := dest "\" tmstmp " " StrSplit(file, "\").Pop()
If Instr(FileExist(file), "D")
FileCopyDir, %file%, %target%
Else FileCopy , %file%, %target%
If ErrorLevel
MsgBox, 48, Error, An error occurred while copying the file.`n`n%file%
}
Msgbox , , Super, copy finished, 2
ExitApp
Code: Select all
^1::Run, % A_AhkPath " " A_ScriptDir "\backup.ahk " GetSelectedExplorerOrDesktop()
#IfWinActive ahk_class FreeCommanderXE.SingleInst.1 ahk_exe FreeCommander.exe
^1::Send ^2
#IfWinActive
GetSelectedExplorerOrDesktop() {
hwnd := WinExist("A")
WinGetClass, class, ahk_id %hwnd%
If (class ~= "Progman|WorkerW")
Return JEE_ExpGetSelDesktop(" ")
If (class ~= "(Cabinet|Explore)WClass")
For window in ComObjCreate("Shell.Application").Windows
If (window.hwnd = hwnd)
For item in window.document.SelectedItems
selection .= (selection ? " " : "") """" item.path """"
Return selection
}
JEE_ExpGetSelDesktop(vSep := "`n") { ; Get paths of selected desktop files
; https://www.autohotkey.com/boards/viewtopic.php?p=154836#p154836
oWindows := ComObjCreate("Shell.Application").Windows, VarSetCapacity(hWnd, 4, 0)
oWin := oWindows.FindWindowSW(0, "", SWC_DESKTOP := 8, ComObject(0x4003, &hWnd), SWFO_NEEDDISPATCH := 1)
vCount := oWin.Document.SelectedItems.Count
VarSetCapacity(vOutput, (260 + StrLen(vSep)) * vCount * 2)
For oItem in oWin.Document.SelectedItems
selection .= SubStr(oItem.path, 1, 3) = "::{" ? "" : """" oItem.path """" vSep
Return SubStr(selection, 1, -StrLen(vSep))
}
Code: Select all
If !FileExist(dest := "D:\Backup") {
FileCreateDir, %dest%
If ErrorLevel {
MsgBox, 48, Error, An error occurred while creating the directory. Aborting.
Return
}
}
tmstmp := SubStr(A_YYYY, 3) A_MM A_DD "-" A_Hour A_Min, n := 0
For each, file in A_Args {
SplitPath, file,,, ext
If (ext = "lnk")
FileGetShortcut, %file%, file
target := dest "\" tmstmp " " StrSplit(file, "\").Pop()
If Instr(FileExist(file), "D")
FileCopyDir, %file%, %target%
Else FileCopy , %file%, %target%
If ErrorLevel
MsgBox, 48, Error, An error occurred while copying the file.`n`n%file%
Else n++
}
MsgBox, 64, Done, Files copied: %n%
ExitApp
Code: Select all
^w::
; THis MsgBox work good
MsgBox, % GetSelectedExplorerOrDesktop()
; CODE WITH PROBLEM WHICH DOESN'T WORK MORE. WHY ????
;~ dest := "D:\Backup"
;~ ;tmstmp := SubStr(A_YYYY,3) . A_MM . A_DD "-" A_Hour . A_Min . A_Sec ; 211108-173512
;~ tmstmp := SubStr(A_YYYY,3) . A_MM . A_DD "-" A_Hour . A_Min ; 211108-1735
;~ for a,b in GetSelectedExplorerOrDesktop()
;~ {
;~ if instr(FileExist(b),"D")
;~ FileCopyDir, %b%, % dest "\" tmstmp " " strsplit(b,"\").pop()
;~ else
;~ FileCopy, %b%, % dest "\" tmstmp " " strsplit(b,"\").pop()
;~ }
;~ return
GetSelectedExplorerOrDesktop() {
hwnd := WinExist("A")
WinGetClass, class, ahk_id %hwnd%
If (class ~= "Progman|WorkerW")
Return JEE_ExpGetSelDesktop(" ")
If (class ~= "(Cabinet|Explore)WClass")
For window in ComObjCreate("Shell.Application").Windows
If (window.hwnd = hwnd)
For item in window.document.SelectedItems
selection .= (selection ? " " : "") """" item.path """"
Return selection
}
JEE_ExpGetSelDesktop(vSep := "`n") { ; Get paths of selected desktop files
; https://www.autohotkey.com/boards/viewtopic.php?p=154836#p154836
oWindows := ComObjCreate("Shell.Application").Windows, VarSetCapacity(hWnd, 4, 0)
oWin := oWindows.FindWindowSW(0, "", SWC_DESKTOP := 8, ComObject(0x4003, &hWnd), SWFO_NEEDDISPATCH := 1)
vCount := oWin.Document.SelectedItems.Count
VarSetCapacity(vOutput, (260 + StrLen(vSep)) * vCount * 2)
For oItem in oWin.Document.SelectedItems
selection .= SubStr(oItem.path, 1, 3) = "::{" ? "" : """" oItem.path """" vSep
Return SubStr(selection, 1, -StrLen(vSep))
}
Code: Select all
^w::
; THis MsgBox work good
; MsgBox, % GetSelectedExplorerOrDesktop()
; CODE WITH PROBLEM WHICH DOESN'T WORK MORE. WHY ????
dest := "D:\Backup"
;tmstmp := SubStr(A_YYYY,3) . A_MM . A_DD "-" A_Hour . A_Min . A_Sec ; 211108-173512
tmstmp := SubStr(A_YYYY,3) . A_MM . A_DD "-" A_Hour . A_Min ; 211108-1735
for a,b in GetSelectedExplorerOrDesktop()
{
if instr(FileExist(b),"D")
FileCopyDir, %b%, % dest "\" tmstmp " " strsplit(b,"\").pop()
else
FileCopy, %b%, % dest "\" tmstmp " " strsplit(b,"\").pop()
}
return
GetSelectedExplorerOrDesktop() {
hwnd := WinExist("A")
WinGetClass, class, ahk_id %hwnd%
If (class ~= "Progman|WorkerW")
Return JEE_ExpGetSelDesktop(" ")
If (class ~= "(Cabinet|Explore)WClass")
For window in ComObjCreate("Shell.Application").Windows
If (window.hwnd = hwnd)
For item in window.document.SelectedItems
selection .= (selection ? " " : "") """" item.path """"
Return selection
}
JEE_ExpGetSelDesktop(vSep := "`n") { ; Get paths of selected desktop files
; https://www.autohotkey.com/boards/viewtopic.php?p=154836#p154836
oWindows := ComObjCreate("Shell.Application").Windows, VarSetCapacity(hWnd, 4, 0)
oWin := oWindows.FindWindowSW(0, "", SWC_DESKTOP := 8, ComObject(0x4003, &hWnd), SWFO_NEEDDISPATCH := 1)
vCount := oWin.Document.SelectedItems.Count
VarSetCapacity(vOutput, (260 + StrLen(vSep)) * vCount * 2)
For oItem in oWin.Document.SelectedItems
selection .= SubStr(oItem.path, 1, 3) = "::{" ? "" : """" oItem.path """" vSep
Return SubStr(selection, 1, -StrLen(vSep))
}
Code: Select all
If !FileExist(dest := "D:\Backup") {
FileCreateDir, %dest%
If ErrorLevel {
MsgBox, 48, Error, An error occurred while creating the directory. Aborting.
Return
}
}
tmstmp := SubStr(A_YYYY, 3) A_MM A_DD "-" A_Hour A_Min, n := 0
For each, file in A_Args {
SplitPath, file,,, ext
If (ext = "lnk")
FileGetShortcut, %file%, file
target := dest "\" tmstmp " " StrSplit(file, "\").Pop()
If Instr(FileExist(file), "D")
FileCopyDir, %file%, %target%
Else FileCopy , %file%, %target%
If ErrorLevel
MsgBox, 48, Error, An error occurred while copying the file.`n`n%file%
Else n++
}
MsgBox, 64, Done, Files copied: %n%
ExitApp
Code: Select all
^1::Run, % A_AhkPath " " A_ScriptDir "\backup.ahk " GetSelectedExplorerOrDesktop()
#IfWinActive ahk_class FreeCommanderXE.SingleInst.1 ahk_exe FreeCommander.exe
^1::Send ^2
#IfWinActive
GetSelectedExplorerOrDesktop() {
hwnd := WinExist("A")
WinGetClass, class, ahk_id %hwnd%
If (class ~= "Progman|WorkerW")
Return JEE_ExpGetSelDesktop(" ")
If (class ~= "(Cabinet|Explore)WClass")
For window in ComObjCreate("Shell.Application").Windows
If (window.hwnd = hwnd)
For item in window.document.SelectedItems
selection .= (selection ? " " : "") """" item.path """"
Return selection
}
JEE_ExpGetSelDesktop(vSep := "`n") { ; Get paths of selected desktop files
; https://www.autohotkey.com/boards/viewtopic.php?p=154836#p154836
oWindows := ComObjCreate("Shell.Application").Windows, VarSetCapacity(hWnd, 4, 0)
oWin := oWindows.FindWindowSW(0, "", SWC_DESKTOP := 8, ComObject(0x4003, &hWnd), SWFO_NEEDDISPATCH := 1)
vCount := oWin.Document.SelectedItems.Count
VarSetCapacity(vOutput, (260 + StrLen(vSep)) * vCount * 2)
For oItem in oWin.Document.SelectedItems
selection .= SubStr(oItem.path, 1, 3) = "::{" ? "" : """" oItem.path """" vSep
Return SubStr(selection, 1, -StrLen(vSep))
}
Code: Select all
^1::MsgBox, % A_AhkPath " " A_ScriptDir "\backup.ahk " GetSelectedExplorerOrDesktop()
Code: Select all
^F3::Run, % A_AhkPath " " A_ScriptDir "\links.ahk " GetSelectedExplorerOrDesktop()
Code: Select all
If !FileExist(dest := "M:\Links") {
FileCreateDir, %dest%
If ErrorLevel {
MsgBox, 48, Error, An error occurred while creating the directory. Aborting.
Return
}
}
For each, file in A_Args {
SplitPath, file,,, ext, fnBare
If (ext = "lnk") {
FileCopy, %file%, %dest%
If ErrorLevel
MsgBox, 48, Error, An error occurred while copying the file.`n`n%file%
} Else FileCreateShortcut, %file%, %dest%\%fnBare%.lnk
}
MsgBox, 64, Done, Done!
ExitApp
Code: Select all
SysGet, OutputVar, MonitorName
msgbox %OutputVar%