ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

DonationCoder.com Software > Finished Programs

DONE: Batch adjust shortcut targets

<< < (2/15) > >>

skwire:
Since I have a perfect set of shortcuts for the first set of images, it does seem reasonable to use it again and again, if the path-tweak can be made for each of the additional 11 sets.-nkormanik (June 22, 2012, 06:02 PM)
--- End quote ---

But that's what I'm saying -- just use File Punter again and create the additional rules you need.  Why create an entirely new program when File Punter can already do what you want?

Based off of your other thread, I gave you two example RegEx rules necessary to create your folders.  So, with 11 image sets total, you'd only have to create 22 rules total to generate all your needed shortcuts.  Really, what could be easier?

nkormanik:

What about the world lacking and needing "Batch adjust shortcut targets"???

4wd:
What about the world lacking and needing "Batch adjust shortcut targets"???-nkormanik (June 22, 2012, 06:50 PM)
--- End quote ---

But what you are doing is copying the files with a new name to a new destination.

It would be easier to create a new shortcut.

Is the folder structure for the images and the shortcuts the same?

If so then try this: BSC (nothing to do with cows)



Instructions:

Honestly, do you really want some?

Oh OK, it creates shortcuts in the Destination directory of whatever files are in the Source directory complete with directory structure - Bulk Shortcut Creator.

And yes, that is a cow icon :)

Also BSM in the other archive



BSC source:

--- Code: AutoIt ---#Region ;**** Directives created by AutoIt3Wrapper_GUI ****#AutoIt3Wrapper_Icon=cow.ico#AutoIt3Wrapper_Outfile=BSC.exe#AutoIt3Wrapper_UseUpx=n#AutoIt3Wrapper_Res_requestedExecutionLevel=asInvoker#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****#Include <GUIConstantsEx.au3>#include <EditConstants.au3>#include <ProgressConstants.au3>#Include <WindowsConstants.au3>#include <StaticConstants.au3>#include 'RecFileListToArray.au3' #Region ### START Koda GUI section ### Form=$Form1 = GUICreate("BSC v0.1", 349, 180, 192, 124)$Go = GUICtrlCreateButton("Go", 255, 137, 75, 25)GUICtrlSetTip(-1, 'Starts shortcut creation')$Button1 = GUICtrlCreateButton("Source", 280, 13, 50, 25)GUICtrlSetTip(-1, 'Select a source folder to create' & @CRLF & 'shortcuts for files')$Button2 = GUICtrlCreateButton("Dest", 280, 56, 50, 25)GUICtrlSetTip(-1, 'Select a destination folder to put' & @CRLF & 'the shortcuts in')$progress = GUICtrlCreateProgress(15, 96, 314, 17)$Input1 = GUICtrlCreateInput("", 16, 14, 258, 21, BitOR($GUI_SS_DEFAULT_INPUT,$ES_READONLY))$Input2 = GUICtrlCreateInput("", 17, 57, 256, 21, BitOR($GUI_SS_DEFAULT_INPUT,$ES_READONLY))$cRecurse = GUICtrlCreateCheckbox("Recurse", 152, 127, 66, 17)GUICtrlSetTip(-1, 'Recurse down through folder structure')$Input3 = GUICtrlCreateInput("*.*", 16, 139, 121, 21)GUICtrlSetTip(-1, 'Wildcard filter for files to' & @CRLF & 'create shortcuts for')$oDir = GUICtrlCreateCheckbox("One folder", 152, 151, 79, 17)GUICtrlSetTip(-1, 'Outputs shortcuts to destination folder,' & @CRLF & 'does not duplicate folder tree')GUICtrlSetState(-1, $GUI_DISABLE)GUISetState(@SW_SHOW)#EndRegion ### END Koda GUI section ###  While 1        $nMsg = GUIGetMsg()        Switch $nMsg                Case $cRecurse                        If (GUICtrlRead($cRecurse) = 1) Then                                GUICtrlSetState($oDir, $GUI_ENABLE)                        Else                                GUICtrlSetState($oDir, $GUI_UNCHECKED)                                GUICtrlSetState($oDir, $GUI_DISABLE)                        EndIf                Case $Button1                        $sPath = FileSelectFolder('Source folder:', '', 4)                        If @error = 1 Then $sPath = ''                        GUICtrlSetData($Input1, $sPath)                Case $Button2                        $dPath = FileSelectFolder('Destination folder:', '', 4)                        If @error = 1 Then $dPath = ''                        GUICtrlSetData($Input2, $dPath)                Case $Go                        If $sPath <> '' And $dPath <> '' Then                                $filter = GUICtrlRead($Input3)                                If (GUICtrlRead($cRecurse) = 1) Then                                        If Not (GUICtrlRead($oDir) = 1) Then                                                $output = _RecFileListToArray($sPath, '*', 2, 1, 0, 1, '*.lnk')                                                _DupeTree($sPath, $dPath)                                        EndIf                                        $output = _RecFileListToArray($sPath, $filter, 1, 1, 0, 1, '*.lnk')                                Else                                        $output = _RecFileListToArray($sPath, $filter, 1, 0, 0, 1, '*.lnk')                                EndIf                                _BSC($sPath, $dPath, (GUICtrlRead($oDir) = 1))                        EndIf                Case $GUI_EVENT_CLOSE                        Exit        EndSwitchWEnd  Func _BSC($src, $dest, $oneDir = 0)        $prg = 0        $diff = 100 / $output[0]        GUICtrlSetData($progress, $prg)        For $i = 1 To $output[0]                If $oneDir = 0 Then                        $temp = $dest & '\' & $output[$i]                Else                        $temp = $dest & StringMid($output[$i], StringInStr($output[$i], '\', 0, -1))                EndIf                FileCreateShortcut($src & '/' & $output[$i], $temp)                $prg += $diff                GUICtrlSetData($progress, $prg)        NextEndFunc  Func _DupeTree($src, $dest)        Local $i        For $i = 1 To $output[0]                If Not FileExists($dest & '\' & $output[$i]) Then DirCreate($dest & '\' & $output[$i])        NextEndFunc
BSM source:

--- Code: AutoIt ---#Region ;**** Directives created by AutoIt3Wrapper_GUI ****#AutoIt3Wrapper_Outfile=BSM.exe#AutoIt3Wrapper_UseUpx=n#AutoIt3Wrapper_Res_Fileversion=0.7.0.4#AutoIt3Wrapper_Res_Fileversion_AutoIncrement=y#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <GUIConstantsEx.au3>#include <EditConstants.au3>#include <ProgressConstants.au3>#include <WindowsConstants.au3>#include <StaticConstants.au3>#include <GuiStatusBar.au3>#include <GuiListView.au3>#include <ListViewConstants.au3>#include <Array.au3>#include <Date.au3>#include <File.au3> Global $inifile = StringLeft(@ScriptName, StringLen(@ScriptName) - 4) & '.ini'Global $iSRC = 'C:\', $iPRS = '(.*)', $iPRR = '\1', $iNRS = '(.*)', $iNRR = '\1', $iREC = False, $iTST = False _GetIni() #Region ### START Koda GUI section ### Form=$guiBSM = GUICreate("BSM v0.7", 354, 251)$Go = GUICtrlCreateButton("Go", 256, 193, 75, 25)GUICtrlSetTip(-1, "Starts shortcut modification")$Button1 = GUICtrlCreateButton("Folder", 280, 13, 50, 25)GUICtrlSetTip(-1, "Folder with shortcuts")$progress = GUICtrlCreateProgress(16, 152, 314, 17)$Input1 = GUICtrlCreateInput($iSRC, 16, 14, 258, 21, $GUI_SS_DEFAULT_INPUT) $cRecurse = GUICtrlCreateCheckbox("Recurse", 170, 194, 66, 17)If $iREC Then GUICtrlSetState($cRecurse, $GUI_CHECKED)GUICtrlSetTip(-1, "Recurse down through folder structure")$cTest = GUICtrlCreateCheckbox("Test", 90, 190, 56, 25)If $iTST Then GUICtrlSetState($cTest, $GUI_CHECKED)GUICtrlSetTip(-1, "Display test output") $labelRx = GUICtrlCreateLabel("RegEx", 19, 196, 36, 17)GUICtrlSetTip(-1, "Click to open browser at RegEx page")GUICtrlSetColor(-1, '0x000099') $Input2 = GUICtrlCreateInput($iPRS, 16, 80, 140, 21)GUICtrlSetTip(-1, "Path RegEx to search for")$Input4 = GUICtrlCreateInput($iPRR, 16, 110, 140, 21)GUICtrlSetTip(-1, "Path RegEx replacement text")$Input5 = GUICtrlCreateInput($iNRS, 190, 80, 140, 21)GUICtrlSetTip(-1, "Name RegEx to search for")$Input6 = GUICtrlCreateInput($iNRR, 190, 110, 140, 21)GUICtrlSetTip(-1, "Name RegEx replacement text")GUICtrlCreateLabel("Path of target", 52, 48, 70, 17)GUICtrlCreateLabel("Name of target", 215, 49, 75, 17)GUICtrlCreateLabel("Old", 160, 85, 25, 21, $SS_CENTER)GUICtrlCreateLabel("New", 160, 115, 25, 21, $SS_CENTER)$StatusBar1 = _GUICtrlStatusBar_Create($guiBSM)WinMove("BSM v0.7", '', IniRead($inifile, 'Main', 'XPos', 20), IniRead($inifile, 'Main', 'YPos', 20))GUISetState(@SW_SHOW)#EndRegion ### END Koda GUI section ### While 1        $nMsg = GUIGetMsg()        Switch $nMsg                Case $labelRx                        ShellExecute('http://www.autoitscript.com/autoit3/docs/functions/StringRegExp.htm')                Case $Button1                        $iSRC = FileSelectFolder('Select folder:', '', 4)                        If @error = 1 Then $iSRC = ''                        GUICtrlSetData($Input1, $iSRC)                Case $Go                        $iSRC = GUICtrlRead($Input1)                        If Not FileExists($iSRC) Then                                MsgBox(48, 'BSM Error', 'Not a valid path')                        Else                                $output = ''                                GUICtrlSetData($progress, 0)                                $iPRS = GUICtrlRead($Input2)                                $iPRR = GUICtrlRead($Input4)                                $iNRS = GUICtrlRead($Input5)                                $iNRR = GUICtrlRead($Input6)                                 If $iPRS = '' Then $iPRS = '(.*)'                                If $iPRR = '' Then $iPRR = '\1'                                If $iNRS = '' Then $iNRS = '(.*)'                                If $iNRR = '' Then $iNRR = '\1'                                 If $iSRC <> '' Then                                        _GUICtrlStatusBar_SetText($StatusBar1, 'Finding shortcuts')                                        Global $start = TimerInit()                                        If (GUICtrlRead($cRecurse) = 1) Then                                                $output = _FileListToArrayPlus($iSRC, "*.lnk", 1, 0, "", 2, True)                                        Else                                                $output = _FileListToArrayPlus($iSRC, "*.lnk", 1, 0, "", 2, False)                                        EndIf                                        If @error = 0 Or IsArray($output) Then                                                _BSM($output, (GUICtrlRead($cTest) = 1))                                        Else                                                MsgBox(48, 'BSM Error', 'No shortcuts found')                                        EndIf                                EndIf                        EndIf                Case $GUI_EVENT_CLOSE                        $wPos = WinGetPos("BSM v0.7")                        IniWrite($inifile, 'Main', 'Folder', $iSRC)                        IniWrite($inifile, 'Main', 'PathSearch', $iPRS)                        IniWrite($inifile, 'Main', 'PathReplace', $iPRR)                        IniWrite($inifile, 'Main', 'NameSearch', $iNRS)                        IniWrite($inifile, 'Main', 'NameReplace', $iNRR)                        IniWrite($inifile, 'Main', 'Recurse', (GUICtrlRead($cRecurse) = 1))                        IniWrite($inifile, 'Main', 'Test', (GUICtrlRead($cTest) = 1))                        IniWrite($inifile, 'Main', 'XPos', $wPos[0])                        IniWrite($inifile, 'Main', 'YPos', $wPos[1])                        Exit        EndSwitchWEnd  Func _BSM($files, $test = False)        Local $j = 1, $target, $targetPath, $newTarget, $newWorking, $prg = 1, $fDScut = 0, $fDLog = '', $fCScut = 0, $fCLog = '', $max, $nMsg2        Local $Percent, $Percent_prev, $interrupt = False        Dim $temp[101][2]         $max = $files[0]        Switch $test                Case True                        _GUICtrlStatusBar_SetText($StatusBar1, 'Creating test output')                        If $files[0] > 100 Then $max = 100                Case Else                        _GUICtrlStatusBar_SetText($StatusBar1, 'Processing ' & $max & ' shortcuts')        EndSwitch         GUICtrlSetData($Go, 'Stop')         For $i = 1 To $max                $nMsg2 = GUIGetMsg()                Switch $nMsg2                        Case $Go                                $interrupt = True                                ExitLoop                        Case Else                                $details = FileGetShortcut($files[$i])                                If $details[0] = "" Then                                        _ArrayDelete($files, $i)                                        $max -= 1                                        $i -= 1                                Else                                        $targetPath = StringLeft($details[0], StringInStr($details[0], '\', 0, -1) - 1)                                        $target = StringMid($details[0], StringInStr($details[0], '\', 0, -1) + 1)                                         $newTarget = StringRegExpReplace($targetPath, $iPRS, $iPRR) & '\' & StringRegExpReplace($target, $iNRS, $iNRR)                                        $newWorking = StringRegExpReplace($details[1], $iPRS, $iPRR)                                        Select                                                Case $test                                                        $temp[$i][0] = $details[0]                                                        $temp[$i][1] = $newTarget                                                        $temp[0][0] = $i                                                Case Else                                                        If FileDelete($files[$i]) Then                                                                If Not FileCreateShortcut($newTarget, $files[$i], $newWorking, $details[2], $details[3], $details[4], '', $details[5], $details[6]) Then                                                                        $fCScut += 1                                                                        $fCLog &= $files[$i] & @CRLF                                                                EndIf                                                        Else                                                                $fDScut += 1                                                                $fDLog &= $files[$i] & @CRLF                                                        EndIf                                        EndSelect                                        $Percent = Round(($i / $max) * 100, 0)                                        If $Percent <> $Percent_prev Then                                                GUICtrlSetData($progress, $Percent)                                                $Percent_prev = $Percent                                        EndIf                                EndIf                EndSwitch        Next         GUICtrlSetData($Go, 'Go')        If $interrupt Then                _GUICtrlStatusBar_SetText($StatusBar1, 'Interrupted')        Else                _GUICtrlStatusBar_SetText($StatusBar1, 'Finished: ' & Round(TimerDiff($start) / 1000, 1) & ' seconds')        EndIf         If $test Then                _ArrayBox($temp, 1, 'BSM Test Output', '|Old Shortcut Target|New Shortcut Target', True)        Else                If $fDScut > 0 Or $fCScut > 0 Or $interrupt Then                        _Log($fCLog, $fCScut, $fDLog, $fDScut, $files[0], $interrupt)                Else                        MsgBox(64, 'BSM Results', 'Total shortcuts: ' & $files[0] & @CRLF & 'No failures during Delete/Create')                EndIf        EndIf         GUICtrlSetData($progress, 0)EndFunc   ;==>_BSM  Func _Log($cl, $cc, $dl, $dc, $tot, $int)        Local $fLog = FileOpen(@TempDir & '\BSM.log', 138)        If $fLog = -1 Then                MsgBox(64, 'BSM Error', 'Unable to open log file:' & @CRLF & @TempDir & '\BSM.log' & @CRLF & 'for output')        Else                FileWrite($fLog, 'BSM results ' & _Now() & @CRLF & 'Total shortcuts: ' & $tot & @CRLF & @CRLF)                If $int Then FileWrite($fLog, '**** INTERRUPTED ****' & @CRLF & @CRLF)                FileWrite($fLog, 'Shortcuts that failed to be deleted: ' & $dc & @CRLF)                If $dc > 0 Then FileWrite($fLog, $dl & @CRLF & @CRLF)                FileWrite($fLog, 'Shortcuts that failed to be created: ' & $cc & @CRLF)                If $cc > 0 Then FileWrite($fLog, $cl & @CRLF & @CRLF)                FileClose($fLog)                ShellExecuteWait(@TempDir & '\BSM.log')        EndIfEndFunc   ;==>_Log  Func _GetIni()        If FileExists($inifile) Then                $iSRC = IniRead($inifile, 'Main', 'Folder', 'C:\')                $iPRS = IniRead($inifile, 'Main', 'PathSearch', '(.*)')                $iPRR = IniRead($inifile, 'Main', 'PathReplace', '\1')                $iNRS = IniRead($inifile, 'Main', 'NameSearch', '(.*)')                $iNRR = IniRead($inifile, 'Main', 'NameReplace', '\1')                $iREC = IniRead($inifile, 'Main', 'Recurse', 'False')                $iTST = IniRead($inifile, 'Main', 'Test', 'False')        EndIfEndFunc   ;==>_GetIni  ;===============================================================================;; Function Name:    _ArrayBox(); Description:      Shows an array in a GUI window.  Improved version of _ArrayDisplay; Parameter(s):     $Array - An array, 1d or 2d, 0-based or 1-based; $ArrayBase - 1 or 0 - tells what base the array is; $sTitle - the title to put on the output window; $Width, $Height, $Left, $Top - Set the size and position of the output window; Requirement(s):   $Array must be 1d or 2d.  If 1-based, then arraysize is assumed to be $Array[0] or $Array[0][0]; Return Value(s):  -1 = $Array is not an array, error=1; Author(s):        Mike Ratzlaff <[email protected]>; Revision: 20050620A;;===============================================================================;Func _ArrayBox(ByRef $Array, $ArrayBase = 1, $sTitle = 'Array Box', $sTemp = '', $sIni = False, $Width = 400, $Height = 200, $Left = -1, $Top = -1)        Dim $AllDone = 0, $msg, $i, $j, $ArrayDimensions = UBound($Array, 0)        Dim $hndForm_Main, $hndListView_Display         If $ArrayDimensions = 0 Then                SetError(1)                Return -1        EndIf         ;Setup        If $ArrayBase <> 0 Then $ArrayBase = 1        If $ArrayBase Then                Select                        Case $ArrayDimensions = 1                                $ArrayMax = $Array[0]                        Case $ArrayDimensions = 2                                $ArrayMax = $Array[0][0]                EndSelect        Else                $ArrayMax = UBound($Array, 1) - 1        EndIf         ;Create GUI        If $Height < 100 Then $Height = 100        If $Width < 100 Then $Width = 100        $hndForm_Main = GUICreate($sTitle, $Width, $Height, $Left, $Top, BitOR($WS_POPUP, $WS_CAPTION, $WS_SIZEBOX, $WS_MAXIMIZEBOX, $WS_EX_DLGMODALFRAME))         ;Create List Box        If $ArrayDimensions = 1 Then                If $sTemp = '' Then $sTemp = 'Index|Value'        ElseIf $ArrayDimensions = 2 Then                If $sTemp = '' Then                        $sTemp = 'Index'                        For $i = 0 To UBound($Array, 2) - 1                                $sTemp = $sTemp & '|' & $i                        Next                EndIf        EndIf        $hndListView_Display = GUICtrlCreateListView($sTemp, 0, 0, $Width, $Height - 24, BitOR($LVS_SHOWSELALWAYS, $LVS_SINGLESEL, $LVS_NOSORTHEADER))        GUICtrlSetResizing($hndListView_Display, BitOR($GUI_DockLeft, $GUI_DockTop, $GUI_DockRight, $GUI_DockBottom))        _GUICtrlListView_SetColumnWidth($hndListView_Display, 0, 36)         ;Create Controls, Show GUI        $hndButton_Close = GUICtrlCreateButton('&Close', $Width - 80, $Height - 24, 80, 24)        GUICtrlSetResizing($hndButton_Close, BitOR($GUI_DockRight, $GUI_DockBottom, $GUI_DockSize))        GUICtrlSetState($hndButton_Close, $GUI_DefButton)        If $sIni Then WinMove($sTitle, '', IniRead($inifile, 'Test', 'XPos', 20), IniRead($inifile, 'Test', 'YPos', 20), IniRead($inifile, 'Test', 'Width', 400), IniRead($inifile, 'Test', 'Height', 200))        GUISetState(@SW_SHOW, $hndForm_Main)         ;Display Array        Select                Case $ArrayDimensions = 1 ;1-Dimensional Array                        For $i = $ArrayBase To $ArrayMax                                GUICtrlCreateListViewItem($i & '|' & $Array[$i], $hndListView_Display)                        Next ;$i                Case $ArrayDimensions = 2 ;2-Dimensional Array                        For $i = $ArrayBase To $ArrayMax                                $sTemp = $Array[$i][0]                                For $j = 1 To UBound($Array, 2) - 1                                        $sTemp = $sTemp & '|' & $Array[$i][$j]                                Next ;$j                                GUICtrlCreateListViewItem('[' & $i & ']|' & $sTemp, $hndListView_Display)                        Next ;$i                Case Else ;Unhandled Type         EndSelect        _GUICtrlListView_SetColumnWidth($hndListView_Display, 1, $LVSCW_AUTOSIZE)        _GUICtrlListView_SetColumnWidth($hndListView_Display, 2, $LVSCW_AUTOSIZE)         ;Wait for user to close box        Do                $msg = GUIGetMsg()                Select                        Case $msg = $GUI_EVENT_CLOSE                                $AllDone = 1                        Case $msg = $hndButton_Close                                $AllDone = 1                EndSelect        Until $AllDone        Local $wPos = WinGetPos($sTitle)        If @error = 0 And $sIni Then                IniWrite($inifile, 'Test', 'XPos', $wPos[0])                IniWrite($inifile, 'Test', 'YPos', $wPos[1])                IniWrite($inifile, 'Test', 'Width', $wPos[2])                IniWrite($inifile, 'Test', 'Height', $wPos[3])        EndIf        GUIDelete($hndForm_Main)        Return 0EndFunc   ;==>_ArrayBox  ; #FUNCTION# =====================================================================================================================; _FileListToArrayPlus($sPath, $sInclude = "*", $iFlag = 0, $sExcludeFolder = "", $sExclude = "", $iPathType = 0, $bRecursive = False); Name...........:  _FileListToArray_Rec; Parameters ....:  $sPath: Folder to search;     $sInclude: String to match on (wildcards allowed, multiples delimited by ;);     $iFlag: Returned data type. 0 = Files and folders (default), 1 = Files only, 2 = Folders only;     $sExcludeFolder: List of folders to exclude from search (wildcards allowed, multiples delimited by ;);     $sExclude: List of filenames to exclude from search (wildcards allowed, multiples delimited by ;);     $iPathType: Returned data format. 0 = Filename only (default), 1 = Path relative to $sPath, 2 = Full path/filename;     $bRecursive: False = Search $sPath folder only (default), True = Search $sPath and all subfolders; Author ........:  Half the Autoit Community (Forum thread #96952);=================================================================================================================================== Func _FileListToArrayPlus($sPath, $sInclude = "", $iFlag = 0, $sExcludeFolder = "", $sExclude = "", $iPathType = 0, $bRecursive = False)        Local $sRet = "", $sReturnFormat = "", $interrupt = False        $sPath = StringRegExpReplace($sPath, "[\\/]+\z", "") & "\" ; ensure single trailing slash        If Not FileExists($sPath) Then Return SetError(1, 1, "")        ; Edit include files list        If $sInclude = "*" Then $sInclude = ""        If $sInclude Then                If StringRegExp($sInclude, "[\\/ :><\|]|(?s)\A\s*\z") Then Return SetError(2, 2, "") ; invalid characters test                $sInclude = StringRegExpReplace(StringRegExpReplace($sInclude, "(\s*;\s*)+", ";"), "\A;|;\z", "") ; Strip unwanted whitespace                $sInclude = StringRegExpReplace($sInclude, "[][$.+^{}()]", "\\$0"); Ignore special characters                $sInclude = StringReplace(StringReplace(StringReplace($sInclude, "?", "."), "*", ".*?"), ";", "$|") ; Convert ? to ., * to .*?, and ; to |                $sInclude = "(?i)\A(" & $sInclude & "$)"; case-insensitive, match from first char, terminate strings        EndIf        ; Edit exclude folders list        If $sExcludeFolder Then                $sExcludeFolder = StringRegExpReplace(StringRegExpReplace($sExcludeFolder, "(\s*;\s*)+", ";"), "\A;|;\z", "") ; Strip unwanted whitespace                $sExcludeFolder = StringRegExpReplace($sExcludeFolder, "[][$.+^{}()]", "\\$0"); Ignore special characters                $sExcludeFolder = StringReplace(StringReplace(StringReplace($sExcludeFolder, "?", "."), "*", ".*?"), ";", "$|") ; Convert ?=.  *=.*?  ;=|                $sExcludeFolder = "(?i)\A(?!" & $sExcludeFolder & "$)"; case-insensitive, match from first char, terminate strings        EndIf        ; Edit exclude files list        If $sExclude Then                $sExclude = StringRegExpReplace(StringRegExpReplace($sExclude, "(\s*;\s*)+", ";"), "\A;|;\z", "") ; Strip unwanted whitespace                $sExclude = StringRegExpReplace($sExclude, "[][$.+^{}()]", "\\$0"); Ignore special characters                $sExclude = StringReplace(StringReplace(StringReplace($sExclude, "?", "."), "*", ".*?"), ";", "$|") ; Convert ?=.  *=.*?  ;=|                $sExclude = "(?i)\A(?!" & $sExclude & "$)"; case-insensitive, match from first char, terminate strings        EndIf        ;   MsgBox(1,"Masks","File include: " & $sInclude & @CRLF & "File exclude: " & $sExclude & @CRLF & "Dir exclude : " & $sExcludeFolder)         If Not ($iFlag = 0 Or $iFlag = 1 Or $iFlag = 2) Then Return SetError(3, 3, "")         Local $sOrigPathLen = StringLen($sPath), $aQueue[64] = [1, $sPath], $iQMax = 63        While $aQueue[0]                $WorkFolder = $aQueue[$aQueue[0]]                $aQueue[0] -= 1                $search = FileFindFirstFile($WorkFolder & "*")                If @error Then ContinueLoop                Switch $iPathType                        Case 1 ; relative path                                $sReturnFormat = StringTrimLeft($WorkFolder, $sOrigPathLen)                        Case 2 ; full path                                $sReturnFormat = $WorkFolder                EndSwitch                While 1                        $nMsg2 = GUIGetMsg()                        Switch $nMsg2                                Case $Go                                        $interrupt = True                                        ExitLoop                                Case Else                                        $file = FileFindNextFile($search)                                        If @error Then ExitLoop                                        If @extended Then ; Folder                                                If $sExcludeFolder And Not StringRegExp($file, $sExcludeFolder) Then ContinueLoop                                                If $bRecursive Then                                                        If $aQueue[0] = $iQMax Then                                                                $iQMax += 128                                                                ReDim $aQueue[$iQMax + 1]                                                        EndIf                                                        $aQueue[0] += 1                                                        $aQueue[$aQueue[0]] = $WorkFolder & $file & "\"                                                EndIf                                                If $iFlag = 1 Then ContinueLoop                                                $sRet &= $sReturnFormat & $file & "|"                                        Else ; File                                                If $iFlag = 2 Then ContinueLoop                                                If $sInclude And Not StringRegExp($file, $sInclude) Then ContinueLoop                                                If $sExclude And Not StringRegExp($file, $sExclude) Then ContinueLoop                                                $sRet &= $sReturnFormat & $file & "|"                                        EndIf                        EndSwitch                WEnd                FileClose($search)                If $interrupt Then ExitLoop        WEnd        If Not $sRet Then Return SetError(4, 4, "")        Return StringSplit(StringTrimRight($sRet, 1), "|")EndFunc   ;==>_FileListToArrayPlus

nkormanik:

BSC looks like a nice little copying program good to keep on hand.  Thanks.

The structure of the shortcuts within subdirectories is different from the "Image Pool."

The motivation behind focusing on shortcuts was to avoid having to copy the image files themselves, over and over and over again, to all sorts of locations.  Better to have a zillion shortcuts, paired up in various ways, all pointing to the repository of images.  Easier to mix and match shortcuts.

Let's assume I'll create just one single "Image Pool" folder.  All images bunched together.  Over 100,000 images.

There will be 12 major groups of images within that "Image Pool" folder: 50501, 50502, 50503, etc.

Using "File Punter" I was able to create 1 of 12 sets of shortcuts to certain of those images (50501s).  So I still have 11 more sets of shortcuts to create.

If only one "Image Pool"...  Then the only part of the shortcuts which will change would be the first part of the target file name.  The path would be identical:

...path\50501_20104_21901.png.lnk  (belongs to the first set of shortcuts)
...path\50502_20104_21901.png.lnk  (belongs to the second set of shortcuts)
...path\50503_20104_21901.png.lnk  (belongs to the third set of shortcuts)
...path\etc.

I wish I could simply use the perfect set of shortcuts already created (for the 50501 set), make the ONE CHARACTER TWEAK in each filenme, and use these for the second shortcut set.  And on and on.  Through all 12 sets.

Appears not so easy to "Batch adjust shortcut targets", unfortunately.

=====

By the way, another approach different from shortcuts might be to put the filenames into a database, and have the database do the pairing, mixing, matching of files.  But, alas, I have even less experience in that area.  At least pairing up shortcuts makes sense to me.

4wd:
OK, maybe this slightly modified version will get there:

Added:

* Basic wildcard filter for file matching.
* Option to output shortcuts to one directory.
So you should be able to put all your images in one directory, enter 50503*.* in the filter field and have a load of shortcuts for matching files created in another directory sans directory structure.

...so goes the theory.

Absolutely no error trapping or any of that kind of malarkey  - you put something stupid in the filter field it's your fault. :)



See above for archive.

Added mouseover tooltips.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version