Scripting Functionality Log Out | Topics | Search
Moderators | Edit Profile

X-Ways User Forum » Public Announcements » Scripting Functionality « Previous Next »

Author Message
Stefan Fleischmann (Admin)
Posted on Monday, Sep 3, 2001 - 20:37:   

I plan to add scripting ability to the WinHex 10.0 version. It is supposed be more powerful and flexible than the existing Routine functionality, and it will probably be available for users with a professional license only.

Scripts should allow to execute the most important functions implemented in WinHex (open file, open disk, search and replace, converting, modifying data, copy into new file, save...) as well as simple read and write operations, all without user interaction. Scripts can either be started inside WinHex, or by specifying a script file as a command line parameter to WinHex.

Scripting speeds up recurring routine tasks and enables you to carry out certain tasks on unattended remote computers. For example, the following script commands are conceivable:

Open C:
Block1 0
Block2 511
CopyIntoNewFile "C:\Original Boot Sector.bin"
// copies the boot sector into a file

Goto 0x27
Write 0x12345678
// changes a FAT16 serial number

// closes the drive
These commands can be written into a script text file manually, and possibly automatically by a macro recorder as well (cannot promise yet). Also conceivable is the use of simple variables, as known from WinHex templates.

Please let me know your suggestions and needs regarding such a functionality, what tasks it should be up to, and what particular script commands you would find most important to have.
Malcolm Isaac
Posted on Tuesday, Sep 4, 2001 - 11:07:   

Dear Stefan,

I probably would not have a use for scripting within WinHex, mostly because I use WinHex on an adhoc basis. Having said that I could see professional systems programmers could find it very useful. I guess in the way Unix programmers use things like SED and AWK.
Posted on Friday, Sep 7, 2001 - 9:42:   

I will use scripting, the routines were the reason why I chose WinHex pro. I will use the automation.
Posted on Sunday, Sep 9, 2001 - 10:35:   

why don't you expose the full WinHex API as COM Automation, so you get the language stuff as free? So you can access WinHex from Windows Scripting Host for building power hex-batch scripts.
Stefan Fleischmann (Admin)
Posted on Sunday, Sep 9, 2001 - 11:49:   

Because I think in that case only programmers would be able to use it.
Posted on Sunday, Sep 9, 2001 - 13:28:   

you are right, but your usage example could be rewritten as

wh = WScript.CreateObject("WinHex.WinHex");
drive = wh.Open("C:");
b = drive.DefineBlock(0,511);

not so difficult
Stefan Fleischmann (Admin)
Posted on Sunday, Sep 9, 2001 - 13:58:   

I agree, that's not so difficult. But WSH is not installed everywhere, and I guess 95% of all WinHex users wouldn't know how to use it (myself included, never used it so far!). Can you recommend an introduction on the Internet?

And then I fear WSH scripts are not very secure. I think it is more dangerous if Windows has control over whether a possibly malicious script is executed rather than if WinHex has. But maybe this is not an informed assumption?
Posted on Sunday, Sep 9, 2001 - 14:49:   

WSH is installed with W98 and following, so that could not be a problem. The exposed COM Automation API of WinHex could be used from inside or outside WinHex. Indeed, WSH can be invoked directly from WinHex using a scripting control. For security, the use of WinHex COM object could be restricted to the WinHex application, loosing the access from external batch file.

The main site is:
And a more specific introduction:
Posted on Sunday, Sep 9, 2001 - 14:55:   

And a standard C++ example:
Stefan Fleischmann (Admin)
Posted on Sunday, Sep 9, 2001 - 14:58:   

Thanks, I will closely look at all of this.
Jerry (Apportum)
Posted on Monday, Sep 10, 2001 - 18:40:   

WSH supports VBScript. And VBScript can be, I believe, directly supported within an application without license fee or royalties.
VBScript is an easy to use subset of VBA which would then make a WinHex scripting capability more widely available to non-C++ programmers (the majority of the world).
Right now, I use MacroExpress and WinBatch to script WinHex. Needless to say, I am delighted that the issue is being directly addressed - but I would ask that the scripting capability be kept within reach of ordinary mortals.

Posted on Tuesday, Sep 11, 2001 - 15:18:   

Dear Stefan!

One word to your idea to integrate scripting capability in WinHex: Please take into account, that I do NOT install the WSH within my Windows 98 because of it's indisputable security holes. May be, I am not alone with this opinion ...

One word to the former releases of WinHex: GREAT!

One suggestion for improvement: could it be possible to make the Position Manager not to be closed at every jump to a selected position, so that it is more easy to navigate through the search results?!

Best and kindly regards!

Stefan Fleischmann (Admin)
Posted on Tuesday, Sep 11, 2001 - 15:24:   

Thanks, I will consider your objection regarding WSH.

Position Manager: minimize the Position Manager window and switch between the positions using Ctrl+Left and Ctrl+Right.
Stefan Fleischmann (Admin)
Posted on Thursday, Oct 11, 2001 - 21:10:   

For the final implementation of scripting, please see the announcement of WinHex 9.97 Beta.
Forum operated by X-Ways Software Technology AG.