Integrate with the Windows Shell - windows

OK,
I want to create a windows shell extention that sits in the file menu much like the "Tortorise SVN" menu.
Does anyone know where I'd begin, a good article, or what interfaces to implement?
Thanks!

It's pretty straight forward actually. It's about a 3-4 step process. You didn't specify what language you were using.
Here's how to do it in native code:
http://www.kbcafe.com/articles/HowTo.Shell.pdf
Here's how to do it with .NET. Note that it is essentially the same as doing it with native code.
http://www.theserverside.net/tt/articles/showarticle.tss?id=ShellExtensions

Ah... Shell extensions... they can be a real pain in the butt if they're complicated, but you can do so much neat stuff. A great place to start is Mike Dunn's Complete Idiot's Guide To Writing Shell Extensions on codeproject.com.

There's an O'Reilly book called VB Shell Programming which goes into the API's in some depth. As the title suggests, it's aimed at Visual BASIC, but the API's are exposed through COM and the techniques discussed in the book are applicable for pretty much anything that supports COM. A quick look on Amazon.com suggests you can probably pick up a secondhand copy for a few dollars.

Avoid codeproject (for kids, full of bugs) and read the complete doc of MSDN on SNE.

Related

Creating a scripting language

Can somebody please guide me in the right direction of creating a scripting language that targets the WSH (Windows Scripting Host)?
I have googled for it, but there seem to be far fewer links related to this than when I originally searched for it a few months back.
THank you
The product is now called "Windows Script Host". The MSDN documentation suggests that what you want is a Windows Script Engine, about which the documentation claims that you can create one for any programming language or environment—presumably including one you create yourself. Beyond that, the documentation is not terribly clear.
You should be able to find all necessary information about creating Windows Script engines on MSDN; other than that there seems to be no resources available (at least I couldn't find any). You can also take a look at some open-source engine implementations to get the idea of what your code should look like:
PHPScript
ActiveScriptRuby
Open Object Rexx
If you have any specific questions about implementing Windows Script interfaces, feel free to ask them here. Good luck!
Topic starter need to carefully read the script56.chm, which can be found on MSDN. This help file describes WSH engine specification.

Learning AppleScript

What resources would you recommend to pick up AppleScript. I come with a traditional C/C++ with Objective-C background.
I am also looking for tips on how to develop better and get faster documentation from the script editor. A sample tip would be 'lookup the sdef file of the app you want to script.
I learned from AppleScript: the Definitive Guide. The free documentation available online at that time was quite confusing and incomplete, but that book taught me everything I needed to know. I'm not sure if the docs have improved since then (2005-ish).
As for tips on getting documentation, the script editor's "Open Dictionary" command is about the only documentation you'll get for most applications.
I recommend Applescript: The Definitive Guide like Ryan Ballantyne. Apple's own documentation is very good: Scripting and Automation: Applescript. I would seriously recommend reading lots of Applescript code as well, this is as important, if not more important, than reading these other resources. It is important to get a feel for what makes good and bad Applescript because there is an ocean of difference in readability between the good and the bad. You can find lots of code to read in Apple's material and at macscripter.net.
If you are going to be doing any, even remotely, serious development with Applescript, I highly recommend getting a copy of Script Debugger from Late Night Software.
Apple's own Script Editor and Applescript Studio (which is simple Script Editor wrapped in Xcode) offers no debugging tools, you'll rely solely on their (sometimes esoteric) error messages and your own cowboy debugging (the "log" command). Script Debugger picks up where Script Editor leaves off—proper debugging, code stepping, code completion—and also runs scripts much faster. I can learn a lot about how a an unfamilar application implements Applescript with Script Debugger because the dictionary reader will actually give the exact syntax needed to use a command in most cases.
I agree with the folks above. Start with Soghoian's book. Very good. And then The Definitive Guide. Also, get on the Applescript Discussion list. Very good, with the author of the Definitive Guide being a major contributor to that.
And get ScriptDebugger 5. Absolutely necessary for serious Applescripting. I use it to automate Photoshop, Filemaker, and my Mac do to pretty complex things in managing photos and metadata for my employer.
Another suggestion: while reading up on AppleScript, take a look at Appscript which makes the Apple Event technology underneath AppleScript available in Python, Ruby, or even Objective-C. Why? Many people find the AppleScript language itself lacking compared to more modern languages like Python or Ruby. But whichever way you choose, be prepared for a certain level of frustration. Much of the power of Apple Events and scripting comes from the richness of the data models that AppleScript-able applications can implement. Unfortunately, every AppleScript-able application has its own implementation quirks and often there is a fair amount of hunting and pecking guesswork until you find the incantation that works for a particular operation. HAS touches on some of this here.
Appscript also provides some developer tools, like ASDictionary which exports applications' terminology as plain text or HTML files and in AppleScript or appscript formats.
http://osxnotes.net/applescript.html: notes, scripts, and AppleScript oneliners
https://developer.apple.com/library/mac/documentation/applescript/conceptual/applescriptlangguide/AppleScriptLanguageGuide.pdf
http://www.apeth.net/matt/downloads/ASTDG2Scripts.txt: example scripts from AppleScript: The Definitive Guide
http://www.amazon.com/Learn-AppleScript-Comprehensive-Scripting-Automation/dp/1430223618: my favorite book about AppleScript
http://www.cs.utexas.edu/~wcook/Drafts/2006/ashopl.pdf
http://www.cs.utexas.edu/~wcook/papers/AppleScript/AppleScript95.pdf
http://dl.acm.org/ft_gateway.cfm?id=1238845&type=pdf&path=%2F1240000%2F1238845%2Fsupp%2FAppleScript%2Epdf&supp=1&dwn=1&CFID=334275816&CFTOKEN=16694215
This isn't exactly a good place to start, but the document that I found most useful was a discussion on the design of AppleScript written by one of its original designers.
It mostly talks about the evolution of AppleScript from an idea to an implementation. There's a technical part in the middle, though, that really glued a lot of things together for me. I was interested to learn that most of AppleScript's design stemmed from limitations in MacOS at the time. There's also a bit at the end reflecting on how AppleScript has fared over the years.
I'm trying to learn as well.
Currently reading http://macscripter.net/viewtopic.php?id=24729
It's really good. But the link in the post is broken, so you have to search for the next post.
And my next stop is: http://mac.appstorm.net/how-to/applescript/the-ultimate-beginners-guide-to-applescript/
I'm in the middle of AppleScript 1-2-3 by Sal Soghoian who is in charge of the AppleScript program at Apple; step-by-step, good

What real-world projects would you suggest as code examples to study?

What real-world projects would you suggest looking through the sources?
As I'm learning Java Swing, mucommander seems to be a decent example. The code is excessively commented though.
EDIT: No shameless plugs plz :).
I learned a lot from looking at the source code to GoGrinder. It's well thought out, uses MVC correctly, and the comments are helpful (and no, I didn't write it). It's also a fun program to use if you want to learn how to play Go.
For Gui design, Patterns and general good advice I highly reccomend Jeremey Miller's series of articles on building a better CAB. For C#, but equally applicable to Java. Also using
the MVC style which Stackoverflow follows, and Apple uses for Interface Builder.
Build your own CAB
Jeremy's articles/ideas are followed in his own project, which you can download and inspect at http://storyteller.tigris.org/
Take a look at the Windows version of truecrypt. It is one of the best organized open source projects I've ever seen. You can almost tell how the whole thing works just from the directory and file layout.
What I've done to learn some new technologies over the years is to look to open source projects that both match the criteria you're looking for and also interest you.
I'm not a Swing guy, but I'd suggest finding a project that uses Java Swing, does not appear too complicated, and then start digging through the source. The nice thing is you can then see the app before you start poking through it, and then you can see what happens as you change stuff.
The idea behind picking something that interests you is that it will keep you engaged. I am intrigued by content management systems, so I might download a CMS that I can then see how stuff works, and I'm engaged because the problem domain of the project fits in with an interest.
I've done this once or twice when I had to get up to speed on C# and I think it works will. YMMV....
Some of the most well thought out source code ( c++ ) I have seen in an open source project is the Ogre3D graphics engine, I've learned a lot about OOA&D just by looking at the structure and reading the comments. It is also well maintained and the community is very active.. http://ogre3d.org

Tracking Useful Information

What do the clever programmers here do to keep track of handy programming tricks and useful information they pick up over their many years of experience? Things like useful compiler arguments, IDE short-cuts, clever code snippets, etc.
I sometimes find myself frustrated when looking up something that I used to know a year or two ago. My IE favorites probably represent a good chunk of the Internet in the late 1990s, so clearly that isn't effective (at least for me). Or am I just getting old?
So.. what do you do?
­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
Two Things I do:
I blog about it - this allows me to go back and search my own blog.
We use the code snippet feature in Visual Studio.
Cheers.
I use:
Google Notebook - I take notes for projects, books I'm reading, etc
Delicious + Firefox plug in - Every time I see a good page I mark it.
Windows Journal (in tablet pc) - When I need to draw something and then copy/cut/paste it. I have more distractions here, the web is always very close :)
Small Moleskine paper notebook - Its always with me.
Big paper notebook - When I need more space to write and less distractions.
Obviously these are for all useful information, not just for snippets or tips and tricks.
Why not set up a Wiki?
If you are on windows, i know that ScrewTurn wiki is pretty simple to deploy on a desktop/laptop. No database to fuss around with.
Blog about it.
One of the nice side-effects of blogging is that if you use a sensible categorization or tagging system, it's quite easy to search for stuff within your blog. The fact that you wrote about it also makes it easier to remember problems you have encountered before ("hey, I blogged about that!").
That's a great benefit aside from, of course, being able to share this information publicly so that others might be able to find your solution to a particular problem using Google.
A number of people I know swear by Google Notebook
I send them to my gmail account, that way I have them where ever I go, and they can be put into appropriate folders for later.
I second the blog about it technique...even Jeff said that's a major reason he blogs.
Also, regarding the wiki idea, if you set one up at work, be sure to encourage your coworkers to do the same. When someone finds something of interest they can just write a little "article" explaining what it is and how to do it... that way, not only are your own things easily available and quickly searchable, but you'll often find out things you never knew from other people in your group. That way it benefits everyone not just you.
I agree with emailing, the wiki and the blog. Emailing is the most useful. If you can't use GMail and you're on windows, install a desktop search utility (Windows search, Google Desktop, Copernic, etc)
I also like to jot it into a textfile and save it in my documents folder. Whatever desktop search utility you use will be able to find it easily. e.g.
//print spool stop.notes.txt
If the printer spooler stops, start it again by
- Services > Provision Networks > Restart Service
tags: printer provision no printer spooler cannot print remote desktop
Subscribe in Google Reader and then search later.
At my last place of work they wouldn't let me set up a wiki or anything - so I just made various word documents full of tips and instructions and gave that to my successor when I left.
Now though I'd use a private wiki, or maybe a blog.
For many years I've kept a Word doc named Knowledgebase.doc that contains all my notes with a decent table of contents. I like to keep everything in one searchable doc.
I use a sync tool to make sure the file is copied to all the machines I want it on.
I use TiddlyWiki stored in my DropBox account. Although, recently, Evernote is getting my atention; it has a really useful feature: you send a twitter direct message to evernote user (myen) and it adds a note with your message (a really quick way to add notes or URL's for post-processing). Imagine, you can use a command-line twitter client to create notes! (or any twitter client). I really like this feature.

Easy installation method for windows/ Batch Reference needed?

I have a bunch of files that I need to be able to transport and install quickly. My current method for doing so is moving a flash drive with a readme file of where stuff goes whenever I need to move stuff, which is rather inelegant and cumbersome.
My idea for a solution would be to write up a quick script to move files around that I could just click on. I've done some bash scripting before but batch scripting is a little odd to me. Does anyone have a good online reference guide I could use?
An alternative soulution I could accept would be a program that makes an installer for you, though I'm a bit against that as I would lose a lot of control. However, I'd be alright with it if it was extremely simple,
Sounds like robocopy tool is exactly what you need.
Very powerful replication command-line tool.
MS TechNet reference,
Wikipedia article about robocopy,
Full command switch guide,
Batch scripting guide.
I like to use VBscript for this kind of thing. The VBS engine is on every recent windows machine and the language is a little more like real programming than a batch script.
Also, if your installer grows to require WMI functions too, this becomes a piece of cake.

Resources