Hello Visio guys, the following thoughts..
Now in Visio you can only save macro code in documents (in stencils also, but stencils are documents as well in principle)
This is fine, but may not be especially that practical, as to use a macro / command you have to have a document which contains it.
I think the following could make sense:
An
online code repository for macroces or macro-commands / snippets can be done.
To not invent a wheel, the
Github Gists site can be used as back-storage:
http://gist.github.comThis is a service which allows you to create snippets online, and track history of changes; also it provides nice API for programmatic access (via REST)
In Visio (and maybe in other office apps?) it is possible to create an extension which would allow user to easily work with that from inside of Visio.
I.e. list "his" macroces, edit "his" macroces, search for macoces, apply them (see screenshot)
Possible features- Storing all my macroces in the "cloud" and use it for all documents.
This has an advantage that all "my macroces" become immdiately available, not matter from where I start Visio.
- Since gists is a code repository, we get the history of code changes "for free", comments, popularity, and other social features.
- You could use a macro only for yourself and not show it to anyone, or share it with specific people or just everybody
(note that it will also become available online on the gists site!)
- You could do a full-text search on online base of code.
Could be useful to get the code piece you need.
- You should be able to apply macro without adding it to the document.
Means, the documents should can kept macro-free. Means, you should be able to just "apply" macro to e.g. "selected shapes", "selected page", "each files"
Maybe it makes sense to provide a possibility to create a "keyboard shortcut" or "button" out of a macro for ease of use.
Security considerationsSince the github repository is not anonymous, only developers will be able to change their own macroces; others will also able to contribute, but though "pull requests".
This could provide the first frontier of protection against malicious stuff.
The second frontier is that macroces are all plain text and you can always see what you are going to execute.
Also it is possible to e.g. limit execution engine to Visio API objects only, so that it does not allow creation of "foreign" objects using "CreateObject" for example.
The code can be in VB-script form (since there are tons of such code). It is also possible to allow other script engines in principle - like C# "script" for example (esp. with introduction of Roslyn) or Python.
Usage scenarios:
- Keeping "handy shortcut commands". E.g. I have scriplet which applies specific format/colors/style to a shape, then I select all shapes I need to format that way, click "Run for selected shapes" and my scriplet is executed for all such shapes, so the shapes are changed as needed, and no code is introduced into documents.
- Mass update of diagrams. For example, in scenario where I need to replace a specific shape on background for 100 files. I just make a small "script" in Visio, then apply it to 100 files.
- Easy discovery of code. I could be able to search online database of code.
- Easy sharing of scripts with others.
What do you think about all this?
Thanks!