Welcome Guest.   Make a donation to an author on the site April 18, 2014, 05:36:58 AM  *

Please login or register.
Or did you miss your validation email?


Login with username and password (forgot your password?)
Why not become a lifetime supporting member of the site with a one-time donation of any amount? Your donation entitles you to a ton of additional benefits, including access to exclusive discounts and downloads, the ability to enter monthly free software drawings, and a single non-expiring license key for all of our programs.


You must sign up here before you can post and access some areas of the site. Registration is totally free and confidential.
 
The N.A.N.Y. Challenge 2010! Download 24 custom programs!
   
   Forum Home   Thread Marks Chat! Downloads Search Login Register  
Pages: [1] 2 Next   Go Down
  Reply  |  New Topic  |  Print  
Author Topic: NirCmd Setup, a guide of sorts  (Read 15019 times)
nontroppo
Charter Honorary Member
***
Posts: 648


spinning top

View Profile WWW Give some DonationCredits to this forum member
« on: September 10, 2005, 09:51:55 AM »

OK, here is a preliminary guide to use NirCmd. The most complex part really is the Regex, because we want to be able to optionally specify options, but not be forced to. So here is the regex:

[copy or print]
cmd(?:\s|)([^\s]*)(?:\s|)([^\s]*)(?:\s|)([^\s]*)(?:\s|)([^\s]*)

Don't get too scared! This is basically just composed of two sections repeated 4 times:

[copy or print]
(?:\s|)
The "?:" simply stops anything captured being used by FARR in the $$# bits. "\s" means white space (like a space or tab) and "|" means or, and as there is nothing after it it means "or nothing". In English that chunk means match one whitespace or nothing, but don't capture it. We want to be able to match nothing because we may just want to type in "cmd" without anything else.

[copy or print]
([^\s]*)
The "[^\s]" means any character EXCEPT a whitespace, and the * means 0 or more of the previous characters. So this means match 0 or more characters as long as they are not whitespaces. As we dont use "?:", then these will get captured into $$1, $$2, $$3 and $$4 for each of these blocks.

This pairing is repeated 4 times to give us the chance to put in up to 4 variables to NirCmd. OK, here are some commands (change c:\windows\ to wherever you put nircmd.exe):

[copy or print]
screensaver | c:\windows\nircmd.exe screensaver
lock PC | c:\windows\nircmd.exe lockws
monitor (on/off/low) $$1 | c:\windows\nircmd.exe monitor $$1
setres (width) (height) (depth) $$1 $$2 $$3 | c:\windows\nircmd.exe setdisplay $$1 $$2 $$3
changevol(+#/-#) $$1 | c:\windows\nircmd.exe changesysvolume $$1
mute (0/1) $$1 | c:\windows\nircmd.exe mutesysvolume $$1
reboot | c:\windows\nircmd.exe qboxcom "Do you want to reboot ?" "question" exitwin reboot
raise (window) $$1 | c:\windows\nircmd.exe win activate stitle "$$1" $$2
settop (window) (0/1) $$1 $$2 | c:\windows\nircmd.exe win settopmost stitle "$$1" $$2
compliment $$1 | c:\windows\nircmd.exe infobox "Wow $$1, you're really great!"

Now you'll notice some commands don't need any additional input, yet others do. In this scheme when you activate FARR, you first type "cmd" to activate the group, now typing in additional info will start to fill out the fields for the various options.

One important point is you need to turn off digit keys for launching as it will interfere with several nircmd's (see below as I could get digit escaping to work)

So an example:

cmd 1 F6 - mutes volume
cmd 0 F6 - unmutes volume
cmd mouser (then click compliment as it is after F9) - compliments mouser! Wink

Please add your own NirCmd's to this thread.

to mouser:
I had a couple of problems: 1st although c:\windows\ is in my system path, FARR did not find nircmd.exe there; shouldn't FARR look for apps in the system path? 2nd was that I tried using \1 to escape numbers so I didn't need to turn off digit launching - however typing in the "\" seems to stop the group from working - the titles all get removed and numbers keys then stop working...
« Last Edit: September 10, 2005, 09:55:18 AM by nontroppo » Logged

mouser
First Author
Administrator
*****
Posts: 32,659



see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #1 on: September 10, 2005, 10:59:23 AM »

great! going to try it now myself!
and it sounds like that regex string will actually be useful to other commands as well, so thats cool.

i will try to fix both issues you raised and post a new version.
Logged
mouser
First Author
Administrator
*****
Posts: 32,659



see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #2 on: September 10, 2005, 11:12:34 AM »

the other alternative would be to have a separate group for each nircommand, so for example:

regexp = "nirvolume (.*)"
result list:
"nircmd volume $$1 | c:\windows\nircmd.exe changesysvolume $$1"

advantages:
you only get the 1 item in your results list and can hit enter to launch it instead of # key
you dont have to worry about having too many commands to fit in results list.

disadvantages:
you have to create more groups
you cant just type cmd to get list of all commands (though if you prefix all by nir that would help)
Logged
mouser
First Author
Administrator
*****
Posts: 32,659



see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #3 on: September 10, 2005, 12:17:20 PM »

thanks nontroppo, the nirccommand stuff is working great here! fun!

ps. new version is up which should fix the 2 issues pointed out here.
Logged
mouser
First Author
Administrator
*****
Posts: 32,659



see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #4 on: September 10, 2005, 12:17:37 PM »

ps.  does the nickname "nontroppo" mean anything?
Logged
nontroppo
Charter Honorary Member
***
Posts: 648


spinning top

View Profile WWW Give some DonationCredits to this forum member
« Reply #5 on: September 10, 2005, 12:50:10 PM »

Yes, I had originally done single commands, but I like regex so the all-in-one flexible list was more fun! As you say, that regex can be used for any command that expects 0 or more additional entries.

I'll go off and test the new version.  smiley

And non troppo is Italian for "not too much", but my definition comes from its use in classical music, whereby it is used by a composer to relativise a direction for the musicians; "Lento ma non troppo" means slowly, but not to slowly or slowly, more or less. It fits into my polemic for relativism and deconstruction.
« Last Edit: September 10, 2005, 01:21:26 PM by nontroppo » Logged

lanux128
Global Moderator
*****
Posts: 6,046



see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #6 on: September 21, 2005, 04:04:54 AM »

hi there nontroppo,

is it possible to do the same thing with autohotkey scripts? i mean, to create group containing ahk scripts which by selecting them will call up autohotkey to execute the script...

thanks in advance...

best regards,
lanux
Logged

rjbull
Charter Member
***
Posts: 2,701

View Profile Give some DonationCredits to this forum member
« Reply #7 on: September 21, 2005, 09:45:28 AM »

Would people who like nircmd also like Steve Gibson's Wizmo?

=== begin quote ===
Wizmo is a multipurpose miscellaneous Windows utility that provides an array of single-click functions that are missing from Windows. Triggered by a single mouse click, it can do things like power down your system's displays, activate your screen saver, change or mute the audio volume, restart, reboot, or shutdown your system, and much more. It even includes a rather cool built-in "Graviton" screen saver that simulates the motion of any number of mutually gravitationally attracted celestial objects.
=== end quote ===
 
Gibson Research  http://www.grc.com  then find the freeware section
Logged
mouser
First Author
Administrator
*****
Posts: 32,659



see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #8 on: September 21, 2005, 10:58:29 AM »

i'm just finishing importing+exporting+pasting of group aliases files, so it will be easy to share these aliases, so yeah, keep 'em coming!
Logged
mouser
First Author
Administrator
*****
Posts: 32,659



see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #9 on: July 02, 2007, 08:13:20 PM »

now that we have standalone alias files, with ability to specify custom icons, i think it would be WONDERFUL if someone could volunteer to create a nice full nircmd alias file, and nontroppo has done most of the work already.  i know hamradio would help find+make icons for it if help is needed.

anyone want to volunteer?
Logged
mouser
First Author
Administrator
*****
Posts: 32,659



see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #10 on: July 04, 2007, 02:26:09 PM »

Here's a starter alias pack for nircmd, based on nontroppo's aliases above.

It includes some icons by hamradio, and the nircmd.exe itself, all ready to go -- just put it in your AliasGroups\Installed directory of farr and restart (or maybe just open up options and close options will reload new aliases).

You can see now the idea of alias packs as totally self-contains addons you can install into your farr and share with others.

Note that we still need people to improve this alias file and add some more icons, etc., so by all means please improve it and send it or post it to me so it can be official.


* nircmd.zip (92.21 KB - downloaded 222 times.)
« Last Edit: July 04, 2007, 03:09:41 PM by mouser » Logged
jgpaiva
Global Moderator
*****
Posts: 4,710



Artificial Idiocy

see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #11 on: July 17, 2007, 07:17:32 PM »

Here's my (slightly modified) version of the alias above.



I added entries for shutdown/reboot/logoff/standby, made each of the entries become an isolated item (so that you don't have to type "cmd" at the beggining), added icons for the new ones, and now "cmd" works both as a list and as a practical example of how to use each of the alias.

Try it!

[edit] changed one little thing: the "lock pc" alias wasn't working, it had to be changed to "lockpc" [/edit]
[edit2] fixed error mentioned below about standby [/edit]
[edit3] "stole" image that lanux had below. Hope lanux won't get mad at me Wink [/edit3]

[edit4]Download removed. Please see this thread for more info [/edit4]
« Last Edit: July 27, 2007, 08:49:25 AM by jgpaiva » Logged

mouser
First Author
Administrator
*****
Posts: 32,659



see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #12 on: July 17, 2007, 07:21:27 PM »

love it!!!  Kiss
Logged
lanux128
Global Moderator
*****
Posts: 6,046



see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #13 on: July 17, 2007, 07:40:07 PM »

looks cool! great job, jgpaiva.. Thmbsup

Logged

edbro
Charter Member
***
Posts: 425

see users location on a map View Profile Give some DonationCredits to this forum member
« Reply #14 on: July 17, 2007, 08:18:47 PM »

I'm having a bit of trouble trying to find where I'm supposed to put this. Right now I have the entire nircmd folder in the /Aliasgroups/Mycustom folder. The "nircmd icons" folder is in the "nircmd" folder. I'm not getting all the commands to show up and the icons don't show at all. Am I doing this correctly? Do I need to configure anything inside FARR to tell it about the new alias group?
Logged
mouser
First Author
Administrator
*****
Posts: 32,659



see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #15 on: July 17, 2007, 08:46:24 PM »

thats a fine place to put it, BUT you might want to put the subdir in the Installed folder directory since its not something you are supposed to be editing.

then just go to FARR options and close options, that should get FARR to rediscover all alias files.
Logged
edbro
Charter Member
***
Posts: 425

see users location on a map View Profile Give some DonationCredits to this forum member
« Reply #16 on: July 17, 2007, 08:58:18 PM »

Well, I must be doing something wrong. I put the entire nircmd folder in /Aliasgroups/installed and this is what I get:

The alias shows up in FARR options as shown here:

Why don't I get the full set of commands with the icons?

Edit: I also have trouble with this inline attachment thing. The images are in the opposite order. This way of attaching images is pretty screwy. You can't preview them and it is impossible to see from the code exactly what you have attached.


* Untitled.jpg (55.32 KB, 731x471 - viewed 277 times.)
« Last Edit: July 17, 2007, 09:01:06 PM by edbro » Logged
mouser
First Author
Administrator
*****
Posts: 32,659



see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #17 on: July 17, 2007, 09:03:56 PM »

what version of FARR do you have?
Logged
lanux128
Global Moderator
*****
Posts: 6,046



see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #18 on: July 17, 2007, 09:17:45 PM »

edbro, i think you have an existing nircmd alias under the name "cmd", if i'm not mistaken.. disable that alias then the new one will be ok.. smiley
Logged

lanux128
Global Moderator
*****
Posts: 6,046



see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #19 on: July 17, 2007, 09:22:00 PM »

btw, the screenshots provided a clue - check the difference.. smiley each of them have slightly different items..

new (jgpaiva's version)


old (non-troppo's version)

Logged

mouser
First Author
Administrator
*****
Posts: 32,659



see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #20 on: July 17, 2007, 09:29:55 PM »

ah that would make sense.. a competing cmd command.
Logged
edbro
Charter Member
***
Posts: 425

see users location on a map View Profile Give some DonationCredits to this forum member
« Reply #21 on: July 17, 2007, 09:46:50 PM »

Okay, I got it now. Yes, it was competing commands causing the problem. The real problem is the way Vista handles the %programfiles% directory. It will not allow any program to write to any directory inside program files. What it does is redirect all writes to a virtualstore directory buried deep inside the Users directory. I had manually copied some plugins and alias groups into the program files directory. Some stuff was mirrored in the virtualstore directory. When DCUpdater does its stuff, all the updates get written to the virtual store directory. It was a real mess. I ended up uninstalling/reinstalling FARR and manually cleaning up the duplicated items out of program files.
Logged
mouser
First Author
Administrator
*****
Posts: 32,659



see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #22 on: July 17, 2007, 11:48:34 PM »

Quote
When DCUpdater does its stuff, all the updates get written to the virtual store directory. It was a real mess.

oh that is really not cool.
i specifically named the program dcupdate launches to unpack the files in a manner that i thought should make vista ask the user to elevate the rights of the unpacker so that they are installed in the real program files directory..  i am going to have to make some changes if its not doing that.

but wait.. the updater doesnt modify the aliases.. thats only done by the full install tool.

i think you may have misdiagnosed this particulat problem (though the virtual store may be implicated in other issues with farr).
i think this is more of a case of an old version of farr having the nircmd alias and the new version didnt deleted it just added one.  new users shouldnt experience this problem.
« Last Edit: July 17, 2007, 11:50:14 PM by mouser » Logged
jgpaiva
Global Moderator
*****
Posts: 4,710



Artificial Idiocy

see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #23 on: July 19, 2007, 06:30:29 AM »

Just informing that i made a little change on the nircmd alias above... please update smiley
Logged

nontroppo
Charter Honorary Member
***
Posts: 648


spinning top

View Profile WWW Give some DonationCredits to this forum member
« Reply #24 on: July 23, 2007, 11:59:15 AM »

well done jgpaiva!

There is a bug in the standby command - it exits windows instead!?

Wow, FARR 2 is looking damn fine overall, alias system changes are very welcome. :beer: to mouser
« Last Edit: July 23, 2007, 12:08:26 PM by nontroppo » Logged

Pages: [1] 2 Next   Go Up
  Reply  |  New Topic  |  Print  
 
Jump to:  
   Forum Home   Thread Marks Chat! Downloads Search Login Register  

DonationCoder.com | About Us
DonationCoder.com Forum | Powered by SMF
[ Page time: 0.047s | Server load: 0 ]