Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Folder Menu - a popup menu to quickly change your folders


  • Please log in to reply
101 replies to this topic
comvox
  • Members
  • 143 posts
  • Last active: Jan 29 2017 06:53 AM
  • Joined: 20 May 2009
Thank you rexx for this excellent script (and Savage for the script that was its original base). If this script simply allowed selecting the appropriate folder in various situations, it would be really useful. But it's also a convenient launcher. It's my favorite autohotkey script, aside from some very simple scripts I wrote for myself.

A question:

This script has the feature of, under certain conditions, opening folders in Windows Explorer. Would it possible to modify it to have it open folders in Total Commander instead? I was thinking that this might only require a modification of a few lines, but my understanding of autohotkey is quite primitive, and I couldn't figure out how to do this by myself. On the other hand, if it requires more than simply modifiying a few lines, then it probably isn't worth doing, as I can, of course, get most of what I want by opening Total Commander first, and then Folder Menu manipulates it.

rexx
  • Members
  • 73 posts
  • Last active: Sep 25 2009 03:23 AM
  • Joined: 28 Feb 2006

Thank you rexx for this excellent script (and Savage for the script that was its original base). If this script simply allowed selecting the appropriate folder in various situations, it would be really useful. But it's also a convenient launcher. It's my favorite autohotkey script, aside from some very simple scripts I wrote for myself.

Thank you!

This script has the feature of, under certain conditions, opening folders in Windows Explorer. Would it possible to modify it to have it open folders in Total Commander instead? I was thinking that this might only require a modification of a few lines, but my understanding of autohotkey is quite primitive, and I couldn't figure out how to do this by myself. On the other hand, if it requires more than simply modifiying a few lines, then it probably isn't worth doing, as I can, of course, get most of what I want by opening Total Commander first, and then Folder Menu manipulates it.

Find "Run, explore " in FolderMenu.ahk, it's where it opens a new explorer and explore to a folder.
Modify it to something like "Run, C:\totalcmd\totalcmd.exe ", then it will open the folder in total commander(i think).

comvox
  • Members
  • 143 posts
  • Last active: Jan 29 2017 06:53 AM
  • Joined: 20 May 2009

Find "Run, explore " in FolderMenu.ahk, it's where it opens a new explorer and explore to a folder.
Modify it to something like "Run, C:\totalcmd\totalcmd.exe ", then it will open the folder in total commander(i think).


Thank you, Rexx. This looks promising. Following this idea I modified two places in the script. At first, it seemed to work perfectly, and I was happily modifying totalcmd command line parameters. Then I noticed some problems.

(a) Some folders opened to where they should, and some didn't. This puzzled me until I realized that the issue was blank spaces in the path. Total Commander insists that if a path which is being used as a command line parameter has blank spaces, one has to put quotes around the path. So all I had to do to solve this issue was replace %ThisPath% with "%ThisPath%" and %SelectedPath% with "%SelectedPath%".

(B) Another problem is that the resulting script, instead of launching applications like UsefulScript.ahk or KeyNote.exe (for brevity, I am leaving out the full path to UsefulScript.ahk or KeyNote.exe or TotalCmd.exe), now simply opened up to the folder the particular application was in. This was puzzling. It turns out it has to do with the fact that, in the original script,

Run, explore, %ThisPath%,,UseErrorLevel

will reject %ThisPath% and set the ErrorLevel
if %ThisPath% is UsefulScript.ahk or KeyNote.exe,
and the script then goes on eventually to

Run, %ThisPath%,,UseErrorLevel, which launches the application,

but in the modified script
Run, TotalCmd, "%ThisPath%,,UseErrorLevel will blithely go to the folder which the application is in.

I have not yet figured out how to deal with this. I think what I will have to do is have %ThisPath% tested to see if it ends in .ahk or .exe or .com or .htm or .html. The result of this test will then determine whether the script goes on to

Run, TotalCmd "%ThisPath%",,UseErrorLevel

or goes to

Run, %ThisPath%,,UseErrorLevel.

I might not get to this today, but I'll post when I either write some appropriate code or give up and ask for help!

comvox
  • Members
  • 143 posts
  • Last active: Jan 29 2017 06:53 AM
  • Joined: 20 May 2009
OK. I think I've found suitable code to deal with the problem I mentioned in my last post, although I've have to test it more.

One replaces

if w_Edit1Pos =
	{
         Run, P:\TotalCmd\TotalCmd.exe /o "%ThisPath%", , UseErrorLevel 
	     if ErrorLevel
		{
			Run, %ThisPath%, , UseErrorLevel
			if ErrorLevel
			TrayTip, Error, Could not open`n`"%ThisPath%`"`nThere's something wrong with your config file., , 3
		}
	}
	else

with


if w_Edit1Pos =
	{
	  	StringRight, ThisExt, ThisPath, 4
	  if ThisExt in .exe,.bat,.com,.ahk,.htm,html
	                       {
		Run, %ThisPath%, , UseErrorLevel
		if ErrorLevel
		TrayTip, Error, Could not open`n`"%ThisPath%`"`nThere's something wrong with your config file., , 3
	                        }
	                       else
	                        {
        Run, P:\TotalCmd\TotalCmd.exe /o "%ThisPath%", , UseErrorLevel 
		if ErrorLevel
		TrayTip, Error, Could not open`n`"%ThisPath%`"`nThere's something wrong., , 3
	                         }
                         }	
	else

One does a similar replacement at the other place in the script where
Run, TotalCmd appears.

(The /o is simply a Total Commander command line parameter which could be used, dropped, or replaced with others depending on preference.)

This seems to work well. But besides testing it more, I have to consider what should be in the list of extensions, and also probably improve the error messages to something more fitted to the modified code.

Wow, I'm pretty clumsy at this and have only figured out a little bit about scripting, but I was surprised when doing the above that autohotkey does make doing things like checking extensions pretty easy. Still, I couldn't use autohotkey at all if it weren't for this forum. For some reason, autohotkey seems to do things differently from what I expect, and it takes me a lot of looking at what other people do and discuss to figure things out.

rexx
  • Members
  • 73 posts
  • Last active: Sep 25 2009 03:23 AM
  • Joined: 28 Feb 2006
You can use
if InStr(FileExist(ThisPath), "D")
to check if ThisPath is a folder.
you can look FileExist() in the ahk document for more details.

  • Guests
  • Last active:
  • Joined: --
Very nice script. Together with Windowpad the best script!!!

comvox
  • Members
  • 143 posts
  • Last active: Jan 29 2017 06:53 AM
  • Joined: 20 May 2009

You can use Code:

if InStr(FileExist(ThisPath), "D")

to check if ThisPath is a folder.
you can look FileExist() in the ahk document for more details.


Thanks Rexx. That is a bit simpler than checking the extension.

Oh, one additional thing. With modifying the script at two points, the script -- if it's run while in Total Commander via the hotkey for Show Menu 1 -- still changes the folder rather than launching an application. That's not really that important, since one is now in the correct folder and can just double-click the application to start it. But one could correct it by replacing

; Total Commander (thanks to FatZgrED)
		else if w_Class = TTOTAL_CMD
           {
			;Total Commander has Edit1 control but you need to cd to location
                    ControlSetText, Edit1, cd %ThisPath%, ahk_id %w_WinID%
                    ControlSend, Edit1, {Enter}, ahk_id %w_WinID%
            }

with

; Total Commander (thanks to FatZgrED)
		else if w_Class = TTOTAL_CMD
                          {
			;Total Commander has Edit1 control but you need to cd to location

                   if InStr(FileExist(ThisPath), "D")
                    {
                    ControlSetText, Edit1, cd %ThisPath%, ahk_id %w_WinID%
	        ControlSend, Edit1, {Enter}, ahk_id %w_WinID%
                     }
                      Else
                      { 
                      Run, %ThisPath%, , UseErrorLevel 
                      if ErrorLevel 
                      TrayTip, Error, Some problem with Run the path, , 3 
                         }                                                                       
                                                                   
                     }

So there are three places to modify in the script to obtain the full effect I was looking for, not two, although this last place isn't really that important.

Finally, having done all this, it makes Folder Menu even more convenient for me. So thank you again for this script, rexx.

sms
  • Guests
  • Last active:
  • Joined: --
Rexx, thanks for this great script.

In xplorer² Lite it writes the new folder in the correct place (adress bar). But the {Enter} goes to the folder pane. So it starts the first file entry. Is there a solution?

rexx
  • Members
  • 73 posts
  • Last active: Sep 25 2009 03:23 AM
  • Joined: 28 Feb 2006

Rexx, thanks for this great script.

In xplorer² Lite it writes the new folder in the correct place (adress bar). But the {Enter} goes to the folder pane. So it starts the first file entry. Is there a solution?

Fixed this.
Try it again in the next version (2.02).

  • Guests
  • Last active:
  • Joined: --
This is the greatest script ever (together with windowpad)!

THANK YOU!

winflowers
  • Members
  • 11 posts
  • Last active: Jul 24 2009 01:48 PM
  • Joined: 21 Feb 2005
I just started to use Folder Menu several days ago, and love it so much. But I face some problems with the new version 2.02.
I use Unreal Commander as my File Manager, and it works well with Folder Menu 2.01. However, when I want to go to a favorite folder in 2.02, for example d:\tools, then the Unreal Commander shows a message:
A directory with the name
d:\tools
already exists. Do you want to move the file/dir to this subdirectory?
Nothing happens when I click either YES or NO buttons.

Could you please find out what changes cause the problems and fix it? Thank you very much!
I use Unreal Commander v0.95. It is a free software.

winflowers
  • Members
  • 11 posts
  • Last active: Jul 24 2009 01:48 PM
  • Joined: 21 Feb 2005

I just started to use Folder Menu several days ago, and love it so much. But I face some problems with the new version 2.02.
I use Unreal Commander as my File Manager, and it works well with Folder Menu 2.01. However, when I want to go to a favorite folder in 2.02, for example d:\tools, then the Unreal Commander shows a message:

A directory with the name
d:\tools
already exists. Do you want to move the file/dir to this subdirectory?
Nothing happens when I click either YES or NO buttons.

Could you please find out what changes cause the problems and fix it? Thank you very much!
I use Unreal Commander v0.95. It is a free software.


Sorry. It seems working again after I delete the configuration file and restart Folder Menu.

praetor
  • Members
  • 6 posts
  • Last active: Aug 04 2019 09:49 AM
  • Joined: 27 May 2009
I don't understand how works "favorite folder from Total Commander". Please can you help me?

Thanks

rexx
  • Members
  • 73 posts
  • Last active: Sep 25 2009 03:23 AM
  • Joined: 28 Feb 2006

I don't understand how works "favorite folder from Total Commander". Please can you help me?

Thanks

Click mouse middle button in total commander, and select "Folder Menu" > "Add Favorite", then the current folder will be added to favorite.

praetor
  • Members
  • 6 posts
  • Last active: Aug 04 2019 09:49 AM
  • Joined: 27 May 2009

Click mouse middle button in total commander, and select "Folder Menu" > "Add Favorite", then the current folder will be added to favorite.

Thank you, now I understand. I thought, it works now with the Total Commander directory menu. Is that feature comming soon?

Best wishes
praetor