hi there, i need a simply script to rename a selected file to hex value and viceversa
any tips?
simply script ascii to hex
Re: simply script ascii to hex
my request it's really hard?
i see 31 views to my thread but 0 replies
and it's really strange for me: from web resource there are many sites that allow this, such as:
https://online-toolz.com/tools/text-hex-convertor.php
https://onlinehextools.com/convert-text-to-hex
https://www.calculators.tech/text-to-hex
and also on np++ have a good plug-in Converter ascii to hex and viceversa, but i would like a script to use directly in xy for the renaming of any file, without going through np++ or browser
but perhaps it is more the will that does not want to answer than the problem itself.
and even if don't understand the reason, ok i accept this and i will look for other solutions
i see 31 views to my thread but 0 replies
and it's really strange for me: from web resource there are many sites that allow this, such as:
https://online-toolz.com/tools/text-hex-convertor.php
https://onlinehextools.com/convert-text-to-hex
https://www.calculators.tech/text-to-hex
and also on np++ have a good plug-in Converter ascii to hex and viceversa, but i would like a script to use directly in xy for the renaming of any file, without going through np++ or browser
but perhaps it is more the will that does not want to answer than the problem itself.
and even if don't understand the reason, ok i accept this and i will look for other solutions
Re: simply script ascii to hex
Code: Select all
"Text to Hex (Rename base)"
$items = get("selecteditemspathnames");
foreach($item, $items, "<crlf>", e) {
$itemName = regexreplace($item, "(.*\\)(.*)(....)", "$2");
$hexdump = hexdump($itemName, 1, r);
$hexdump = replace($hexdump, " ", "");
renameitem($hexdump, $item);
}
"Hex to Text (Rename base)"
$items = get("selecteditemspathnames");
foreach($item, $items, "<crlf>", e) {
$itemName = regexreplace($item, "(.*\\)(.*)(....)", "$2");
$hexdump = hexdump($itemName, 1, "ri");
renameitem($hexdump, $item);
}
-
"Text to Hex (Rename all)"
$items = get("selecteditemspathnames");
foreach($item, $items, "<crlf>", e) {
$itemName = regexreplace($item, "(.*\\)(.*)(....)", "$2$3");
$hexdump = hexdump($itemName, 1, r);
$hexdump = replace($hexdump, " ", "");
renameitem($hexdump, $item, 3);
}
"Hex to Text (Rename all)"
$items = get("selecteditemspathnames");
foreach($item, $items, "<crlf>", e) {
$itemName = regexreplace($item, "(.*\\)(.*)(....)", "$2$3");
$hexdump = hexdump($itemName, 1, "ri");
renameitem($hexdump, $item, 3);
}
Code: Select all
"Text to Hex (Rename base)"
$items = get("selecteditemspathnames");
$newNames = "";
foreach($item, $items, "<crlf>", e) {
$itemName = regexreplace($item, "(.*\\)(.*)(....)", "$2");
$itemEXT = regexreplace($item, "(.*\\)(.*)(....)", "$3");
$hexdump = hexdump($itemName, 1, r);
$hexdump = replace($hexdump, " ", "");
$newNames .= "$hexdump$itemEXT<crlf>";
}
rename l, $newNames, , $items;
"Hex to Text (Rename base)"
$items = get("selecteditemspathnames");
$newNames = "";
foreach($item, $items, "<crlf>", e) {
$itemName = regexreplace($item, "(.*\\)(.*)(....)", "$2");
$itemEXT = regexreplace($item, "(.*\\)(.*)(....)", "$3");
$hexdump = hexdump($itemName, 1, "ri");
$newNames .= "$hexdump$itemEXT<crlf>";
}
rename l, $newNames, , $items;
-
"Text to Hex (Rename all)"
$items = get("selecteditemspathnames");
$newNames = "";
foreach($item, $items, "<crlf>", e) {
$itemName = regexreplace($item, "(.*\\)(.*)(....)", "$2$3");
$hexdump = hexdump($itemName, 1, r);
$hexdump = replace($hexdump, " ", "");
$newNames .= "$hexdump<crlf>";
}
rename l, $newNames, , $items;
"Hex to Text (Rename all)"
$items = get("selecteditemspathnames");
$newNames = "";
foreach($item, $items, "<crlf>", e) {
$itemName = regexreplace($item, "(.*\\)(.*)(....)", "$2$3");
$hexdump = hexdump($itemName, 1, "ri");
$newNames .= "$hexdump<crlf>";
}
rename l, $newNames, , $items;
Win10, Win11 @100% 2560x1440 22H2
Re: simply script ascii to hex
@Norn a big thank you for your code
just a note: for my intent, i need only the second part, 'Rename selected items at once'
but with this code, all space is converted in hex on 00
example: if i have to rename New Text File.txt with your code i have 4E0065007700200054006500780074002000460069006C006500.txt
with this link (only to example) https://online-toolz.com/tools/text-hex-convertor.php i have:
New Text File.txt -----> 4e657720546578742046696c65
without 00 and all letter lowercase
just a note: for my intent, i need only the second part, 'Rename selected items at once'
Code: Select all
"Text to Hex (Rename base)"
$items = get("selecteditemspathnames");
$newNames = "";
foreach($item, $items, "<crlf>", e) {
$itemName = regexreplace($item, "(.*\\)(.*)(....)", "$2");
$itemEXT = regexreplace($item, "(.*\\)(.*)(....)", "$3");
$hexdump = hexdump($itemName, 1, r);
$hexdump = replace($hexdump, " ", "");
$newNames .= "$hexdump$itemEXT<crlf>";
}
rename l, $newNames, , $items;
"Hex to Text (Rename base)"
$items = get("selecteditemspathnames");
$newNames = "";
foreach($item, $items, "<crlf>", e) {
$itemName = regexreplace($item, "(.*\\)(.*)(....)", "$2");
$itemEXT = regexreplace($item, "(.*\\)(.*)(....)", "$3");
$hexdump = hexdump($itemName, 1, "ri");
$newNames .= "$hexdump$itemEXT<crlf>";
}
rename l, $newNames, , $items;
example: if i have to rename New Text File.txt with your code i have 4E0065007700200054006500780074002000460069006C006500.txt
with this link (only to example) https://online-toolz.com/tools/text-hex-convertor.php i have:
New Text File.txt -----> 4e657720546578742046696c65
without 00 and all letter lowercase
Re: simply script ascii to hex
Really, this was after one day - maybe you should increase your patience and decrease the neediness!
Ralph
(OS: W11 22H2 Home x64 - XY: Current beta - Office 2019 32-bit - Display: 1920x1080 @ 125%)
(OS: W11 22H2 Home x64 - XY: Current beta - Office 2019 32-bit - Display: 1920x1080 @ 125%)
-
- Site Admin
- Posts: 60602
- Joined: 22 May 2004 16:48
- Location: Win8.1 @100%, Win10 @100%
- Contact:
Re: simply script ascii to hex
Decreasing laziness might also be a way.
FAQ | XY News RSS | XY Twitter
Re: simply script ascii to hex
Code: Select all
"Without 00 (English only):"
-
"Text to Hex (Rename base)"
$items = get("selecteditemspathnames");
$newNames = "";
foreach($item, $items, "<crlf>", e) {
$itemName = regexreplace($item, "(.*\\)(.*)(....)", "$2");
$itemEXT = regexreplace($item, "(.*\\)(.*)(....)", "$3");
$hexdump = hexdump($itemName, 1, r);
$hexdump = replace($hexdump, " 00 ", "");
$newNames .= "$hexdump$itemEXT<crlf>";
}
rename l, $newNames, , $items;
"Hex to Text (Rename base)"
$items = get("selecteditemspathnames");
$newNames = "";
foreach($item, $items, "<crlf>", e) {
$itemName = regexreplace($item, "(.*\\)(.*)(....)", "$2");
$itemEXT = regexreplace($item, "(.*\\)(.*)(....)", "$3");
$case = "1";
$pos = "";
$newBase = "";
while ($pos++ < strlen($itemName)) {
$word = gettoken($itemName, $pos, "");
$next = gettoken($itemName, $pos + 1, "");
if $case == "2" {$case = "1"}
if $case == "0" {$case = "2"}
if($case == "1") {$newBase .= "$word$next" . " 00 "; $case = "0";}
}
$hexdump = hexdump($newBase, 1, "ri");
$newNames .= "$hexdump$itemEXT<crlf>";
}
rename l, $newNames, , $items;
-
"Text to Hex (Rename all)"
$items = get("selecteditemspathnames");
$newNames = "";
foreach($item, $items, "<crlf>", e) {
$itemName = regexreplace($item, "(.*\\)(.*)(....)", "$2$3");
$hexdump = hexdump($itemName, 1, r);
$hexdump = replace($hexdump, " 00 ", "");
$newNames .= "$hexdump<crlf>";
}
rename l, $newNames, , $items;
"Hex to Text (Rename all)"
$items = get("selecteditemspathnames");
$newNames = "";
foreach($item, $items, "<crlf>", e) {
$itemName = regexreplace($item, "(.*\\)(.*)(....)", "$2$3");
$case = "1";
$pos = "";
$newBase = "";
while ($pos++ < strlen($itemName)) {
$word = gettoken($itemName, $pos, "");
$next = gettoken($itemName, $pos + 1, "");
if $case == "2" {$case = "1"}
if $case == "0" {$case = "2"}
if($case == "1") {$newBase .= "$word$next" . "00"; $case = "0";}
}
$hexdump = hexdump($newBase, 1, "ri");
$newNames .= "$hexdump<crlf>";
}
rename l, $newNames, , $items;
-
"Support non-English:"
-
"Text to Hex (Rename base)"
$items = get("selecteditemspathnames");
$newNames = "";
foreach($item, $items, "<crlf>", e) {
$itemName = regexreplace($item, "(.*\\)(.*)(....)", "$2");
$itemEXT = regexreplace($item, "(.*\\)(.*)(....)", "$3");
$hexdump = hexdump($itemName, 1, r);
$hexdump = replace($hexdump, " ", "");
$newNames .= "$hexdump$itemEXT<crlf>";
}
rename l, $newNames, , $items;
"Hex to Text (Rename base)"
$items = get("selecteditemspathnames");
$newNames = "";
foreach($item, $items, "<crlf>", e) {
$itemName = regexreplace($item, "(.*\\)(.*)(....)", "$2");
$itemEXT = regexreplace($item, "(.*\\)(.*)(....)", "$3");
$hexdump = hexdump($itemName, 1, "ri");
$newNames .= "$hexdump$itemEXT<crlf>";
}
rename l, $newNames, , $items;
-
"Text to Hex (Rename all)"
$items = get("selecteditemspathnames");
$newNames = "";
foreach($item, $items, "<crlf>", e) {
$itemName = regexreplace($item, "(.*\\)(.*)(....)", "$2$3");
$hexdump = hexdump($itemName, 1, r);
$hexdump = replace($hexdump, " ", "");
$newNames .= "$hexdump<crlf>";
}
rename l, $newNames, , $items;
"Hex to Text (Rename all)"
$items = get("selecteditemspathnames");
$newNames = "";
foreach($item, $items, "<crlf>", e) {
$itemName = regexreplace($item, "(.*\\)(.*)(....)", "$2$3");
$hexdump = hexdump($itemName, 1, "ri");
$newNames .= "$hexdump<crlf>";
}
rename l, $newNames, , $items;
Win10, Win11 @100% 2560x1440 22H2
Re: simply script ascii to hex
simply wonderful
Thank you so much Norn
Thank you so much Norn