Page 1 of 1

MDBU idea/how-to/request

Posted: 08 Sep 2015 14:25
by JLoftus
I have an interesting idea for a MDBU feature... for a folder

I could see several neat potentials for a MDBU operation on a folder (currently does nothing, right?)

I would like to do this (maybe someone has a script idea, did not want to double-post):

MDBU on a folder could preview a text file within the folder of the same name. That is, if a folder named "InterestingIdeas" has a file in it named "InterestingIdeas.txt" then the MDBU would pop up a preview of that text file.

What do you think?

Re: MDBU idea/how-to/request

Posted: 08 Sep 2015 14:32
by highend
Could be done with a script + an .ahk .exe

A bit too specific for a general MDBU function imho...

Re: MDBU idea/how-to/request

Posted: 08 Sep 2015 14:58
by admin
Yes, IMHOTOO. :) (Sounds like some pharaoh)

Re: MDBU idea/how-to/request

Posted: 08 Sep 2015 15:10
by JLoftus
OK, so that idea was too specific, are there any general things that are or can be done with MDBU on a folder?

Re: MDBU idea/how-to/request

Posted: 08 Sep 2015 15:31
by highend
Not atm...

Regarding your "wish"...

XYscript (put it on a hotkey, button, whatever):
Replace the
D:\PreviewTxtFile.exe

with whereever you place the .exe from the .zip file (attachment)!

Code: Select all

    if (exists("<curitem>") == 2) {
        $folderName = regexreplace("<curitem>", "^(.*\\)(.*?)$", "$2");
        $fileToPreview = "<curitem>\$folderName.txt";
        if (exists($fileToPreview) == 1) {
            run """D:\PreviewTxtFile.exe"" ""$fileToPreview""", "<curpath>";
        }
    }
When you execute the script, a white window (no top bar, no scroll bars, etc.), a little bit smaller than your XY instance opens up and shows the .txt file...
Click the left mouse button anywhere to close it...


Attachment: Compiled .ahk code...
PreviewTxtFile.zip

Re: MDBU idea/how-to/request

Posted: 08 Sep 2015 15:35
by eil
em.. why everybody forgot that in Thumbs view with folder thumbs enabled, MDBU on folder will popup folder's picture..

Re: MDBU idea/how-to/request

Posted: 08 Sep 2015 15:40
by highend
em.. why everybody forgot that in Thumbs view with folder thumbs enabled, MDBU on folder will popup folder's picture.
And what does the OP do, when his .txt file in that folder changes and he forgets to take a new screenshot from it? Preview outdated data?
Just askin' :ninja:

Re: MDBU idea/how-to/request

Posted: 08 Sep 2015 15:53
by JLoftus
@highend, this worked great, thank you! would you mind sharing the ahk source? Also, I made this actionable from a CTB but really, would prefer MDBU, is there any way to associate that script snippet with MDBU (on a folder only) ?

Thank you again!

Re: MDBU idea/how-to/request

Posted: 08 Sep 2015 16:01
by highend

Code: Select all

#NoEnv
#SingleInstance, Force
#NoTrayIcon
#Persistent

WinGetPos, xPos, yPos, width, height, ahk_class ThunderRT6FormDC

xPos   += 5
yPos   += 30
width  -= 10
height -= 35

Gui, New, +LastFound +AlwaysOnTop +HwndPreviewHWND
Gui, Color, FFFFFF
Gui -Caption
Gui, Font, s10, Segoe UI

Gui, Add, Edit, x%xPos% y%yPos% w%width% h%height% -WantCtrlA -Wrap -VScroll -E0x200 BackgroundTrans Disabled ReadOnly
FileRead, FileContents, %1%
GuiControl,, Edit1, %FileContents%


Gui, Show, x%xPos% y%yPos% w%width% h%height%
return

GuiEscape:
GuiClose:
	ExitApp
return

LButton::
	ExitApp
return
As an external MDBU, yeah possible, but it requires a lot more work... As an internal one? Not with scripting.

Re: MDBU idea/how-to/request

Posted: 08 Sep 2015 16:12
by klownboy
If you install Thumbnail Extensions 1.03 (text file thumbnails in explorer) on your system you'll have thumbnails of any text type file including XYS scripts. The Control Panel applet lets you choose the extensions you'd like to see as thumbnails. You can then refer to the txt file in a desktop.ini in the folder (yes, refer to a text file) and then have the folder in the parent folder look like a txt file.
parent folder view.JPG
The desktop ini file simply refers to any text file and look something like this:

Code: Select all

[ViewState]
Mode=
Vid=
FolderType=Pictures
Logo=G:\Downloads\GroceryList.txt
Yes, it's a stupid example but it works. I wasn't able to get the text file like Grocery List.txt renamed to folder.txt to work directly but there may be a way around that as well. Of course this method doesn't really blow anything up when you MDBU on th folder since there is a limit to the text thumbnail size.

Re: MDBU idea/how-to/request

Posted: 08 Sep 2015 16:42
by highend
Btw, when you remove the -VScroll option in the .ahk code, you can even scroll your "previewed" text vertically while there is no vertical scroll bar displayed...

And if you have any problems with wrong encodings (e.g. "Umlauts" in german), add:
FileEncoding, UTF-8

before:
FileRead, FileContents, %1%

Re: MDBU idea/how-to/request

Posted: 09 Sep 2015 13:13
by eil
highend wrote:
em.. why everybody forgot that in Thumbs view with folder thumbs enabled, MDBU on folder will popup folder's picture.
And what does the OP do, when his .txt file in that folder changes and he forgets to take a new screenshot from it? Preview outdated data?
Just askin' :ninja:
i was only referring to statement that "MDBU on folder has no action" -it has.