Page 1 of 1

Opening TextPad in binary mode

Posted: Tue Nov 11, 2003 2:48 pm
by SteveH
I had a look through old forum postings plus the help file info on command line switches but couldn't see any way to achieve this.

Is there any way to make TextPad open a file in binary mode. I had hoped that a shortcut in the sendto menu, coupled with a command line switch might have allowed this.

I realise that it can be done by associating file types, but I really wanted a general purpose viewer.

Posted: Tue Nov 11, 2003 3:18 pm
by talleyrand
Looking through the help (for command and then select Command Line Parameters), at least for 4.7.1 shows the following, none of which seem to be what you're looking for.

Parameter Description
-av Arrange windows vertically tiled.
-ah Arrange windows horizontally tiled.
-ac Arrange windows cascaded.
-am Arrange windows maximized.
-ca Open any specified file name parameters in the ANSI code set.
-cd Open any specified file name parameters in the DOS code set.
-i Start minimized (iconized).
-l# User interface language, where # is: 7=German, 9=English, 10=Spanish, 12=French, 16=Italian, 17=Japanese, 21=Polish, 25=Russian.
-m Start another instance, regardless of the setting for "Allow multiple instances".
-ol Set landscape orientation for printing.
-op Set portrait orientation for printing.
-p "file" Print the specified file using default printer.
-q Don't display startup "splash" message.
-r Open any files in the command line as read only.
-s Started by a DDE shell command.
-t "title" Append "title" to the main window title bar.
-u filename Open the file, whose name can contain spaces, but does not need to be quoted.
@filename Open all the files that are listed, one per line, in the specified file. This overrides the option to load the workspace, specified on the General page of the Preferences dialog box.

Posted: Tue Nov 11, 2003 9:20 pm
by CyberSlug
Try this to open the active file in Binary mode. Create a user-defined tool:
- Command: AutoIt3.exe
- Parameters: "binaryMode.au3"

Code: Select all

; binaryMode.au3 Script that extracts the filename from
; English TextPad titlebar and then opens the file in Binary Mode
;
; Philip "CyberSlug" Gump - 11 November 2003
; Tested on (English version of) TextPad 4.72 and requires AutoIt v3

AutoItSetOption("SendKeyDelay",1)   ;speed things up; default is 10 ms
$title = WinGetTitle("TextPad","")  ;title of active TextPad window

If StringInStr($title, "*") Then
	MsgBox(0, "Error", "File is not saved!")
	Exit
EndIf

$fileName = StringTrimRight( StringTrimLeft($title, 11),  1)

WinMenuSelectItem("TextPad", "", "&File", "&Close")  ;close the file

WinMenuSelectItem("TextPad", "", "&File", "&Open")   ;reopen...
Send($fileName,1)
ControlCommand("Open", "", "ComboBox4", "SelectString" ,"Binary")
ControlFocus("Open", "", "Buton2")       ;choose the Open button 
ControlLeftClick("Open", "", "Button2")  ;click the Open button

Exit