Toggle Size Format button doesn't remember previous settings

The built-in VBScript has unwanted side effects when clicking it:

  1. The Size column is resized to fit the contents - it expands and shrinks to fit. I'd like it to stay the same size, (and only when applicable, expand to fit the larger amount of text.)

  2. I have my Size column left-aligned by default. Clicking the button changes it to be right-aligned. I'd like to keep my left-alignment.

Is this possible? Thank you!

Here is the script contents:

Function OnClick(ByRef clickData)

	sizeIdx = -1
	sizeKbIdx = -1
	sizeAutoIdx = -1
	disksizeIdx = -1
	disksizeKbIdx = -1
	disksizeAutoIdx = -1
	idx = 0

	For Each colItem in clickData.func.sourcetab.format.columns
		If (colItem.name = "size") Then sizeIdx = idx
		If (colItem.name = "sizekb") Then sizeKbIdx = idx
		If (colItem.name = "sizeauto") Then sizeAutoIdx = idx
		If (colItem.name = "disksize") Then disksizeIdx = idx
		If (colItem.name = "disksizekb") Then disksizeKbIdx = idx
		If (colItem.name = "disksizeauto") Then disksizeAutoIdx = idx
		idx = idx + 1
	Next

	Set cmd = clickData.func.command

	If (sizeIdx <> -1 And sizeAutoIdx = -1 And sizeKbIdx = -1) Then
		cmd.RunCommand "Set COLUMNSREMOVE=size COLUMNSADD=sizeauto(" & sizeIdx & ")"
	ElseIf (sizeIdx = -1 And sizeAutoIdx <> -1 And SizeKbIdx = -1) Then
		cmd.RunCommand "Set COLUMNSREMOVE=sizeauto COLUMNSADD=size(" & sizeAutoIdx & ")"
	ElseIf (sizeIdx = -1 And sizeAutoIdx = -1 And SizeKbIdx <> -1) Then
		cmd.RunCommand "Set COLUMNSREMOVE=sizekb COLUMNSADD=size(" & sizeKbIdx & ")"
	End If
	
	If (disksizeIdx <> -1 And disksizeAutoIdx = -1 And disksizeKbIdx = -1) Then
		cmd.RunCommand "Set COLUMNSREMOVE=disksize COLUMNSADD=disksizeauto(" & disksizeIdx & ")"
	ElseIf (disksizeIdx = -1 And disksizeAutoIdx <> -1 And disksizeKbIdx = -1) Then
		cmd.RunCommand "Set COLUMNSREMOVE=disksizeauto COLUMNSADD=disksize(" & disksizeAutoIdx & ")"
	ElseIf (disksizeIdx = -1 And disksizeAutoIdx = -1 And disksizeKbIdx <> -1) Then
		cmd.RunCommand "Set COLUMNSREMOVE=disksizekb COLUMNSADD=disksize(" & disksizeKbIdx & ")"
	End If

End Function

P.S. I did manage to get this other variation to function (I had to remove the very beginning "script" and ending "code".) Edit: I thought it halfway worked, but it does the exact same thing as the VBscript. Perhaps it would be easier to tweak this JScript version instead? Maybe not.

P.P.S. I wouldn't mind setting my default Size column to a static width, I suppose, if it would help... 80 would be optimal for me. Thanks!

  1. You could modify the script to specify fixed sizes for the columns it adds. (See the Set COLUMNSADD argument, or we can edit the script for you if you let us know the size you want and link your account.)

  2. You've probably only set some of the size columns to be left aligned, and not all of them. (Preferences / Display / Fields).

Thank you much! You were right again. Issue mostly solved - alignment was the biggest thing. I didn't realize the script was hiding / showing different columns... a neat idea complimented by the fact that there's no graphical glitches or lag or anything to indicate that a chunk of the interface is being changed.

(For the record, I do plan to link my account. DOpus is literally my favorite piece of Windows software ever created... and I've thoroughly played with a ridiculous number of programs... I've been unemployed for a while now, and briefly could've afforded DOpus while your holiday sale was in effect, but chose not to - because you deserve the full asking price. I'll hopefully have a decent income soon, and you can be assured I'll support this awesome product and your absurdly excellent support when I am able. In the meantime, I've been encouraging folks to check out the software, describing some power features which I never realized I couldn't live without. (example from reddit including screenshot). I realize this doesn't justify not monetarily supporting a wonderful developer, but at this point in my life, I feel it's the most I am currently able to do. I am sorry. I truly love DOpus and I wish I'd invested the effort into customizing it years ago, but instead closed-mindedly brushed it off as "too complicated." Anyway, thank you very much for your extreme dedication and the mind-boggling amount of work you've put in, dissecting feedback from and thrilling your userbase. You are amazing.)

2 Likes