open file in hex format
SOLVED- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
open file in hex format
I want to read and edit a file.
If one open that file normally it has stranger characters. But if with use of Notepad++ and hex view, its readable.
Now I want to read the file in testcomplete and edit in it.
is there any possible way for it?
Solved! Go to Solution.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You can try launching notepad++ from a command line and see if that helps.
If you are using this file for data in your test, I would suggest saving different versions of the file with the different data sets and calling those as you need them rather than trying to do this intricate sort of editing as you go.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello @Marsha_R
Thanks for the response.
Reasons because of which I don’t want to use other software like notepad++ or save in specific format:
1) There are multiple people using multiple PC’s for testing same application, that’s means if someone want to use that file function, he/she must have notepad++ with Hex plugin.
2) Original file can change in with every project I am opening in my testing software (it’s a temp file). Means I must convert it manually after every time I open a new project.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
TestComplete does not provide hex file editor.
Can you post/attach here a sample file?
/Alex [Community Champion]
____
[Community Champions] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Champions]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Champion] signature is assigned on quarterly basis and is used with permission by SmartBear Software.
https://community.smartbear.com/t5/Community-Champions/About-the-Community-Champions-Program/gpm-p/252662
================================
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello @AlexKaras
It's a .dll file. Its not supported here.
Anyways, I used the function to open the file as Binary and editing file as byte data. Which is working for now. But I am not sure if it is good method or not.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
> I am not sure if it is good method or not.
I think this is acceptable method because, as you correctly noted, binary file edit is not something that TestComplete is oriented at and thus it does not provide hex editor.
From programming point of view your method is quite correct, as for me.
/Alex [Community Champion]
____
[Community Champions] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Champions]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Champion] signature is assigned on quarterly basis and is used with permission by SmartBear Software.
https://community.smartbear.com/t5/Community-Champions/About-the-Community-Champions-Program/gpm-p/252662
================================
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have found another solution. Writing here if someone needs this thing in future.
//open as binary file
var binFile = aqFile["OpenBinaryFile"](stringFilePathBinFile, aqFile["faReadWrite"]);
// Reads bytes from the file
readBytesFromBin = binFile["ReadBytes"]();
// Obtains the number of items in the array returned by ReadBytes()
countBytes = readBytesFromBin["Count"];
for (var i = 0; i < countBytes; i++)
{
// Obtains the current item
var byteValue = readBytesFromBin["Item"](i);
//convert it to ascii code and store it in string
var stringBinFile =stringBinFile+ aqConvert["VarToStr"](aqString["Format"]("%c", aqConvert["VarToInt"](byteValue)));
}
