GP SoftwareTwitter
Opus FAQsManualCommandsObjects

Opus 12 Detached Dialog "Touch" Script

Version 5 of Touch is available for download.

touch.js.txt (25.7 KB)

Installation

There are several ways of installing a script. Perhaps the most straightforward is to navigate to the Script Add-ins folder using the built-in alias /scripts and then drag and drop your script code (in this case touch.js.txt). Alternatively you can:

  1. Settings --> Preferences
  2. Type Scripts into the Search Preferences field to bring up the Scripts window
  3. Drag and drop your script code (in this case touch.js.txt) into the Scripts window
  4. Click OK to close

Script Add-ins are described in some detail here in the help file.

Executing

To trigger the dialog create a button with the single command Touch, or use Instant Command mode (see here) by typing >Touch.

Usage

Touch is intended to perform an action against selected items - e.g. set all timestamps to now, or the same as the oldest or newest item in the list. No timestamps are actually changed until you click the Do It! button and after you have made a change you can choose Set All = Original to revert.

Another use case is to adjust current timestamps up or down. For example, to set all times back by 4 hours you would click the Hours radio button and either click the minus button four times or type 4 in the Adjust By field and click the minus button once. Again, no timestamps are actually changed until you click the Do It! button.

Once an Adjust radio button is clicked, additional options to Increment and Decrement are available in the Touch Action radio button set. These work by sequentially applying an offset to the base (first) item's timestamp. For example, if you select an incremental adjustment by 5 minutes then the second item will be set to the first item plus 5 minutes, the third item will be set to the first item plus 10 minutes, the fourth item will be set to the first item plus 15 minutes, etc.. This capability was requested by @opw62.

Touch v5 supports replacing the current set of selected items with new selections from the associated lister or items whose details have been saved to the clipboard. An easy way to try this is to select a few items and then save to the clipboard with Ctrl-Shift-C then click the Clip button. Now go to the associated lister and select one or more different items and click the Selected button.

Touch v5 can be started from a button or instant command with no options (as described above) or with either FILE or CLIP options. The FILE option is used to populate the dialog with a single file, e.g.

Touch FILE=C:\MyLogFile.txt

The CLIP option is used to tell touch to ignore selected items and populate the dialog from the clipboard, e.g. Touch CLIP

Touch can also be invoked from a context menu item - e.g. All Files and Folders. If you create a context item you should include a @noprogress directive. See https://resource.dopus.com/t/strange-bug-from-external-script-menu/25410 for why you need this.

2 Likes

Nice job! Very handy tool.

One thing that would make it easier to use is displaying the data the same way as DO does, which is based on the syste, locale (regional setting).

Not only looking at the delimiter but also the order of the day, month and year. So day-month-year or month/day/year to name a few examples. That way it's easier to read the dates for us humans. :wink:
Can you base the display of the dates on the system locale?

Hi Amorax

Glad you like it.

I deliberately chose to render dates in location neutral YYYY/MM/DD format to obviate any debate/confusion about US (and Micronesia) MDY vs most of the rest of the world DMY. When time permits I'll have a look at making the format selectable via a Prefs option.

Regards, AB

P.S. See Date Format By Country for a summary of the alignment of countries around the world in this great debate. :slight_smile:

We provide a method to do this easily: Date.Format.

If you give a format of just "d" or "t" then the result will be just the date or time part, formatted the same as date or time columns in the file display.

Leo's post directs me to a useful scripting feature I was not aware of which should make it possible to recode this in a much simpler way that will address your request. I will update this thread when done.

Regards, AB

Amorax

If you update Board preferences in your User Control Panel to allow other members to contact you by email, I will send you a test version that displays dates in your local format. I'd like someone in another locale to confirm that it works OK for them before I post the new version.

Regards, AB

Did this 2 days ago.

Hi Amorax

I got your email saying "I've updated my preferences so you can email me your latest version of Touch" and I replied with the new version attached. Maybe my reply got trashed as spam? I'll try again via the link on your post.

Regards, AB

Updated to v2.6. Numerous changes and improvements and big thanks to Amorax for some excellent suggestions and for testing numerous changes. Download the latest code from the head post which includes a fuller description of the new version.

Regards, AB

Updated to v3.1. Download the latest version from the head post. The major change is that the dialog is now resizeable by dragging.

Regards, AB

Updated to v4.0.

Headline addition is the ability to adjust timestamps up/down by minutes, hours, days, weeks, etc..

Download the latest version from the head post.

Regards, AB


aussieboykie, receive the following error when running the latest version:

12/8/2016 8:09 PM touch: version 4.0 (8th December, 2016) starting.. 12/8/2016 8:09 PM touch: Error at line 331, position 2 12/8/2016 8:09 PM touch: '0.length' is null or not an object (0x800a138f)
Occurs whether I select one or multiple files. Also occurs whether ymd config is set to true or false.

I have no issues with touch 3.10.

Hmm

The routine where your problem occurs has not changed between versions. What is the MD5 checksum of the file you downloaded? You can use Clipboard COPYNAMES=hash to find out. It should be....

touch.js.txt : 2ec1308312cf83b58cafb5eecd1c2563

I have posted a debug version of v4 here. If the problem still happens please post the OTHER log output or use my forum contact link to send via email.

Regards, AB

touch.3.10..js.txt : 10e1949b0a8ccab578826378f1c28efd

Debug log output:

12/9/2016 7:48 PM touch: version 4.0dbg (9th December, 2016) starting.. 12/9/2016 7:48 PM touch: ts = Today 7:48 PM 12/9/2016 7:48 PM touch: a.length = 3 12/9/2016 7:48 PM touch: Error at line 333, position 2 12/9/2016 7:48 PM touch: '0.length' is null or not an object (0x800a138f)

OK - mea culpa. I forgot to modify my date handling code to cater for users who choose the "Show day names" option in preferences. Should be fixed now. Download v4.1 from the first post in this thread.

Regards, AB

Works like a champ... Thanks!

Wonderful, thank you very much indeed!
Got to keep an eye on this thread... :slight_smile:

Version 4.2 adds a script configuration option to control whether day names are shown if the "Show day names" option is set in Prefs and the user requests Locale (Unaligned) date format. The default is TRUE. Download from the head post.

Regards, AB

I am seeking a way to have the timestamp increase by x minute(s) for each file.
Say the first is 18:00:00,
then the second 18:01:00
3rd 18:02:00
etc.
So as to avoid all files to have the exact same date-time stamp.
Having this 'increasing' _time_stamp is more convenient when sorting on the date-time.

How am I to proceed?
Could be it isn't yet possible...
Any other tricks?

Thanks!

Later ...
I just remembered ... BulkFileChanger (Nirsoft) can do it, so, pls ignore this should you already have read it. Matter solved.
But, then again, maybe you wish to consider it? (just an idea)

=

Version 5 has been posted. It includes support for Increment and Decrement which should do what you want. Download from the head post.

Regards, AB