I stuck with simple thing. I am sure you could help me to get trough.
I have a video file with (for example) such a name: 20150829201931.m2ts
As you can see - the name is in fact the date. I managed to change it (with external macro, which I have prepared earlier) for such a date in clipboard (of course as text): 2015-08-29 20:19:31
Now - how to use this clipboard content for SetAttr CREATED? (I wish to use it with button, not in a script)?
You can use {clip} to insert the clipboard text into a button. (Note: It will be the clipboard text as it was before any part of the button ran.)
You might be better off moving everything into a script, though. Then you don't have to modify your clipboard at all and you can do everything in a single action. A script that takes filenames like 20150829201931.* and runs the appropriate SetAttr command would be quite simple. Shout if you need help with how to write it.
Thanks, but not what I wanted, because the changed buffer comes after running script in the button.
If I can get the clipboard contents while doing the script under the button - it would do the job...
Could be fine, but I'd rather have a problem with variables and manipulating them in the script (I am not very experienced with vbs). If you could point me and example of similar script, I could try to rearrange it.
[code]@script VBScript
Option Explicit
Function OnClick(ByRef clickData)
Dim re, fileItem, fileDate, cmdString
clickData.Func.command.deselect = False
clickData.Func.command.ClearFiles
Set re = new RegExp
re.Pattern = "^(\d\d\d\d)(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)(\.[^.]+)$"
For Each fileItem in clickData.Func.sourceTab.selected_files
If (re.Test(fileItem.name)) Then
fileDate = re.Replace(fileItem.name, "$1-$2-$3 $4:$5:$6")
cmdString = "SetAttr FILE=""" & fileItem.realpath & """ CREATED=""" & fileDate & """"
clickData.Func.command.RunCommand cmdString
End If
Next
Thank you Leo.
It works like a charm!
(It is simple when you know and quite difficult when you have to find each command - when not impossible
I have added two lines to have a date from EXIF (if exists) and modified the checking line so each file starting from 14 digits and ending whatever will have both dates changed.
Sony Play Memories puts both films and images in the same folder. Images regularly have proper dates, but films not (there is no Exif date to correct it). With this version one could set all dates at once if needed (regardless if picture or film).
[code]@script VBScript
Option Explicit
Function OnClick(ByRef clickData)
Dim re, fileItem, fileDate, cmdString