"What is wrong with this?"
Code: Select all
$File = get('SelectedItemsPathNames') // <-- 1. missing semicolon.
$Sha1 = hash('sha1', $File, '1') // <-- 1. missing semicolon 2. missing indentation makes this a separate subscript.
copy $Sha1 ; // <-- 1. missing indentation makes this a separate subscript 2. copy is for file/folders, you need copytext
A working solution:
Code: Select all
"Copy hash to clipboard"
$File = <selitem>; // <selitem> returns only the one currently selected item.
if (exists($File) == 1) { // exists($File) returns 1 if $File is a file, this avoids trying to hash a folder.
$Sha1 = hash('sha1', $File, 1);
copytext $Sha1;
}
Please at least glance over the scripting intro. (and look at the script reference for available commands and syntax):