topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Sunday December 15, 2024, 5:30 am
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Last post Author Topic: NirCmd Setup, a guide of sorts  (Read 37156 times)

nontroppo

  • Charter Honorary Member
  • Joined in 2005
  • ***
  • Posts: 649
  • spinning top
    • View Profile
    • nontroppo.org
    • Donate to Member
NirCmd Setup, a guide of sorts
« on: September 10, 2005, 09:51 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:

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:

(?:\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.

([^\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):

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! ;)

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...
FARR Wishes: Performance TweaksTask ControlAdaptive History
[url=http://opera.com/]
« Last Edit: September 10, 2005, 09:55 AM by nontroppo »

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,914
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: NirCmd Setup, a guide of sorts
« Reply #1 on: September 10, 2005, 10:59 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.

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,914
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: NirCmd Setup, a guide of sorts
« Reply #2 on: September 10, 2005, 11:12 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)

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,914
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: NirCmd Setup, a guide of sorts
« Reply #3 on: September 10, 2005, 12:17 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.

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,914
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: NirCmd Setup, a guide of sorts
« Reply #4 on: September 10, 2005, 12:17 PM »
ps.  does the nickname "nontroppo" mean anything?

nontroppo

  • Charter Honorary Member
  • Joined in 2005
  • ***
  • Posts: 649
  • spinning top
    • View Profile
    • nontroppo.org
    • Donate to Member
Re: NirCmd Setup, a guide of sorts
« Reply #5 on: September 10, 2005, 12:50 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.  :)

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.
FARR Wishes: Performance TweaksTask ControlAdaptive History
[url=http://opera.com/]
« Last Edit: September 10, 2005, 01:21 PM by nontroppo »

lanux128

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 6,277
    • View Profile
    • Donate to Member
Re: NirCmd Setup, a guide of sorts
« Reply #6 on: September 21, 2005, 04:04 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

rjbull

  • Charter Member
  • Joined in 2005
  • ***
  • default avatar
  • Posts: 3,205
    • View Profile
    • Donate to Member
Re: NirCmd Setup, a guide of sorts
« Reply #7 on: September 21, 2005, 09:45 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

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,914
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: NirCmd Setup, a guide of sorts
« Reply #8 on: September 21, 2005, 10:58 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!

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,914
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: NirCmd Setup, a guide of sorts
« Reply #9 on: July 02, 2007, 08:13 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?

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,914
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: NirCmd Setup, a guide of sorts
« Reply #10 on: July 04, 2007, 02:26 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.

« Last Edit: July 04, 2007, 03:09 PM by mouser »

jgpaiva

  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 4,727
    • View Profile
    • Donate to Member
Re: NirCmd Setup, a guide of sorts
« Reply #11 on: July 17, 2007, 07:17 PM »
Here's my (slightly modified) version of the alias above.

ws-jgpaiva-cmd-alias-1.png

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 ;) [/edit3]

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

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,914
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: NirCmd Setup, a guide of sorts
« Reply #12 on: July 17, 2007, 07:21 PM »
love it!!!  :-*

lanux128

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 6,277
    • View Profile
    • Donate to Member
Re: NirCmd Setup, a guide of sorts
« Reply #13 on: July 17, 2007, 07:40 PM »
looks cool! great job, jgpaiva.. :Thmbsup:

ws-jgpaiva-cmd-alias-1.png

edbro

  • Charter Member
  • Joined in 2006
  • ***
  • default avatar
  • Posts: 426
    • View Profile
    • Donate to Member
Re: NirCmd Setup, a guide of sorts
« Reply #14 on: July 17, 2007, 08:18 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?

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,914
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: NirCmd Setup, a guide of sorts
« Reply #15 on: July 17, 2007, 08:46 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.

edbro

  • Charter Member
  • Joined in 2006
  • ***
  • default avatar
  • Posts: 426
    • View Profile
    • Donate to Member
Re: NirCmd Setup, a guide of sorts
« Reply #16 on: July 17, 2007, 08:58 PM »
Well, I must be doing something wrong. I put the entire nircmd folder in /Aliasgroups/installed and this is what I get:
Untitled.jpg
The alias shows up in FARR options as shown here:
nircmd.jpg
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.
« Last Edit: July 17, 2007, 09:01 PM by edbro »

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,914
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: NirCmd Setup, a guide of sorts
« Reply #17 on: July 17, 2007, 09:03 PM »
what version of FARR do you have?

lanux128

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 6,277
    • View Profile
    • Donate to Member
Re: NirCmd Setup, a guide of sorts
« Reply #18 on: July 17, 2007, 09:17 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.. :)

lanux128

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 6,277
    • View Profile
    • Donate to Member
Re: NirCmd Setup, a guide of sorts
« Reply #19 on: July 17, 2007, 09:22 PM »
btw, the screenshots provided a clue - check the difference.. :) each of them have slightly different items..

new (jgpaiva's version)


old (non-troppo's version)


mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,914
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: NirCmd Setup, a guide of sorts
« Reply #20 on: July 17, 2007, 09:29 PM »
ah that would make sense.. a competing cmd command.

edbro

  • Charter Member
  • Joined in 2006
  • ***
  • default avatar
  • Posts: 426
    • View Profile
    • Donate to Member
Re: NirCmd Setup, a guide of sorts
« Reply #21 on: July 17, 2007, 09:46 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.

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,914
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: NirCmd Setup, a guide of sorts
« Reply #22 on: July 17, 2007, 11:48 PM »
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 PM by mouser »

jgpaiva

  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 4,727
    • View Profile
    • Donate to Member
Re: NirCmd Setup, a guide of sorts
« Reply #23 on: July 19, 2007, 06:30 AM »
Just informing that i made a little change on the nircmd alias above... please update :)

nontroppo

  • Charter Honorary Member
  • Joined in 2005
  • ***
  • Posts: 649
  • spinning top
    • View Profile
    • nontroppo.org
    • Donate to Member
Re: NirCmd Setup, a guide of sorts
« Reply #24 on: July 23, 2007, 11:59 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
FARR Wishes: Performance TweaksTask ControlAdaptive History
[url=http://opera.com/]
« Last Edit: July 23, 2007, 12:08 PM by nontroppo »