Attach event listeners to in application items with Adobe extendscript - event-handling

The title pretty much sums it up. But, basically is it possible with Adobe applications to add event listeners to in-application items, such as a pathItem in Illustrator?
So I want something to happen when I click on a pathItem in Illustrator - or something like that. Is this possible?
I'm afraid I know the answer.

Sorry. That is not possible with scripting. Maybe with a plugin.

You can use Scriptographer, it's a scripting plugin for Illustrator with own scripting engine with keyboard and mouse events.
But this plugin works with old illustrator's version (CS5 and older).

wouldn't this work to handle the click/selection event?
AIEventAdapter.getInstance().addEventListener(AIEvent.ART_SELECTION_CHANGED,function(event) {});

If you are talking about exported PDF's or SVG's, you are able to add a link in the attributes panel and insert any javascript you like:
javascript:alert('you clicked on this line');
If you want something to happen in Illustrator, while you are using the program, then there is no way as far as I know to affect anything.
You can run scripts using keyboard shortcuts.
If you could clarify your use case I might be able to help more.

Related

Drag selected text to move it?

Is it possible to drag selected text to move it? This is in almost every other editor (not to mention text input fields in browsers.) I was surprised not to find it in VS Code.
Here is a gif example.
This is now supported as of Feb 2017 release (1.10.1) but it is disabled by default.
To enable it: Go to File > Preferences > Settings and add this line "editor.dragAndDrop": true
Source: https://code.visualstudio.com/updates/v1_10#_preview-drag-and-drop-selected-text
Looks like it's not yet implemented, but there's an open issue about it.
If you want to help without diving into the internals, go 👍 the issue to add to its social signal.
I don't believe so. Their site says that it is keyboard-optimized and keyboard-centric, so their idea might be that you should highlight some text, cut it, and past it where you want it rather than dragging it.
I talk about this problem on Github Microsoft page and Microsoft engineers see this. I hope to solve it. (Please support by 👍 on this page.)

Way to use a native editor for textarea (or JS-powered WYSIWYG editor)?

I'm looking for a way to use my favorite "native" editor, Sublime Text 2, to fill textareas and/or WYSIWYG-editors like TinyMCE.
I'd like to have some kind of daemon, service or browser extension that waits for, say, a focus event on a textarea and opens a new Sublime Text 2 window for me to type in. Everytime I save (could be to a file in a temporary directory for all I care), the background daemon/service/extension/… updates the contents of the web form field.
So much for my ideal scenario. Is there any way you know of to make this possible (FYI, I'm working under OS X Lion)?
I don't know what browser you're using, but there's an extension for Firefox called "It's all text" where you can:
Right click on a textarea, select "It's All Text!" and edit the text in the editor of your choice.
You can also make a shortcut instead of rightclicking.
[EDIT] And for Google Chrome now there is: https://github.com/Cacodaimon/GhostTextForSublimeText
P.S. In an ideal world all textareas should be small ST2 windows...
Sure, this is possible.
You'll need to write a browser extension for it.
Look for a snippet saving addon on whichever browser you use, go through the source code, figure out how it works, then make one to fit your use-case.
In the meantime, repeat: Ctrl+C, Alt-Tab, Ctrl-V!

Implement page scrolling (like hand tool in Acrobato Reader) in my Eclipse Plugin Editor

I'm developing an Eclipse Plugin Editor that has a Flyout Palette with several tools in it (like selection and so on).
I was wondering how to add a special tool (let's call it "hand tool") that scrolls the page in the same way the "hand tool" of the Acrobat Reader scrolls the page of a PDF document.
I'm googling for some ideas of how to tackle this problem, but with no success, so far. Could you please give me some hint?
Thanks in advance :)
I assume you are using GEF? My answer may be trivial, but i'm trying to throw in some ideas.
org.eclipse.draw2d.Viewport class has pair of getViewLocation()/setViewLocation() metods. It seems that using them you can scroll your view as desired.
Now you'll need a tool. Explore the hierarchy of org.eclipse.gef.tools.AbstractTool descendans to find some examples of desired behavior and create your own tool class for your functionality.

How to add views to Show In menu for particular file types

I use an older plugin called Veloeclipse for editing Velocity templates in Eclipse. There's been no development on this since 2009, which isn't a problem because it's mainly just for syntax highlighting and format validation. The really annoying thing about it, however, is that when I try to do Show In to view the current Velocity template within my Package Explorer or Project Explorer, the only available option is Properties. That's not really useful. I really need to be able to get to the file in one of the regular explorer views.
So I have sort of two questions:
Is there a way to configure this without having to monkey with any code? A configuration file or something? I've grepped through my Eclipse installation and haven't seen anything, but I'm hoping that there's something I'm missing.
So assuming that the answer to my first question is no, how do I go about modifying the plugin code so that it will show more than the Properties view in the Show In menu? Most of what I found on the plugin development wiki comes from the other direction: how to make your view or perspective appear in the Show In menu.
Any help with this would be hugely appreciated!
Try to check the plugin source code. it might do something different than other editors. What I mean is that the show in menu item that you have there is not the usual extension point but a hard coded context menu option.

Is it possible to work in Eclipse with keyboard only?

as most of us surely do every now and then, I try to improve my workflow. As Eclipse is my main IDE, I wondered if it may be possible to use it without mouse. I browsed the available shortcuts and tried to use them instead of my mouse. I found interesting features like Ctrl+3 which opens something like the Apple spotlight.
I know there are a lot of questions concerning favorite shortcuts etc. but I'd like to know if it works because at the moment it feels a bit squishy 100% without mouse.
So is anyone out there using Eclipse like that? And are there some hints to ease the change?
Yes, it is possible. For a start, check out 10 Eclipse navigation shortcuts every java programmer should know. When you use these 10 shortcuts and some of the shortcuts of the comments, you will already see a big performance boost.
The "open type" and "open resource" dialogs are CamelCase-sensitive, so when typing "NPE" in the open type dialog, I get two matching items NoPermissionException and NullPointerException. So using good names with consistent spelling is a must.
Ctrl+F11 starts a program, F11 debugs it. Note howewer to check if in Window-Preferences-Run/Debug-Launching the value of "Launch Operation" is set to your needs.
You may want to customize the search dialog (Ctrl+h) to only show the file search (default is to context sensitively present you with different search tabs).
Ctrl+n allows you to create something new (opens a wizard with an initial filter text to filter the possible next pages).
I'm a blind programmer who uses eclipse. While there are plenty of shortcuts I find people often overlook using menus from the keyboard. If there's a function you use a lot that doesn't appear to be supported with keyboard shortcuts you can either create a shortcut to it in prefferences or use keyboard shortcuts such as alt+f to access the file menu and a one letter combination that allows you to access the item. For example hit alt+f then a to access the save as dialog. The underlined letter is the one you want to hit once in the menu.
There are a couple of things you can do to improve your keyboard:mouse usage ratio with Eclipse.
First off, if you push Ctrl-Shift-L, it shows you a master list of all the shortcuts you can use. If you know what you want to do, this is usually a quicker way of doing it without having to dig through menus, and as a bonus, you will learn some shortcuts you didn't know before.
The other thing you can try is a plugin called MouseFeed which looks promising. It tells you the shortcut for any menu item you use and if there isn't one, reminds you to create one. It essentially acts as training wheels until you become as close to 100% keyboard use as possible. I'm not sure how well it works in 3.4, but you can give it a shot.
Hope that helps.
Here you get an Eclipse Shortcut Overview PDF file of all key bindings. This file you can print and put beside your keyboard if you wish.