![]() The biggest advantage is that jacky's version will work on much older versions of XY. I believe jacky wrote that script before Don had blessed us with global variables and certainly before the while loop, so jacky had to do everything using multiple sub-scripts with recursion and had to read/write values to INI files (or the script file itself) to communicate data between the sub-scripts. But what about the other way around? Are there benefits to Jacky's script over this one?I can't speak for the actual script content, but a lot of jacky's script was to get around the limitations of XY's scripting language. Obviously, the number of files that can be renamed as well as the script's brevity are some advantages your script has over Jacky's. Mesh wrote:I'm amazed that your script is so much shorter than the original one listed here. Setkey 1, "FileExists", "Ensure", "tmp.ini" Status "$nb_renamed ".(($nb_renamed = 1) ? "item" : "items")." renamed, $nb_untouched left untouched" we only continue if there is a new name and an old name Setkey $nb_renamed, "NbRenamed", "MultiItemRename", "tmp.ini" adds 1 if old & new names are different AND not a tmp rename (which will be counted later) Getkey $nb_renamed, "NbRenamed", "MultiItemRename", "tmp.ini" Setkey $nb_untouched, "NbUntouched", "MultiItemRename", "tmp.ini" ![]() $nb_untouched = 0 + (($new_name = $old_name_only) ? $nb_untouched + 1 : $nb_untouched) adds 1 if old & new names are the same Getkey $nb_untouched, "NbUntouched", "MultiItemRename", "tmp.ini" $new_name = ($new_name = "") ? $old_name_only : $new_name in case no new name was specified, we use the old name and add prefix for now to avoid collision Load ($p > -1) ? $script_fix : 'incr $void ',s $script_fix = 'getkey $old_names, "OldNames", "MultiItemRename", "'.$path.'\tmp.ini" getkey $new_names, "NewNames", "MultiItemRename", "'.$path.'\tmp.ini" setkey $old_names."'.$old_path.'\'.$new_name.'.~mir|", "OldNames", "MultiItemRename", "'.$path.'\tmp.ini" setkey $new_names."'.$new_name.'|", "NewNames", "MultiItemRename", "'.$path.'\tmp.ini" ' "fixing" script: adds "real" rename at the end of the queue: the temp new name (with prefix) as extra old name, with the real new name as new name ![]() locate an item with the new name in the items to be renamed next Substr $new_names, $new_names, $new_pos + 1 ![]() Substr $old_names, $old_names, $old_pos + 1 Substr $new_name, $new_names, 0, $new_pos Getkey $new_names, "NewNames", "MultiItemRename", "tmp.ini" Substr $old_name, $old_names, 0, $old_pos Getkey $old_names, "OldNames", "MultiItemRename", "tmp.ini" we only start renaming loop if there is a new name and an old name Setkey $new_names, "NewNames", "MultiItemRename", "tmp.ini" Input $new_names, "Enter the new names for selected items, one name per line", $old_names, m ![]() Setkey $old_names, "OldNames", "MultiItemRename", "tmp.ini" $old_names = getinfo("SelectedItemsPathNames", "|") Msg "Nothing selected in the file list." Sub (getinfo("CountSelected") = 0) ? "_mirNoSel" : "_mirStart" ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |