Clone Date [button snippet]

Discuss and share scripts and script files...
Post Reply
eil
Posts: 1875
Joined: 13 Jan 2011 19:44

Clone Date [button snippet]

Post by eil »

This button is made solely for my workflow, which is heavily based on Modified date sorting = or more precisely "placing items in proper order one after other" (via changing their M date).
If anybody finds this useful or would wish to modify - fell free. Actually, I'm sharing this mainly just in case, not lose it.

Button works in 2 phases: Empty state(1) and Stored state(2), which have different action for all 3 mouse clicks (Left, Right, Middle).

L1 stores selected item's path in perm var.
L2 clones source Modified date into target's M date +2sec.
IF multiple items selected:
- L1 warns that only one must be selected;
- L2 will show prompt for user to put targets in proper order = top will get source M date +2sec, next +4sec and so on.

R1 shows menu to pick one date from source = date directly stored in perm var.
R2 shows same menu, allowing to choose which One date would be set. The position user picked on R1 is marked bold - to remind what type of date was stored = user can set it to any target's date.
Unlike L2 automatics, R2 provides everything configurable, which is especially useful when multiple items selected:
- prompt to select date Shift (can be negative or left empty);
- IF Shift was set — prompt to additionally select Shift Step which applies to targets after first one, to make consecutive steps in a date change (can be negative or left empty);
-- IF Shift + Shift Step set — user gets prompt to put targets in proper order (for Steps);
-- IF Shift set, but Shift Step left empty — all targets get same date Shift;
-- IF both left empty — all targets get same date as source.

Extra combination L1 + R2 works similar to R2 described above, but menu gets additional choice to clone All 3 dates from source.(with same prompt
options)
3 dates menu.png

M1 shows reminder with short hints of actions description.
M2 show menu with 2 self-explanatory lines: Clear date stored and View date stored.

Icons for button.
clondate(24,512).zip
Snippet:

Code: Select all

Snip: CTB 1
  XYplorer 26.80.0410, 25.12.2025 3:07:16
Action
  NewUserButton
Name
  Clone Date
Icon
  clonedate.png
ScriptL
  $itemCheck = strpos("<selitems |>", "|");    // -1= single item; else multiple
    perm $srcDate;
  
  //// Date is clear, 1 run
    if ($srcDate == "") {
      if ($itemCheck != "-1") {
        msg "One item must be selected!";
      } else {
      $srcDate = <curitem>; 
      trayballoon $srcDate;
      ctbstate(1);
      //ctbicon("clonedate.png*#6C6C96");
      status "Date picked.", , "progress";
      }
    } else {
  
  //// Date is picked, 2 run
      if (strpos($srcDate, "<crlf>") != "-1") { 
        msg "Direct date was picked.<br>Use R-menu to set one.", , , "! Error !";
        break;
      } 
      $dateType = "m";
      //$Shift = input("Enter date Shift value.", "Format:: number_space_term<crlf>Number:: digits, can be negative.<crlf>Term::  s=sec  n=min  h=hour  d=day  w=week  m=month  y=year<crlf><crlf>Make empty or Cansel for no Shift = Clone date.", "2 s", , "", , , "2 s|-2 s");
      $Shift = "2 s";
  
  // IF Shift was set/not empty = propose consecutive shift+steps
      if (($Shift != "") && ($itemCheck != -1)) {
        //$ShiftStep = input("Consecutive date Shift?.", "Each consecutive item's date = Shift+Step.<crlf>Step can be negative.<crlf><crlf>Keep empty or Cansel for no consecutive Steps.<crlf>[Only main Shift would be used for all items.]", "", , "", , , "1|2|3|-1|-2|-3");
        $ShiftStep = "2";
      }
  
  // IF Shift was set/not empty + consecutive steps added
      if (($Shift != "") && ($itemCheck != -1) && ($ShiftStep != "")) {
          $trgtList = inputselect("Re-Order items for date change::<crlf>Top = +1 date shift.<crlf>Bot = +Max date shift.", "<selitems |>", ,1+2+16+512+32768);
  
          $ShiftNumb = gettoken($Shift, 1, " "); 
          $ShiftTerm = gettoken($Shift, 2, " "); 
          foreach($item, $trgtList, "|") {
            timestamp $dateType, "$srcDate", $item, "*", $Shift; 
            $ShiftNumb = $ShiftNumb + $ShiftStep;
            $Shift = $ShiftNumb . " " . $ShiftTerm;
          }
      } else {
  
  // Similar shift/date for all
          $trgtList = "<selitems |>";  
          timestamp "m", "$srcDate", $trgtList, "*", $Shift; 
        }
      unset $srcDate;
      ctbstate(0);
      //ctbicon("clonedate.png");
      status "Date cloned.", , "ready";
    }
ScriptR
  $itemCheck = strpos("<selitems |>", "|");    // -1= single item; else multiple
    perm $srcDate;
  
    $iconG = "data:png:base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QAfADXAABNp5UEAAAACXBIWXMAAC4jAAAuIwF4pT92AAAAB3RJTUUH6QwCFSEXh8c03wAAABl0RVh0Q29tbWVudABDcmVhdGVkIHdpdGggR0lNUFeBDhcAAAC5SURBVDjLlVPbDcQgDHMq1ugAN1i3QPmobgsG6wAeJPdx5ZpC6LWWkAzmkThBcMAcF/QI9WkXDABI+s3tiHQkAMgb8H4d1+etf77V63zym+Z5xhUiPV296jHSpTHnKWSq5pCEqt7mXQr/4PNfluWcgqoOD67r2nngKiIAYCSNpKlqxwFY3r6j5V0Zo7BH7u/rlgCglPITPI9Qw68XJ29KKeXE7/TCZQokTy0cRCK3G2lUBXnQdeF3/gC7A32T0g0yaQAAAABJRU5ErkJggg==";
    $iconY = "data:png:base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QAfADXAABNp5UEAAAACXBIWXMAAC4jAAAuIwF4pT92AAAAB3RJTUUH6QwCFSEq3694zgAAABl0RVh0Q29tbWVudABDcmVhdGVkIHdpdGggR0lNUFeBDhcAAAC+SURBVDjLlVPLDcUgDHMq1ugmb53OwC2H3t4MrMMmXgMpvZS+tEBfawnJYD6JEwQ/mOOCFl192gUDAJJ+83X0dAQAKDkifL7H9SXH5vmrXueT3zTPM+7Q08Pdqx4jXS7mvIVM1RySUNXHvEnhH3z+y7KcU1DV4cF1XRsPXEUEAIykkTRVbTgAKzlaybHhTRl7YY/c39ctAEBK6RA876GGXy8O3pSU0ok/6YXbFEieWrgTiTxupFEV5EXXdb/zBn0mi8+Ipi1VAAAAAElFTkSuQmCC";
    $iconR = "data:png:base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QAfADXAABNp5UEAAAACXBIWXMAAC4jAAAuIwF4pT92AAAAB3RJTUUH6QwCFSIBWD7STQAAABl0RVh0Q29tbWVudABDcmVhdGVkIHdpdGggR0lNUFeBDhcAAAC8SURBVDjLlVPBDYQwDHNQ1+DVZboIa+TBGl3klrmXBwkfOFqScmAJyeC0SZwgOGENF3iE+rQLBgAk2+DrE+lIAGAlQz7fM1XJLv1VP96nNmieZ9wh0tNd1s6AgS4Xc95CpsMcklDVx9y18A9t/8uy9C2o6vDguq7Og2YiAgBG0kiaqjoOwKxks5Idd2OMyh65v3+3BAC11p/Q8tD2vfzj4tSaUmvt+JNduG2BZLfCQSXyeJFGU5AXWxf+zhuiQ4Y08pod9gAAAABJRU5ErkJggg==";
    $iconB = "data:png:base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QAfADXAABNp5UEAAAACXBIWXMAAC4jAAAuIwF4pT92AAAAB3RJTUUH6QwCFSIW2+1XigAAABl0RVh0Q29tbWVudABDcmVhdGVkIHdpdGggR0lNUFeBDhcAAAC4SURBVDjLlVPBDYQwDHNQ12CPLsSNkQdjtAvdHh4kfOgRSMuBJSSD0yZxguCAOS6I6OrTLhgAkPTB16enIwFALobv50iai4X0V729Tz5onmfcoaenu6weI10u5ryFTM0cklDVxzy08A++/2VZzi2o6vDguq7BAzcRAQAjaSRNVQMHYLmY5WKBhzH2yh65v3+3BAC11p/geQ+t/HZx8qbUWk/8yS7ctkDytMKdSuTxIo2mIC+2rvs7b4zYiQVoPdOqAAAAAElFTkSuQmCC";
    
  //// Date is clear, 1 run
    if ($srcDate == "") {
      if ($itemCheck != "-1") {
        msg "One item must be selected!";
        break;
      } else {
        $dateType = popupmenu("Copy only Created;c;$iconG|Copy only Modified;m;$iconY|Copy only Accessed;a;$iconR", , , , , , , , "None");
        if ($dateType == "None") { break;}
        $srcDate = filetime(<curitem>, $dateType);
        $srcDate = $srcDate . <crlf> . $dateType;
      }
      trayballoon $srcDate;
      ctbstate(1);
      //ctbicon("clonedate.png*#6C6C96");
      status "Date picked.", , "progress";
    } else {
  
  //// Date is picked, 2 run
  // Mark menu item by dateType previously selected
      switch (gettoken($srcDate, 2, <crlf>)) {
        case "c":
          $markC = 1;
          break;
        case "m":
          $markM = 1;
          break;
        case "a":
          $markA = 1;
          break;
        default:
          $markCMA = 1;
          break;
      }
  // IF direct date was picked
      if (strpos($srcDate, "\") == "-1") {
        $dateType = popupmenu("Set only Created;c;$iconG;$markC|Set only Modified;m;$iconY;$markM|Set only Accessed;a;$iconR;$markA", , , , , , , , "None");
      } else {
  // IF item was picked (+3 dates)
        $dateType = popupmenu("Set only Created;c;$iconG;$markC|Set only Modified;m;$iconY;$markM|Set only Accessed;a;$iconR;$markA|-|Set all 3 Dates;cma;$iconB;$markCMA", , , , , , , , "None");
      }
      if ($dateType == "None") { break;}
  
      $Shift = input("Enter date Shift value.", "Format:: number_space_term<crlf>Number:: digits, can be negative.<crlf>Term::  s=sec  n=min  h=hour  d=day  w=week  m=month  y=year<crlf><crlf>Make empty or Cansel for no Shift = Clone date.", "2 s", , "", , , "2 s|-2 s");
  
  // IF Shift was set/not empty = propose consecutive shift+steps
      if (($Shift != "") && ($itemCheck != -1)) {
        $ShiftStep = input("Consecutive date Shift?.", "Each consecutive item's date = Shift+Step.<crlf>Step can be negative.<crlf><crlf>Keep empty or Cansel for no consecutive Steps.<crlf>[Only main Shift would be used for all items.]", "", , "", , , "1|2|3|-1|-2|-3");
      }
  
  // IF Shift was set/not empty + consecutive steps added
      if (($Shift != "") && ($itemCheck != -1) && ($ShiftStep != "")) {
          $trgtList = inputselect("Re-Order items for date change::<crlf>Top = +1 date shift.<crlf>Bot = +Max date shift.", "<selitems |>", ,1+2+16+512+32768);
  
          $ShiftNumb = gettoken($Shift, 1, " "); 
          $ShiftTerm = gettoken($Shift, 2, " "); 
          foreach($item, $trgtList, "|") {
            timestamp $dateType, gettoken($srcDate, 1, "<crlf>"), $item, "*", $Shift; 
            $ShiftNumb = $ShiftNumb + $ShiftStep;
            $Shift = $ShiftNumb . " " . $ShiftTerm;
          }
      } else {
  
  // Similar shift/similar date for all items
          $trgtList = "<selitems |>";  
          timestamp $dateType , gettoken($srcDate, 1, "<clrf>"), $trgtList, "*", $Shift; 
      }
      unset $srcDate;
      ctbstate(0);
      //ctbicon("clonedate.png");
      status "Date cloned.", , "ready";
    }
ScriptM
  if ((isset($srcDate) == 1) && ($srcDate != "")) {
    $menu = popupmenu("Clean date variable;clean;:del|-|Show date variable;show;:shellprops", , , , , , , , "None");
    switch ($menu) {
      case "clean":
        unset $srcDate;
        ctbstate(0);
        //ctbicon("clonedate.png");
        status "Date cleared.", , "ready";
        break;
      case "show":
        echo $srcDate, "Variable contain:";
        break;
      case "None": break;
      default: "None";
    }  
   } else {
     msg "L1 = Pick item (path)<br>L2 = Set Modified date<br><br>R1 = Pick single date<br>R2 = Set single date<br><br>L1+R2 = Set all 3 dates<br><br>M2 = Clear date variable<br>M2 = View date variable", , , "Information";
   }
FireClick
  0
To see the attached files, you need to log into the forum.
Win 7 SP1 x64 100% 1366x768|1900x1080

eil
Posts: 1875
Joined: 13 Jan 2011 19:44

Re: Clone Date [button snippet]

Post by eil »

An update. Internally, previous was ver 4, this is ver 7.

- More safety belts and polishes
- Button background color changes similar to menu icons = needs ver 28.10.0500+ (button works for lower ver of XY, just no background change feature)
- L1>L2 operation is fully automatic and changes items Modified date by Shift/Step +2sec
- Ctrl+L2 allows to change Shift/Step to -2sec (same automatic)
- R2 gets full proper 3 dates copy option = unlike L1 "link" to Source item, R1>3 Dates stores dates and doesn't need Source (it can be deleted or any other operation that would change its dates)
--- On R1 > 3 Dates > R2 has no Menu shown = it's automatic 3>3 dates operation (only Shift+Steps can be set if multiple target items)
--- By default R1 > 3 Dates > R2 has Shift set as 0(empty) = so making a full date-clone of Source is fast and comfortable
- Consecutive Steps window for items re-order now allows easy changing "direction" of the operation
--- Before it was strict Top to Bottom, now there is a SOURCE item that can be dragged top or bottom(!doesn't work elsewhere/in between), shaping which way the order goes
--- Items are always shown "As Is in the List"(based on current Sort), so moving SOURCE allows to visualize where Source item would be after operation
--- Additionally, if List is sorted by Date(any), the SOURCE is smart-pre-placed at top/bottom (for convenience, presuming where operation orientation would go, based on Sort + Shift)

Code: Select all

Snip: CTB 1
  XYplorer 28.10.0500, 26.01.2026 0:28:42
Action
  NewUserButton
Name
  Clone Date
Icon
  clonedate.png
ScriptL
  perm $P_CLONEDATE_SRC;
    if ((get("FocusedControl") != "L") || (<selitems |> == "")) {
      msg "List is not in Focus<crlf>OR<crlf>Nothing is Selected!", , , "! Error !";
      end (1);
    }
    $Items = <selitems |>;
    $itemCheck = gettokenindex("|", $Items, "\", "wc");  //strpos($Items, "|");
  
  //// Date is clear, 1 run
    if ($P_CLONEDATE_SRC == "") {
      if ($itemCheck != "0") {     // 0= single item; else multiple
        msg "One item must be selected!";
      } else {
      $P_CLONEDATE_SRC = $Items;  //<curitem>; 
      trayballoon $P_CLONEDATE_SRC;
      ctbstate(1);
      if (<xyver> >= "28.10.0500") { ctbicon("*#C800FF,r") };
      status "Date picked.", , "progress";
      }
    } else {

  
  //// Date is picked, 2 run
  // Check for R1+L2 mode not possible
      if (strpos($P_CLONEDATE_SRC, "<crlf>") != "-1") { 
        msg "Direct date was picked.<br>Use R-menu to set Date.", , , "! Error !";
        break;
      }
    //Check L1 source item still exists
      if (exists($P_CLONEDATE_SRC) == "0") {
        if (confirm("Source item is missing.<br>Clean date variable?", , , 4 + 16) == "1") { 
          unset $P_CLONEDATE_SRC;
          ctbstate(0);
          if (<xyver> >= "28.10.0500") { ctbicon("* ") };
          status "Date cleared.", , "ready";
          end (1);
        }
        end (1);
      } elseif ($Items == $P_CLONEDATE_SRC) {
        if (confirm("Target and Source is the same.<br>Continue?", , , 4 + 48) == "0") {
          end (1);
        }
      }
      $dateType = "m";
      $Shift = (get("Trigger", "callshift") == 2) ? "-2 s" : "2 s";
  
  // IF Shift was set/not empty = propose consecutive Shift+Steps
      if (($Shift != "") && ($itemCheck != 0)) {
        $Step = (get("Trigger", "callshift") == 2) ? "-2" : "2";
      }
 
  // IF Shift was set/not empty + consecutive Steps added
      if (($Shift != "") && ($itemCheck != 0) && ($Step != "")) {
        $Sort = get("Sort");  //gettoken(get("Sort"), 1, ",");
        $SortAD = gettoken($Sort, 2, ",");  //gettoken(get("Sort"), 2, ",");
        $sortArrow = (gettoken($Sort, 2, ",") == "d") ? "▲" : "▼";
        $ShiftPN =  (strpos($Shift, "-") == "-1") ? "+" : "-";
        //if ((($SortAD == "d") && ($ShiftPN == "+")) || (($SortAD == "a") && ($ShiftPN == "-")))  
  // Some combinations of Date sorting = move Source to Bot for comfort
        if ((($Sort == "Created,d") && ($ShiftPN == "+")) || (($Sort == "Created,a") && ($ShiftPN == "-")) || (($Sort == "Modified,d") && ($ShiftPN == "+")) || (($Sort == "Modified,a") && ($ShiftPN == "-")) || (($Sort == "Accessed,d") && ($ShiftPN == "+")) || (($Sort == "Accessed,a") && ($ShiftPN == "-"))) { 
          $Items = $Items . "|[SOURCE]";    // d+=up/rvrt    а-=up/rvrt
          //$Items = formatlist("<selitems |>", "v");
        } else { 
          $Items = "[SOURCE]|" . $Items;    // d-=dwn/no-rvrt   а+=dwn/no-rvrt
        }
        $trgtList = inputselect("[Sorting] :: $Sort :: $sortArrow    [Shift] :: $Shift    [Step] :: $Step<crlf><crlf>Items presented AS IS in the List. Re-Order if needed.<crlf>Closest to SOURCE: +1 date change.<crlf>Farest from SOURCE: +Max date change.<crlf><crlf>[Move SOURCE to Top/Bot for easy changing Steps direction.]", $Items, ,1+2+16+512+32768, , "600", "600", "Shift with consequtive Steps", , ":syncscroll");
  
  // Check SOURCE proper position after InputSelect
        if ((gettoken($trgtList, 1, "|") != "[SOURCE]") && (gettoken($trgtList, -1, "|") != "[SOURCE]")) {
          msg "SOURCE must be Top or Bottom.<br>Not Between items or Unchecked.<br>Try again.", , , "! Error !";
          end (1);
        } elseif (gettoken($trgtList, -1, "|") == "[SOURCE]") {
          $trgtList = formatlist($trgtList, "v");
        } 
        $trgtList = replace($trgtList, "[SOURCE]|", , 1, , 1);
  
        $ShiftNumb = gettoken($Shift, 1, " "); 
        $ShiftTerm = gettoken($Shift, 2, " "); 
        foreach($item, $trgtList, "|") {
          timestamp $dateType, "$P_CLONEDATE_SRC", $item, "*", $Shift; 
          $ShiftNumb = $ShiftNumb + $Step;
          $Shift = $ShiftNumb . " " . $ShiftTerm;
        }
      } else {
  
  // ELSE similar Shift/date for all
          $trgtList = $Items;  
          timestamp "m", "$P_CLONEDATE_SRC", $trgtList, "*", $Shift; 
      }
      unset $P_CLONEDATE_SRC;
      ctbstate(0);
      if (<xyver> >= "28.10.0500") { ctbicon("* ") };
      status "Date cloned.", , "ready";
    }



ScriptR
  perm $P_CLONEDATE_SRC;
    if ((get("FocusedControl") != "L") || (<selitems |> == "")) {
      msg "List is not in Focus<crlf>OR<crlf>Nothing is selected!", , , "! Error !";
      end (1);
    }
    $Items = <selitems |>;
    $itemCheck = gettokenindex("|", $Items, "\", "wc");  //strpos($Items, "|");
    
  //// Date is clear, 1 run
    if ($P_CLONEDATE_SRC == "") {
      if ($itemCheck != "0") {     // 0= single item; else multiple
        msg "One item must be selected!";
        break;
      } else {
        sub "loadicons";
        $dateType = popupmenu("Copy only Created;c;$iconG|Copy only Modified;m;$iconY|Copy only Accessed;a;$iconR|Copy all Dates;d;$iconB", , , , , , , , "None");
        if ($dateType == "None") { end(1);}
        if ($dateType == "d") {
          $P_CLONEDATE_SRC = filetime(<curitem>, "c") . "|" . filetime(<curitem>, "m") . "|" . filetime(<curitem>, "a");
          $P_CLONEDATE_SRC = $P_CLONEDATE_SRC . <crlf> . $dateType;
        } else {
          $P_CLONEDATE_SRC = filetime(<curitem>, $dateType);
          $P_CLONEDATE_SRC = $P_CLONEDATE_SRC . <crlf> . $dateType;
        }
      }
      trayballoon $P_CLONEDATE_SRC;
      ctbstate(1);
      if (<xyver> >= "28.10.0500") {
        switch (gettoken($P_CLONEDATE_SRC, 2, <crlf>)) {
          case "c":
            ctbicon("*#00D700,r"); //green=created
            break;
          case "m":
            ctbicon("*#FCC400,r"); //yellow=modified
            break;
          case "a":
            ctbicon("*#FF4800,r"); //red=accesed
            break;
          case "d":
            ctbicon("*#389AFF,r"); //blue=duplicate 3
            break;
          default:
            ctbicon("*#C800FF,r"); //violet=linked item
            break;
        }
      }
      status "Date picked.", , "progress";
    } else {

  
  //// Date is picked, 2 run
  // Check for L1+R2 mode = source item must still exist
      if ((strpos($P_CLONEDATE_SRC, "\") != "-1") && (exists($P_CLONEDATE_SRC) == "0")) {
        if (confirm("Source item is missing.<br>Clean date variable?", , , 4 + 16) == "1") { 
          unset $P_CLONEDATE_SRC;
          ctbstate(0);
          if (<xyver> >= "28.10.0500") { ctbicon("* ") };
          status "Date cleared.", , "ready";
          end(1);
        }
        end(1);
      } elseif ($Items == $P_CLONEDATE_SRC) {
        if (confirm("Target and Source is the same.<br>Continue?", , , 4 + 48) == "0") {
          end (1);
        }
      } 
  // Mark menu item by dateType previously selected
      switch (gettoken($P_CLONEDATE_SRC, 2, <crlf>)) {
        case "c":
          $markC = 1;
          break;
        case "m":
          $markM = 1;
          break;
        case "a":
          $markA = 1;
          break;
        default:  // L1 or R1(dup)
          $markB = 1;
          break;
      }

      sub "loadicons";
  // IF linked item (L1)
      if (strpos($P_CLONEDATE_SRC, "\") != "-1") {
        $dateType = popupmenu("Set only Created;c;$iconG;$markC|Set only Modified;m;$iconY;$markM|Set only Accessed;a;$iconR;$markA|-|Set all 3 Dates;cma;$iconB;$markB", , , , , , , , "None");
      } elseif (gettoken($P_CLONEDATE_SRC, 2, "<crlf>") == "d") {
  // IF 3 dates (R1 3 dates dup)
        $dateType = "d";
      } else {
  // IF direct date (R1)
        $dateType = popupmenu("Set only Created;c;$iconG;$markC|Set only Modified;m;$iconY;$markM|Set only Accessed;a;$iconR;$markA", , , , , , , , "None");
      }
      if ($dateType == "None") { end(1);}

  // IF 3 dates(dup) >> def-proposed Shift is empty for comfort 
      $iniShift = ($dateType == "d") ? "" : "2 s";
      $iniStep = ($dateType == "d") ? "" : "2";

      $Shift = input("Enter date Shift value.", "Format:: number_space_term<crlf>Number:: digits, can be negative.<crlf>Term::  s=sec  n=min  h=hour  d=day  w=week  m=month  y=year<crlf><crlf>Leave empty for No Shift = Clone date.", $iniShift, , , , , "2 s|-2 s");
  
  // IF Shift was set/not empty >> consecutive Steps
      if (($Shift != "") && ($itemCheck != "0")) {
        $Step = input("Consecutive date Shift?", "Each consecutive item's date = Shift+Step.<crlf>Step can be negative.<crlf><crlf>Leave empty for No consecutive Steps.<crlf>[Only main Shift would be used for all items.]", $iniStep, , , , , "2|-2");
      }
 
  // IF Shift was set/not empty + consecutive Steps added
      if (($Shift != "") && ($itemCheck != 0) && ($Step != "")) {
        $Sort = get("Sort");  //gettoken(get("Sort"), 1, ",");
        $SortAD = gettoken($Sort, 2, ",");  //gettoken(get("Sort"), 2, ",");
        $sortArrow = (gettoken($Sort, 2, ",") == "d") ? "▲" : "▼";
        $ShiftPN =  (strpos($Shift, "-") == "-1") ? "+" : "-";
        //if ((($SortAD == "d") && ($ShiftPN == "+")) || (($SortAD == "a") && ($ShiftPN == "-")))  
  // Some combinations of Date sorting = move Source to Bot for comfort
        if ((($Sort == "Created,d") && ($ShiftPN == "+")) || (($Sort == "Created,a") && ($ShiftPN == "-")) || (($Sort == "Modified,d") && ($ShiftPN == "+")) || (($Sort == "Modified,a") && ($ShiftPN == "-")) || (($Sort == "Accessed,d") && ($ShiftPN == "+")) || (($Sort == "Accessed,a") && ($ShiftPN == "-"))) { 
          $Items = $Items . "|[SOURCE]";    // d+=up/rvrt    а-=up/rvrt
          //$Items = formatlist("<selitems |>", "v");
        } else { 
          $Items = "[SOURCE]|" . $Items;    // d-=dwn/no-rvrt   а+=dwn/no-rvrt
        }
        $trgtList = inputselect("[Sorting] :: $Sort :: $sortArrow    [Shift] :: $Shift    [Step] :: $Step<crlf><crlf>Items presented AS IS in the List. Re-Order if needed.<crlf>Closest to SOURCE: +1 date change.<crlf>Farest from SOURCE: +Max date change.<crlf><crlf>[Move SOURCE to Top/Bot for easy changing Steps direction.]", $Items, ,1+2+16+512+32768, , "600", "600", "Shift with consequtive Steps", , ":syncscroll");
  
  // Check SOURCE proper position after InputSelect
        if ((gettoken($trgtList, 1, "|") != "[SOURCE]") && (gettoken($trgtList, -1, "|") != "[SOURCE]")) {
          msg "SOURCE must be Top or Bottom.<br>Not Between items or Unchecked.<br>Try again.", , , "! Error !";
          end (1);
        } elseif (gettoken($trgtList, -1, "|") == "[SOURCE]") {
          $trgtList = formatlist($trgtList, "v");
        } 
        $trgtList = replace($trgtList, "[SOURCE]|", , 1, , 1);
  
          $ShiftNumb = gettoken($Shift, 1, " "); 
          $ShiftTerm = gettoken($Shift, 2, " "); 
          foreach($item, $trgtList, "|") {
            if ($dateType == "d") {
              $cmaDate = gettoken($P_CLONEDATE_SRC, 1, "<crlf>");
              timestamp c, gettoken($cmaDate, 1, "|"), $item, "*", $Shift;
              timestamp m, gettoken($cmaDate, 2, "|"), $item, "*", $Shift;
              timestamp a, gettoken($cmaDate, 3, "|"), $item, "*", $Shift;
            } else {
              timestamp $dateType, gettoken($P_CLONEDATE_SRC, 1, "<crlf>"), $item, "*", $Shift;
            }
            $ShiftNumb = $ShiftNumb + $Step;
            $Shift = $ShiftNumb . " " . $ShiftTerm;
          }
      } else {
  
  // ELSE same Shift = similar date for all targets
          $trgtList = $Items;  
          //timestamp $dateType , gettoken($P_CLONEDATE_SRC, 1, "<clrf>"), $trgtList, "*", $Shift; 
          if ($dateType == "d") {
            $cmaDate = gettoken($P_CLONEDATE_SRC, 1, "<crlf>");
            timestamp c, gettoken($cmaDate, 1, "|"), $trgtList, "*", $Shift;
            timestamp m, gettoken($cmaDate, 2, "|"), $trgtList, "*", $Shift;
            timestamp a, gettoken($cmaDate, 3, "|"), $trgtList, "*", $Shift;
          } else {
            timestamp $dateType, gettoken($P_CLONEDATE_SRC, 1, "<crlf>"), $trgtList, "*", $Shift;
          }
      }
      unset $P_CLONEDATE_SRC;
      ctbstate(0);
      if (<xyver> >= "28.10.0500") { ctbicon("* ") };
      status "Date cloned.", , "ready";
    }

  "_LoadIcons : loadicons"
    Global $iconG, $iconY, $iconR, $iconB;
    $iconG = "data:png:base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABHNCSVQICAgIfAhkiAAAALhJREFUOI2Vk+sNhCAQhD8MbViAhdnG/rANCrOAKYT7oScPF8+bhGTCwL43UJArHrjD1adTyACS6sf98XQiADuwVPZ3x3+vLyWCC/M8Oz+f9fjotcZAD7TF+RdhgqM4kjCz1/yewg/U+a/r2qZgZsOP27YdpK5B6UgAyJKypGxmNw5k9vP0nK6Nbtij7hz3OQKklK77mrv4hn8ajlCKklJq+MBrg8cUJLUjfI8kvB+kQRe8tR3BXecP6pVyL/TA86IAAAAASUVORK5CYII=";
    $iconY = "data:png:base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABHNCSVQICAgIfAhkiAAAAL1JREFUOI2Vk90NwyAMhD8i1sgmXSdr+CFrsE42uTUi0YckDT8mbU9COjjA9hkCN3LBAz1cfTqFDCCp3NwOTycC7BvE1339vvXhW/2aT+WmeZ6dzJ/1+BS1xEgP1Ob8izDBYY4kzOxn3pXwDWX9y7LUJZjZ8OC6rkDtQdGRAJAlZUnZzDoO5H07RsuhaaOX9sj9cz1HgJTSRyi5hyv96+IItykppYoPolZ4LEFS9YSdTMLPD2nUBe/bjuB+5zcNfICOblnsIAAAAABJRU5ErkJggg==";
    $iconR = "data:png:base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABHNCSVQICAgIfAhkiAAAALxJREFUOI2Vk90NgzAMhD+jrME+LMIafmCNLNJ9PIj7UFKcP0pPinRwIT6fg3DBAxd6DPXlFBzAzOLmdo10EoBvIK9QauvLt3p5XuKmdV0Hzu/1dFc1YqYLdTj/Qhb4hGNmqOpj3rXwC7H/fd/rFlR1+uFxHECdQZiIALiZuZm5qnYccN8+q+XQjHFke5b++d4TQM75K0Q+QrFfDk5whZJzrvikaoXbFsysusIDJ/L4Is2mMPptp2dEA4W8AQzYfT/do+mEAAAAAElFTkSuQmCC";
    $iconB = "data:png:base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABHNCSVQICAgIfAhkiAAAAL9JREFUOI2Vk9ENwyAMRB8Ra2QPFkrH8EfGgIW6hwdxP5I0EEyanoR0cIDtMwROWMUDPVx92gUDUNV683V4OhEgZeP9OoOmXAfbcNWP+VRvmufZyfxej3dRa4z0QGvOvwgTbOaoKiLymHcl/EJd/7IsbQkiMjy4rivQelB1JACYqpqqmoh0HLCUzVK2jsOljV7aI/f3dYsApZSvUHMPR/rHxRFOU0opDR9EbXBbgqo2T9jJJDx+SKMu+Nf7cL/zB4zYiQXyPbvrAAAAAElFTkSuQmCC";



ScriptM
  if ((isset($P_CLONEDATE_SRC) == 1) && ($P_CLONEDATE_SRC != "")) {
    $menu = popupmenu("Show date variable;show;:shellprops|-|Clean date variable;clean;:del", , , , , , , , "None");
    switch ($menu) {
      case "show":
        echo replace($P_CLONEDATE_SRC, "|", "<crlf>"), "Variable contain:";
        break;
      case "clean":
        unset $P_CLONEDATE_SRC;
        ctbstate(0);
        if (<xyver> >= "28.10.0500") { ctbicon("* ") };
        status "Date cleared.", , "ready";
        break;
      case "None": break;
      default: "None";
    }  
   } else {
     msg "L1 = Pick Source item (path)<br>L2 = Set Target Modified date<br>         Default: Shift= 2s  Steps= 2<br>         Ctrl+L2: Shift= -2s  Steps= -2<br><br>R1 = Copy Source 1 date<br>         Copy Source 3 dates(dup)<br>R2 = Set Target 1 date<br>         Set Target 3 dates(dup, no Menu)<br><br>L1+R2 = Pick Source item (path)<br>         Set Target 1/3 dates(linked)<br><br>M1 = Features reminders(this)<br>M2 = View date variable<br>          Clear date variable", , , "Information";
   }
FireClick
  0
UnClickable
  0
TextButton
  0
clonedate (24 btn, 16 menu).zip
Button icon was re-worked(only 24px version) to look better with both Dark/Light modes.
16px menu icons added = before were only incorporated as base64.
To see the attached files, you need to log into the forum.
Win 7 SP1 x64 100% 1366x768|1900x1080

Post Reply