Can you add a menu item to Photoshop with scripting? - photoshop-script

I've written a script that has a couple of functions for copy and paste. I'd like to add a menu item (maybe under Edit) for both and link them to each respective function. Is this even possible? I'm using CS6 Javascript. Thanks.
An example that shows how to create a menu item that calls a function containing an alert would be very helpful.

This is the closest I've found to create a menu item. That is, scripts placed in a particular folder will be automatically found on restart, and then you can create keyboard shortcuts allowing for quicker access.)
Add your script to the Preset folder (It'll be something like, C:\Program Files\Adobe\Adobe Photoshop CC 2014\Presets\Scripts)
Restart Photoshop and your preset will be listed with the other scripts in the (File -> Scripts) menu.
Add a keyboard shortcut to the menu item. In the (Edit -> Keyboard Shortcuts) menu, expand the (File -> Scripts) tab and follow the instructions to add shortcuts.

I don't believe so. Creating menu items requires you to create a plug-in with the Photoshop SDK. There are many examples that come with the included documentation.

It is possible to create menu items by using Adobe's Generator tool. See below link for more information.
https://github.com/adobe-photoshop/generator-core
_generator.addMenuItem(id, label, true, false).then(
function () {
console.log("menu item added:", label)
}, function () {
console.error("unable to add menu item", label)
}
);

Related

Add toolbar button to TFS' "My Work" in Visual Studio

I find I go to the My Work pane inside the Team Explorer frequently, but I haven't found a way to get there in one click. I can create a shortcut key for the command TeamFoundationContextMenus.Commands.GoToMyWork and that works, but I'm looking for something I can click on a toolbar.
So specifically, my question is: where in the toolbar customization "Add Command" list does this option exist? There are several categories and many items in each, and I haven't found a way to search, only scroll.
More generally, and if the option doesn't exist, is there a way to use the command name in the keyboard shortcut customization to create a toolbar button for that command?
For a toolbar you can add commands only from the existing VS menu.
For additional commands, you can create an intermediate Visual Commander command DTE.ExecuteCommand("TeamFoundationContextMenus.Commands.GoToMyWork") and then add this VCmd.Command01 command to a toolbar.

How to add function to the mouse right-click menu in desktop

desktop: window server 2003
Assume i have a cmd.sh that echo a message, here i want to run it in anywhere , when i right click the mouse and choose the echo function.
hope for your answer, thanks
Editing the registry as #dbvega indicates works if you always want the same menu item to appear. This is called a static menu. But if you want to do have more control over your menu item, such as changing the visibility, text, and icon depending on various runtime conditions, you need to create a dynamic context menu shell extension, which involves programming a COM object. This MSDN article describes the difference.

Windows 7 right click "Send to" file context menu

When I right click a file (in any folder) I see an option "Send to" and inside
Desktop
Documents
...
and a bunch of other locations.
How can I add my own location, ie "C:\stuff" to this context menu?
Open file explorer and navigate to: %APPDATA%\Microsoft\Windows\SendTo
Once in the SendTo folder, right click -> New -> Shortcut
In addition to the default shortcuts in the SendTo menu, there are hidden options that are exposed if you hold down shift while right clicking the targeted icon.
(This is Windows 7 only)
The easiest way to add your own is to type "shell:sendto" in a file explorer, ( or start -> run -> sendto ) and place whatever shortcut you deem useful. As mentioned before you can add shortcuts to programs as well as directories.
(This is more universal)
HERE is a nice article with a picture instructions.
in addition to shortcuts to folders, you can add shortcuts to apps. for example, add a shortcut to "send to notepad" to open a file in the notepad app. a useful function for a developer.

Hide items in the right-click context menus in Visual Studio 2010 (08)?

The right-click context menus of the source editor, the project items and the solution item, is getting ridiculously long, and two of them even have scrolling now on my 1680x1050 screen.
Is there any way for me to hide items on these menus, even if I have to add an event to my Visual Studio macro-system and find and hide them manually?
Here's examples, many of these items I never use:
Edit1: The current answer + comments suggest I should use the Customize menu item in the toolbar context menus, go to the second tab, Commands, and use the Context Menus radio selection and find the relevant menus there.
Here are 3, which are suggested by comments:
As you can see, they're all empty.
Edit2: After clicking the "Reset All" button in that dialog, for the Solution and Project menus, I got items in the dialog, that I could edit, but the changes did not affect the actual context menu on either a project or the solution file. Also, after restarting Visual Studio, the dialog contents for those two were again empty.
In Visual Studio 2010 you can:
Goto Tools->Customize
Select the Commands tab
Select the Context menu radio button
Select the appropriate context menu from the dropdown list to the right, and delete away
I believe Visual Studio 2008 is similar.
You will need to choose the correct context menu in the Customise option.
Go to Tool > Customise,
Then choose the Context menu as you did in your Edit1 screenshots but choose "Editor Context Menus | Code Window" from the dropdown menu instead.
From there you should be able to delete whatever command you don't need from your context menu. Next, for the other commands that can't be found in Editor Context Menus | Code Window (mostly plug-ins or extensions related commands) you will have to go through other categories.
For example, I am using CodeMaid and when I right click a file in Solution Explorer the context menu below are shown
In order to remove the 'Cleanup Selected Code' command I will have to choose the Project and Solution Context Menus | Solution Folder dropdown option.
Added: Here is my sample reduced context menu (removed Copy, Cut, Paste, Outline Menu and Create Snippet...)
Hope this helps =)
Edit: In case you want to add back the commands you removed you can either add them back using New Command... or just press Reset All. Keep in mind the later will restore all the commands. Thus unless you are really having trouble finding the removed command use the first method.
I use 3 VS extensions and these 3 are responsible for polluting the context menu:
VSCommands
Power Commands
Power Toys
Using their own options dialogue, it's possible to subject showing those menus to pressing CTRL (in VS Commands) or completely disable them (the other 2 extensions)

Adding item to the Desktop context menu in Windows

I want to add an item into the Desktop context menu (the menu you see when you right-click on an empty space on the Windows Desktop).
Something like Catalyst Control Center in this screenshot:
I know how to add items to files' and folders' context menus through registry, but the Desktop seems to work differently: I didn't even find the text in the registry.
So, how can I add a new item into the Desktop menu and how can I associate some code with it?
I think the solution is language independent, if it's not, I'd appreciate any code that helps.
Such a handler must be registered in HKCR\Directory\Background, instead of usual locations like HKCR\Directory, HKCR\Folder, etc.
Check out Creating Shell Extension Handlers in MSDN.
There's a series of articles on CodeProject that details writing Shell Extensions and is very good:
http://www.codeproject.com/KB/shell/shellextguide1.aspx

Resources