AutoHotkey Community

It is currently May 27th, 2012, 2:50 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: Front end for NirCmd
PostPosted: November 20th, 2009, 9:03 pm 
Offline

Joined: October 28th, 2006, 5:01 pm
Posts: 58
NirCmd is a powerful command-line utility. I made gui front end for some of the commands. Each button has a menu. Middle mouse button will show the gui at the location of the mouse.

You will need NirCmd for it to work:
Get NirCmd here: http://www.nirsoft.net/utils/nircmd.html

Image

Copy script to NirCmd folder or copy NirCmd.exe to c:\windows

Code:
CoordMode, Mouse, Screen
gui, font, s12, Arial bold
Gui, Color, bed3e8

Gui, Add, Button, x10 y10 w100 h30 , Programs
Gui, Add, Button, x10 y50 w100 h30 , Volume
Gui, Add, Button, x10 y90 w100 h30 , Utilities
Gui, Add, Button, x120 y10 w100 h30 , Clipboard
Gui, Add, Button, x120 y50 w100 h30 , Hide/Show
Gui, Add, Button, x120 y90 w100 h30 , Shutdown
gui, show, h130 w230
return

ButtonPrograms:
Menu, Launch, Add, Explorer
Menu, Launch, Add, Firefox
Menu, Launch, Add, CCleaner
Menu, Launch, Add, IE
Menu, Launch, Add, Taskmgr
Menu, Launch, Add
Menu, Launch, Add, Desktop
Menu, Launch, Add, StartMenu
Menu, Launch, Add, Startup
menu, Launch, show
Menu, Launch, Deleteall
return

Explorer:
run, nircmd.exe exec show "explorer.exe" "c:\program files"
return

Firefox:
run, nircmd.exe exec show "c:\program files\mozilla firefox\firefox.exe"
return

CCleaner:
run, nircmd.exe exec show "c:\program files\ccleaner\ccleaner.exe"
return

IE:
run, nircmd.exe exec show "c:\program files\internet explorer\iexplore.exe"
return

Taskmgr:
run, nircmd.exe exec show "taskmgr.exe"
return

Desktop:
run, nircmd.exe shexec "open" "~$folder.desktop$"
return

StartMenu:
run, nircmd.exe shexec "open" "~$folder.programs$"
return

Startup:
run, nircmd.exe shexec "open" "~$folder.startup$"
return

;====================================================================

ButtonVolume:
Menu, Vol, Add, Up
Menu, Vol, Add, Down
Menu, Vol, Add, Mute
Menu, Vol, Add, UnMute
menu, Vol, show
Menu, Vol, Deleteall
return

Up:
run, nircmd.exe changesysvolume 30000
return

Down:
run, nircmd.exe changesysvolume -30000
return

Mute:
run, nircmd.exe mutesysvolume 1
return

UnMute:
run, nircmd.exe mutesysvolume 0
return

;====================================================================

ButtonUtilities:
Menu, util, Add, Screensaver
Menu, util, Add, OpenCDrom
Menu, util, Add, CloseCDrom
Menu, util, Add, Time/Date
menu, util, Add, ScreenshotDesktop
Menu, util, Add, ScreenshotWindow
Menu, util, show
Menu, util, Deleteall
return

screensaver:
run, nircmd.exe screensaver
return

OpenCDrom:
run, nircmd.exe cdrom open d:
return

CloseCDrom:
run, nircmd.exe cdrom close d:
return

Time/Date:
run, nircmd.exe infobox "~$currtime.HH:mm$ ~$currdate.MM/dd/yyyy$" "Time/Date"
return

ScreenshotDesktop:
run, nircmd.exe cmdwait 2000 savescreenshot "shot.png"
return

ScreenshotWindow:
run, nircmd.exe cmdwait 2000 savescreenshotwin "winshot.png"
return

;====================================================================

ButtonClipboard:
Menu, clip, Add, Speak
Menu, clip, Add, Clear
Menu, clip, Add, Save1
Menu, clip, Add, Save2
menu, clip, Add, Save3
Menu, clip, Add, Save4
Menu, clip, Add, Restore1
Menu, clip, Add, Restore2
Menu, clip, Add, Restore3
Menu, clip, Add, Restore4
Menu, clip, show
Menu, clip, Deleteall
return

speak:
run, nircmd.exe speak text ~$clipboard$
return

Clear:
run, nircmd.exe clipboard clear
return

Save1:
{
run, nircmd.exe filldelete "clip1.txt"
sleep 1000
run, nircmd.exe clipboard addfile "clip1.txt"
}
return

Save2:
{
run, nircmd.exe filldelete "clip2.txt"
sleep 1000
run, nircmd.exe clipboard addfile "clip2.txt"
}
return

Save3:
{
run, nircmd.exe filldelete "clip3.txt"
sleep 1000
run, nircmd.exe clipboard addfile "clip3.txt"
}
return

Save4:
{
run, nircmd.exe filldelete "clip4.txt"
sleep 1000
run, nircmd.exe clipboard addfile "clip4.txt"
}
return

Restore1:
{
run, nircmd.exe clipboard readfile "clip1.txt"
run, nircmd.exe exec show "notepad.exe" "clip1.txt"
}
return

Restore2:
{
run, nircmd.exe clipboard readfile "clip2.txt"
run, nircmd.exe exec show "notepad.exe" "clip2.txt"
}
return

Restore3:
{
run, nircmd.exe clipboard readfile "clip3.txt"
run, nircmd.exe exec show "notepad.exe" "clip3.txt"
}
return

Restore4:
{
run, nircmd.exe clipboard readfile "clip4.txt"
run, nircmd.exe exec show "notepad.exe" "clip4.txt"
}
return

;====================================================================

ButtonHide/Show:
Menu, hide, Add, HideFirefox
Menu, hide, Add, ShowFirefox
Menu, hide, Add, HideSL
Menu, hide, Add, ShowSL
menu, hide, Add, HideIcons
Menu, hide, Add, ShowIcons
Menu, hide, Add, MinimizeAll
Menu, hide, Add, RestoreAll
Menu, hide, show
Menu, hide, Deleteall
return

HideFirefox:
run, nircmd.exe win hide class "MozillaUIWindowClass"
return

ShowFirefox:
run, nircmd.exe win show class "MozillaUIWindowClass"
return

HideSL:
run, nircmd.exe win hide class "Second Life"
return

ShowSL:
run, nircmd.exe win show class "Second Life"
return

HideIcons:
run, nircmd.exe win hide class progman
return

ShowIcons:
run, nircmd.exe win show class progman
return

MinimizeAll:
run, nircmd.exe win min alltopnodesktop
return

RestoreAll:
run, nircmd.exe win normal alltopnodesktop
return

;====================================================================

ButtonShutdown:
Menu, Shut, Add, Standby
Menu, Shut, Add, Logoff
Menu, Shut, Add, Reboot
Menu, Shut, Add, Shutdown
Menu, Shut, show
Menu, Shut, Deleteall
return

Standby:
run, nircmd.exe qboxcom "Do you want standby?" "question" standby
return

Logoff:
run, nircmd.exe qboxcom "Do you want to logoff?" "question" exitwin logoff
return

Reboot:
run, nircmd.exe qboxcom "Do you want to reboot?" "question" exitwin reboot
return

Shutdown:
run, nircmd.exe qboxcom "Do you want to shutdown?" "question" exitwin poweroff
return

;====================================================================


mbutton::
MouseGetPos, x, y
mgx:=x-115
mgy:=y-85
Gui Show, x%mgx% y%mgy%
gui, show
return
 
mbutton & rbutton::
{
run, nircmd.exe win hide class "MozillaUIWindowClass"
run, nircmd.exe win hide class "Second Life"
}
return



Last edited by netfun81 on November 25th, 2009, 9:03 pm, edited 2 times in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 21st, 2009, 7:53 am 
Doesn't Autohotkey do most of these functions? Is there a benefit to using another program?


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: November 21st, 2009, 7:53 pm 
Offline

Joined: October 28th, 2006, 5:01 pm
Posts: 58
With AHK you can probably do all these functions but not as easily since they are built in to NirCmd. Also, there are times when a simple one line command is nice. NirCmd is another great tool like AHK, it works with scripts, ini files, and the windows registry. It's good to have a few great tools in ur toolkit :}

Edited original script to add more clipboard functions.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 23rd, 2009, 9:23 pm 
The added clipboard items look nice. Just reading though the nircmd help..it really does do a lot!


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: November 23rd, 2009, 9:56 pm 
Offline
User avatar

Joined: June 8th, 2008, 9:08 pm
Posts: 81
Location: New Europe
netfun81 wrote:
With AHK you can probably do all these functions but not as easily since they are built in to NirCmd. Also, there are times when a simple one line command is nice. NirCmd is another great tool like AHK, it works with scripts, ini files, and the windows registry. It's good to have a few great tools in ur toolkit :}


/Agree

I love Nir Sofer's work, NirCmd is just a classic example of a long line of small simple (but extremely powerful) kick ass tools.

Nice work netfun81, although I have to admit that I use the command shell version of NirCmd 99% of the time, and agree that Ahk could probably do a great deal of nircmds functionality with the addition of being able to add your own personal touches to it. :)

But... no denying a great tool.

_________________
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 25th, 2009, 9:09 pm 
Offline

Joined: October 28th, 2006, 5:01 pm
Posts: 58
Decided to change the type of gui to make it cleaner and easier to add options in the future. Edited original post.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 26th, 2009, 7:44 pm 
The interface improvement is way better. Makes it simple to get to the command you want. Thanks!


Report this post
Top
  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Google Feedfetcher and 9 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group