Page 10 of 12
Re: [Script] WhiteSpaceCtxMenu
Posted: 17 Jul 2015 03:44
by CookieMonster
I've begun building my menus;
Code: Select all
$py=<<<py
"Python|C:\Program Files\Sublime Text 2\sublime_text.exe" openwith "C:\Program Files\Sublime Text 2\sublime_text.exe";
"Notepad|C:\Windows\notepad.exe" openwith "C:\Windows\notepad.exe";
py;
It is error free, it works

It only loads Sublime, there is no menu with notepad ?
Code: Select all
elseif($selext LikeI "py") {openwith "C:\Program Files\Sublime Text 2\sublime_text.exe"; end(1);}
elseif($selext LikeI "py") {openwith "C:\Windows\notepad.exe"; end(1);}
Re: [Script] WhiteSpaceCtxMenu
Posted: 17 Jul 2015 05:42
by highend
It is error free
It isn't. Two logical errors.
It only loads Sublime, there is no menu with notepad ?
Why should there be a menu? The second elseif is never executed & even the first py-entry doesn't even load a menu^^
I'm looking at the script though Javascript eyes

Re: [Script] WhiteSpaceCtxMenu
Posted: 17 Jul 2015 07:36
by CookieMonster
Why should there be a menu? The second elseif is never executed & even the first py-entry doesn't even load a menu^^
?
Re: [Script] WhiteSpaceCtxMenu
Posted: 17 Jul 2015 12:53
by klownboy
Hey CookieMonster, new day. What highend stated is absolutely correct. You have a heredoc for this case where you created a menu as variable $py. Why don't you use it? The method using load the program was to be used when you want to immediately run a program with no menu...sound familiar. Look at what we did with the txt files. When files are selected, you have to decide what extensions types you want to have bring up this particular menu. Is it only files with a "py" extension? If that is the case, delete the 2 'elseif' lines you posted, instead use this:
Code: Select all
elseif($selext LikeI "py") {load "$py", , s; end(1);}
If you want to have multiple file extensions like py,ini, txt to bring up this particular menu, you should use something like:
Code: Select all
elseif(gettokenindex($selext, "py|ini|txt", '|', 'i')) {load "$py", , s; end(1);}
There are other ways to do it as discussed earlier in this thread.
Re: [Script] WhiteSpaceCtxMenu
Posted: 17 Jul 2015 19:55
by CookieMonster
Hey CookieMonster, new day. What highend stated is absolutely correct. You have a heredoc for this case where you created a menu as variable $py. Why don't you use it?
I am using it
Code: Select all
elseif($selext LikeI "py") {load "$py", , s; end(1);}
The , , are empty strings ?
Code: Select all
elseif(gettokenindex($selext, "py|ini|txt", '|', 'i')) {load "$py", , s; end(1);}
I put the code above in the condition and, regardless if I select a txt file, my heredoc txt menu loads instead ?
Can you have menus with sub-menus and those menus have titles ?
Menu Name
{Item}
{Item}
Menu Name > SubMenu {Item}
{Item} {Item}
{Item}
Re: [Script] WhiteSpaceCtxMenu
Posted: 17 Jul 2015 21:23
by klownboy
CookieMonster, concerning the heredoc, now you say you're using heredoc menu. Well maybe now you are, but that's not what you posted. Is it? You posted 2" elseif" lines, one that ran "notepad" and another that ran "sublime". So don't tell me after the fact that you're using the heredoc and give me a

not when you posted something entirely different.
CookieMonster wrote:The , , are empty strings ?
No, when you have a question about a particular scripting command, the first thing you should do is go to Help and look for Help on Scripting Commands and from there look for the particular command, like in this case "load". You would see that the , , is for loading label(s) of the script. You not loading a label so it's blank or empty.
As far as loading the txt file menu...I figured you'd have that problem, that's why I told you, you have to decide when files are selected which file extension are going to bring up which menu. In this case, if you had a file with a txt extension and you have txt extension listed in both the $txt and $py menus it going to bring up the first one in the script. So either split up the extension so you don't thave the same ones in each menu or combine them into one menu. For simply editing files, you really only need one menu for all those file types- txt, ini, xys, ahk, py, doc, docx, etc.
Why would you bother with sub-menus with something as simply as this...it doesn't pass the common sense test. The whole idea is to be able to quickly either run a program on the selected file or bring up a menu of programs to run the selected file(s) not have to dig deeper into submenus to select he program. Yes, there are way to do that, but I'm not getting into it here there are plenty of other menu programs already posted.
Re: [Script] WhiteSpaceCtxMenu
Posted: 18 Jul 2015 01:51
by CookieMonster
As far as loading the txt file menu...I figured you'd have that problem, that's why I told you, you have to decide when files are selected which file extension are going to bring up which menu. In this case, if you had a file with a txt extension and you have txt extension listed in both the $txt and $py menus it going to bring up the first one in the script. So either split up the extension so you don't thave the same ones in each menu or combine them into one menu. For simply editing files, you really only need one menu for all those file types- txt, ini, xys, ahk, py, doc, docx, etc.
How do I combine them ?
Why would you bother with sub-menus with something as simply as this...it doesn't pass the common sense test. The whole idea is to be able to quickly either run a program on the selected file or bring up a menu of programs to run the selected file(s) not have to dig deeper into submenus to select he program. Yes, there are way to do that, but I'm not getting into it here there are plenty of other menu programs already posted.
Can the other programs do sub-menus with labels combined with context menu as in this script ?
Re: [Script] WhiteSpaceCtxMenu
Posted: 18 Jul 2015 13:47
by klownboy
CookieMonster, please take a look the comments to where I added Sublime to the txt menu.
Code: Select all
/*** text file menu ***/
$txt = <<<DOC
"NotePad++|C:\Tools\NotePad++\notepad++.exe" openwith "D:\Tools\NotePad++\notepad++.exe";
"PSPad|C:\Tools\PSPad\PSPad.exe" openwith "D:\Tools\PSPad\PSPad.exe";
"Notepad|C:\Windows\notepad.exe" openwith "C:\Windows\notepad.exe";
"Python|C:\Program Files\Sublime Text 2\sublime_text.exe" openwith "C:\Program Files\Sublime Text 2\sublime_text.exe"; //added sublime here
DOC;
$psd =<<<PSD
"Photoshop|C:\Program Files\Adobe\Adobe Photoshop CC 2015\Photoshop.exe" openwith "C:\Program Files\Adobe\Adobe Photoshop CC 2015\Photoshop.exe";
PSD;
if(exists("<selitem>") == 1) {
$selext = getpathcomponent("<selitem>", "ext");
if(gettokenindex($selext, "ini|txt|nfo|inf|reg|ps1|vbs|xys|py", '|', 'i')) {load "$txt", , s; end(1);} //load textfile menu added sublime ext here
elseif($selext LikeI "xys") {load("<selitem>"); end(1);} //no menu - example showing how you can automatically run an XY script on a right click on white
elseif($selext LikeI "ahk") {openwith "C:\Windows\notepad.exe"; end(1);} //no menu - example to open an AHK file for editing
elseif($selext LikeI "psd") {openwith "C:\Program Files\Adobe\Adobe Photoshop CC 2015\Photoshop.exe"; end(1);} // use this line or one below it
//elseif($selext LikeI "psd") {load "$psd", , s; end(1);}
else {#550; end(1);}
}
else {
#550
}
As I said before, I'm not getting into sub-menus on this thread at least not for this script. Please do a search on menus or sub-menus.
Re: [Script] WhiteSpaceCtxMenu
Posted: 19 Jul 2015 12:59
by starstuff
Hi klownboy,
Would it be possible for WhiteSpaceCtxMenu to auto populate itself using tags database?
the idea is to search the tags database with tagged *.exe files with a special tag [whitespacectxmenu] and a filetype, this tells WhiteSpaceCtxMenu to get and add it on the menu.
example tagging C:\Windows\notepad.exe with [whitespacectxmenu]|txt
C:\Program Files\Adobe\Adobe Photoshop CC 2015\Photoshop.exe with [whitespacectxmenu]|psd,png
Code: Select all
/*** text file menu ***/
[b]$txt[/b] = <<<DOC
"Notepad|C:\Windows\notepad.exe" openwith "C:\Windows\notepad.exe"; [b]// whitespacectxmenu added this one[/b]
DOC;
$psd =<<<PSD
"Photoshop|C:\Program Files\Adobe\Adobe Photoshop CC 2015\Photoshop.exe" openwith "C:\Program Files\Adobe\Adobe Photoshop CC 2015\Photoshop.exe"; [b]// whitespacectxmenu added this one[/b]
PSD;
$png =<<<PICTURE
"Photoshop|C:\Program Files\Adobe\Adobe Photoshop CC 2015\Photoshop.exe" openwith "C:\Program Files\Adobe\Adobe Photoshop CC 2015\Photoshop.exe"; [b]// whitespacectxmenu added this one[/b]
PICTURE;
with this you just tag away *.exe files and it will show up on the menu.
Re: [Script] WhiteSpaceCtxMenu
Posted: 19 Jul 2015 14:13
by klownboy
starstuff wrote:the idea is to search the tags database with tagged *.exe files with a special tag [whitespacectxmenu] and a filetype, this tells WhiteSpaceCtxMenu to get and add it on the menu.
I suppose it would be possible, but honestly, I'm afraid I'd be lost when it comes to tagging. I have nothing tagged so that should tell you how much tagging I do. What is the purpose of "auto populating" those programs to the menu? Just so you don't have to do it manually or am I missing something? It's very little work to set up a good working WhiteSpaceCtxMenu. This seems like it would be more work at least initially setting up the tags. The script would also have to self modify or use an external file if it was to change the menu on the fly.
Re: [Script] WhiteSpaceCtxMenu
Posted: 19 Jul 2015 14:56
by starstuff
yes, one of the purpose is to make it automatic, another purpose is to track *.exe files quickly if its already on the menu or not and whats the related filetypes of the *.exe file, this is sort of a reference if you have many *.exe files like portable apps.and last is that the user wont need to use a text editor to add/remove associations.
i agree that its not hard to set it up using a text editor though, lets wait and see if there are other who might find this useful or not.
Re: [Script] WhiteSpaceCtxMenu
Posted: 13 Sep 2015 22:18
by CookieMonster
Someone was working on a similar script they wanted me to test, I can't find this thread or person ?
Re: [Script] WhiteSpaceCtxMenu
Posted: 13 Sep 2015 23:00
by highend
Then you should write your own!
Re: [Script] WhiteSpaceCtxMenu
Posted: 14 Sep 2015 04:15
by CookieMonster
It was already written, I have to find it !
Re: [Script] WhiteSpaceCtxMenu
Posted: 25 Sep 2015 14:20
by klownboy
Hey Stef123 , I was hoping you could check the operation of WhiteSpaceCtxMenu. Specifically, right click selecting of a files(s) from outside the file to the file to select it, and see if the menu comes up as it did before. It's not happening anymore since 15.80.0002 which added the modifiers for use in scripting. The menu displays if you select the file and then click on white but not the way described above. Thanks.