powerpoint
Autocompleting ssh, rake, cap command parameters using PowerShell
I have mentioned in my previous posts that PowerShell has excellent and customizabme autocompletion support.
And some awesome plugins like powertab exist to take this functionality to another level.
Here is one easy way you can customize autocompletion easily by writing a couple of lines of code.
Open your PowerShell profile file (for help see here) and create a function with name "global:TabExpansion" in it.
This function basically overrides default autocompletion and sends your values to the prompt. For example for it to read your ssh files and display hosts in it the function would look something like this:
# customized tab expansion
function global:TabExpansion {
param($line, $lastWord)
if ($line -match 'ssh'){
return cat C:\Users\Gaurav\.ssh\config | Select-String '^Host ' | % { if($_.Line -match "^Host ($lastword\S*)" ){ $matches[1] }}
}
}
Automating Powerpoint with ruby
We know that ruby is a language of few words. We can express a lot of things in a relatively easy manner.
I was trying to export few slides in my powerpoint presentation to an image format using ruby.I could not find any documentation for it anywhere except for a few basic things. But when I tried it by hit and trial I found out it to be surprisingly easy. It required just a few lines.
Here is what you have to do:
1: require ‘win32ole’
2: # open powerpoint
3: ppt = WIN32OLE.new(‘Powerpoint.Application’)
4: # make sure it is visible
5: ppt.Visible = true
6: # open the presentation to be exported
7: pre = ppt.Presentations.Open(“d:\\imp_file.pptx”)
8: # export the file
9: pre.Slides(1).Export(“d:\\exp_file.png”,“png”)
10: # close powerpoint, will close all the currently open files
11: ppt.Quit()
You can always use RMagick to further process this image.
The Win32OLE extension library (actually spelled in lowercase, win32ole) provides an interface to Windows OLE automation. Your Ruby code can act as a client for any OLE automation server such as Microsoft Word, Outlook, and Internet Explorer and many other softwares.
So in the above code we are making a object is Powerpoint application, then opening a file and saving the first slide in the “png” format.
Blogroll
Recent Posts
- Autocompleting ssh, rake, cap command parameters using PowerShell
- Using RubyAmf for creating a CRUD application in Rails
- Multiple ways to open PowerShell in the current Explorer window
- Context sensitive auto-completion using PowerShell, PowerTab and GIT
- Displaying GIT Branch on your PowerShell prompt
XBox Live
Songs I like
Categories
- adobe (4)
- amarok (1)
- C# (2)
- chat application (1)
- crud (2)
- cygwin (1)
- explorer (1)
- expression blend (1)
- flex (4)
- FOSS (2)
- free (1)
- GIT (3)
- ID3 (1)
- java (1)
- microsoft (3)
- mxml (2)
- nokia (1)
- open source (5)
- perl (1)
- powerpoint (2)
- powershell (3)
- rails (3)
- right click (1)
- ruby (9)
- ruby on rails (3)
- security (3)
- silverlight (4)
- smart playlist (1)
- socket (1)
- software (7)
- ssh (1)
- sudo (1)
- tabs (1)
- tomcat (1)
- user interface (6)
- vista (9)
- vista, security (2)
- visual studio 2008 (1)
- win32ole (1)
- windows (13)
- windows media player (1)
- wpf (1)
- xaml (4)
- XP (3)
