View Single Post
Old 06-15-2014, 11:33 AM  
bigstar
FlashFXP Developer
 
bigstar's Avatar
 
Join Date: Oct 2001
Posts: 8,012
Default

New script commands as of build 3741 (v5.0 beta)

Generate a SHA1 hash of a file and display the result in the status window.
Code:
/sha1 "<path\name>"
[CMD] /sha1 "D:\Temp\test128.rnd"
[RESULT] SHA1: f2d7ca10dc48f9a7c5b46ef9b6daf3dad4626c55 File: D:\Temp\test128.rnd (131.07 MB/s)

In addition to SHA1 the following hashes are also supported CRC32, MD5, SHA224, SHA256, SHA384, SHA512.
i.e. /CRC32 "D:\Temp\test128.rnd

You can also use the new hash feature to display the result inline using $SHA1("<path\name")

Write/append a line of text to a file. If the file doesn't exist then it will be created, otherwise the line is appended to the end of the existing content.
Code:
/writeln "<path\name>" <text>
This can be combined with the hash command above to create a .md5 file using the MD5 hash file format
Code:
# This will create separate file named <filename>.MD5 for each of the files in your current selection.
# each MD5 file is using the standard MD5 hash file format consisting of
# <md5> <filename>
/writeln "%p%f.md5" $md5("%p%f") %f
I've added the ability to add comments to custom command scripts.
Any line that begins with # will be treated as a comment.

Code:
# This will create a SFV file named "verify.sfv" in %p
# using the standard SFV hash file format
# <filename> <crc32>
/writeln "%pverify.sfv" %f $crc32("%p%f")
In case it isn't obvious these new hash commands only work when executed in the local browser.

You can test the output of % and $ tokens

Using the current item selection display the absolute path+filename
Code:
/test %p%f $crc32("%p%f")
With the file test64.rnd selected the result is
[CMD] /test D:\Temp\test64.rnd

(this is just a partial test, we could use this to actually do something more useful see below.)
Change the extension .rnd of the current item selection with .exe
Code:
/test %f $replace("$lowercase(%f)",".rnd",".exe",1)
With the file test64.rnd selected the result is
[CMD] /test test64.rnd test64.exe
With the file verify.sfv selected the result is
[CMD] /test verify.sfv verify.sfv

With the current selection rename the file changing the file extension from .rnd to .exe
Code:
/ren "%p%f" "%p$replace("$lowercase(%f)",".rnd",".exe",1)"
[CMD] /ren "D:\Temp\test1.rnd" "D:\Temp\test1.exe"

.. to be continued...

Last edited by bigstar; 06-15-2014 at 11:46 AM.
bigstar is offline