Home | Blog | Software | Reviews and Features | Forum | Help | Donate | About us
topbanner_forum
  *

avatar image

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

Login with username, password and session length
  • September 03, 2015, 01:54:20 AM
  • Proudly celebrating 10 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

Author Topic: Done: AutoStart Program(s), if key is pressed or CapsLock On/Off with Parameter  (Read 12419 times)

apfel

  • Participant
  • Joined in 2006
  • *
  • Posts: 63
    • View Profile
    • Donate to Member
Hi @all.
Is it possible to make a enhanced version of Capster (http://www.bcheck.net/apps/#capster) with the following new features:
- start program with parameter
- possibility to use other conditions to start a program e.g. other Keystrokes/Keys

(Program can also be an AutoHotKey Script.)

thx, for help.
« Last Edit: March 16, 2008, 07:57:40 PM by apfel »

lanux128

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 6,219
    • View Profile
    • Coding Snacks by Lanux128
    • Donate to Member
this can done with AHK but i'm afraid that the usage of other keys is limited to toggle-state keys such as Capslock, Numlock, Scroll-Lock and Insert. also by using AHK, the script itself can be placed in the Startup folder much like Capster. i'll try this over the weekend. ;)

firefox-capster.png

apfel

  • Participant
  • Joined in 2006
  • *
  • Posts: 63
    • View Profile
    • Donate to Member
Woohoo! Nice, Thank you!
Never believed someone would pick this up.  :)
It would be already great, if you can add the "autostart program with parameter" feature.

skrommel

  • Fastest code in the west
  • Developer
  • Joined in 2005
  • ***
  • Posts: 886
    • View Profile
    • 1 Hour Software by skrommel
    • Donate to Member
 :) ToggleRun runs programs on startup when Capslock,Numlock, Scrolllock or Insert is down, or up.

You can also use RunWait instead of Run to wait for a program to end before running the next in the group.

Edit the script and place it in your startup folder. It is written in AutoHotkey from www.autohotkey.com.

Skrommel

Code: [Select]
;ToogleRun.ahk
; Run programs on startup when Capslock, Numlock, Scrolllock or Insert is down
; Usage: Place the script in your startup folder
; Format: Run, Target [, WorkingDir, Max|Min|Hide ]
;Skrommel @ 2008

If (GetKeyState("Capslock","T")=1)
{
  Run,Notepad.exe C:\Test1.txt
  Run,Paint.exe C:\Test2.bmp
  Run,Write.exe C:\Test3.wri
}
Else
{
  Run,Calc.exe,,Min
  Run,IExplore.exe,,Max
}
If (GetKeyState("Numlock","T")=1)
  Run,Calc.exe,,Min
If (GetKeyState("Scrolllock","T")=1)
  Run,Pbrush.exe C:\Windows\Bubbles.bmp,,Max
If (GetKeyState("Insert","T")=1)
  Run,Write.exe
Please stop by my site at  1 Hour Software by skrommel  for downloads and more info.
« Last Edit: March 14, 2008, 12:22:40 PM by skrommel »

lanux128

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 6,219
    • View Profile
    • Coding Snacks by Lanux128
    • Donate to Member
ok, made some changes. the program now aware of both situations - On/Off and added a button for open the startup folder.

--o--
it looks like Skrommel beat me to this but do try my version as well. ;) i made the GUI so that it's easier to choose the programs.

Caps-Run: a Capster clone.
Capster-Clone-02.png

btw, the beta label just indicates that i haven't added the About box and leave some room for any future configurations..
« Last Edit: March 16, 2008, 08:35:56 AM by lanux128 »

apfel

  • Participant
  • Joined in 2006
  • *
  • Posts: 63
    • View Profile
    • Donate to Member
Both scripts are nice, but Caps-Run is better and closer to Capster!
Could you add another Box, which includes both cases ON and Off?
Now I can manage the startup of my pc for individual use.

Thank you for both of your work.

lanux128

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 6,219
    • View Profile
    • Coding Snacks by Lanux128
    • Donate to Member
you're welcome and sure, i can add another drop-down for the ON/OFF toggle.. :) but just curious, if the caps is off then wouldn't it just be a normal shortcut?

apfel

  • Participant
  • Joined in 2006
  • *
  • Posts: 63
    • View Profile
    • Donate to Member
It would be another condition, e.g I would like to run two diffrent groups of app's. First group only starts Caps=ON and second group only starts CAPS=Off.

Edit: Feature Suggestion:
-a list, which shows all these "special" links with the possibility to delete them.
-option for Startup Delay (>=0) for each program
« Last Edit: March 14, 2008, 10:46:34 PM by apfel »

lanux128

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 6,219
    • View Profile
    • Coding Snacks by Lanux128
    • Donate to Member
ok, i've made the program aware of both situations (On/Off) and also added a button to open the startup folder so that you can edit or delete the shortcuts. as for the other request, i'd like to suggest that you try Startup Delayer which is quite popular here among DC'ers.. ;)

mitzevo

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 461
  • Control is power
    • View Profile
    • Donate to Member
Hmm, I've always had the idea of my start up programs starting by a key held down or toggled on.. And here we go :D

So I can boot up my box, login to xp, and have caps/num/etc on or off, to get programs to start up? Like normal startup procedures?

The clock is running. Make the most of today. Time waits for no man. Yesterday is history. Tomorrow is a mystery. Today is a gift. That's why it is called the present.

apfel

  • Participant
  • Joined in 2006
  • *
  • Posts: 63
    • View Profile
    • Donate to Member
@lanux128 Thank you for you work!  :Thmbsup:

lanux128

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 6,219
    • View Profile
    • Coding Snacks by Lanux128
    • Donate to Member
apfel: glad to be of help. 8)

mitzevo: basically you just extract the zip file then run the program to create shortcuts in the startup folder based on the criteria you have specified. that's about it. :)

Scott

  • Resident Googler
  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 378
    • View Profile
    • Donate to Member
Is there any way to make Caps-Run:

1. Supply the launched application with a startup directory?

2. Start the application minimized or maximized?

I also found a problem with quotation mark parsing.  If the parameters supplied in the Caps-Run config dialog contain quotes, those quotes are misinterpreted.  For example, if this is used in the Parameters box:

Code: [Select]
cmdwait 10000 execmd start "" calc.exe
The first quotation mark after start gets interpreted as the end of the parameters to be sent to the application.
« Next Edit: Tomorrow at 12:13:47 AM by Scott »

lanux128

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 6,219
    • View Profile
    • Coding Snacks by Lanux128
    • Donate to Member
items 1 & 2 are included in this release but i'm not sure about the quote marks parsing. can you explain a bit and are those commands from nircmd?

Caps-Run 1.2

Caps-Run_1.2_2009-09-06_001.png

Edit: Fixed max/min commands and start-in folder
« Last Edit: September 06, 2009, 02:44:51 AM by lanux128 »

Scott

  • Resident Googler
  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 378
    • View Profile
    • Donate to Member
First of all, thank you very much for giving this your attention.

It seems that minimized and maximized are reversed.  That is, if Maximized is selected in the Caps-Run interface when the shortcut is created, the shortcut is actually created with "minimized" set, and vice-versa.

But the real problem is that this only sets the shortcut's parameters, and it doesn't affect how the program being run by Caps-Run actually loads.  Caps-Run would have to signal internally for the application to start minimized or maximized.

The startup directory is a similar issue.  Setting it in the shortcut only passes it to Caps-Run, not to the actual program being run.

I'm not sure how hard this would be to do, and I apologize if it's too much to ask.  I also apologize for the misunderstanding.

I will elaborate on the quote issue soon.
« Next Edit: Tomorrow at 12:13:47 AM by Scott »

lanux128

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 6,219
    • View Profile
    • Coding Snacks by Lanux128
    • Donate to Member
But the real problem is that this only sets the shortcut's parameters, and it doesn't affect how the program being run by Caps-Run actually loads.  Caps-Run would have to signal internally for the application to start minimized or maximized.

you're right, i had missed the internal signals for Capsrun to launch the way you wanted. sorry, it's been some time since i coded that script and i had uploaded a total mess it seems. :-[ anyway, try the updated version and let me know if you run into any more problems. The startup folder also should be working now.


as for the quote marks, i referred to the help file and followed their suggestion of adding an external quotes around the command and it works.

Quote
When running a program via Comspec (cmd.exe) -- perhaps because you need to redirect the program's input or output -- if the path or name of the executable contains spaces, the entire string should be enclosed in an outer pair of quotes. In the following example, the outer quotes are shown in red and all the inner quotes are shown in black:
Run %comspec% /c ""C:\My Utility.exe" "param 1" "second param" >"C:\My File.txt""

Caps-Run_1.2_2009-09-06_001 003_ver001.png

Scott

  • Resident Googler
  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 378
    • View Profile
    • Donate to Member
Thank you, but setting the shortcut to "Minimized" won't make the child of capsrun.exe run minimized.

Regarding quotes, when I use these settings in Caps-Run:

Program:
c:\program files\console\nircmd.exe

Parameters:
cmdwait 2000 execmd start "" calc.exe

This is the command line that actually runs:

Code: [Select]
"c:\program files\console\nircmd.exe" cmdwait 2000 execmd start " calc.exe    
If I change the Parameters to:
"cmdwait 20000 execmd start "" calc.exe"

This runs:

Code: [Select]
cmdwait 20000 execmd start  calc.exe
Don't worry about any of this though.  I can live with Caps-Run without driving you nuts over this.  I'm sorry.
« Next Edit: Tomorrow at 12:13:47 AM by Scott »
« Last Edit: September 06, 2009, 08:37:40 AM by Scott »

Scott

  • Resident Googler
  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 378
    • View Profile
    • Donate to Member
Thank you, but setting the shortcut to "Minimized" won't make the child of capsrun.exe run minimized.

Regarding quotes, when I use these settings in Caps-Run:

Program:
c:\program files\console\nircmd.exe

Parameters:
cmdwait 2000 execmd start "" calc.exe

This is the command line that actually runs:

Code: [Select]
"c:\program files\console\nircmd.exe" cmdwait 2000 execmd start " calc.exe    
If I change the Parameters to:
"cmdwait 20000 execmd start "" calc.exe"

This runs:

Code: [Select]
cmdwait 20000 execmd start  calc.exe
And:
cmdwait 20000 execmd "start "" calc.exe"

Results in:

Code: [Select]
cmdwait 20000 execmd start  calc.exe    
Don't worry about any of this though.  I can live with Caps-Run without driving you nuts over this.  I'm sorry.
« Next Edit: Tomorrow at 12:13:47 AM by Scott »

lanux128

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 6,219
    • View Profile
    • Coding Snacks by Lanux128
    • Donate to Member
Thank you, but setting the shortcut to "Minimized" won't make the child of capsrun.exe run minimized.

that's strange because it works here. can you post an example? that'll help to get into the bottom of things.


Regarding quotes, when I use these settings in Caps-Run:

Program:
c:\program files\console\nircmd.exe



And:
cmdwait 20000 execmd "start "" calc.exe"

Results in:

Code: [Select]
cmdwait 20000 execmd start  calc.exe    
Don't worry about any of this though.  I can live with Caps-Run without driving you nuts over this.  I'm sorry.

there is no need to apologize. i'm learning as well from this. :) from what i see, nircmd launches two commands, one is 'cmdwait' and the other is 'execmd'. my guess is that since execmd parameters (start "" calc.exe) have a space in between them, it's best to quote so that it becomes "start "" calc.exe" instead, leaving the internal quotes intact.

hmm.. i think it's best to check timestamp of the Caps-run files. there are two files: one is the GUI: Caps-Run.exe and the helper app: capsrun.exe. if timestamps do not match the screenshot then try clearing out the folder and extract Caps-Run.exe again.

capsrun [explorer.exe]_2009-09-07_001.png

Scott

  • Resident Googler
  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 378
    • View Profile
    • Donate to Member
Any program I run (via Caps-Run) with the shortcut properties set to Minimized fails to run that way...  Such as simply specifying calc.exe as the program.

As far as the quotes go, nothing I try makes it work, even following your exact example above with "start "" calc.exe".
« Next Edit: Tomorrow at 12:13:47 AM by Scott »

lanux128

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 6,219
    • View Profile
    • Coding Snacks by Lanux128
    • Donate to Member
hmm.. did i upload the wrong file? :-\ so how about the timestamps?

Scott

  • Resident Googler
  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 378
    • View Profile
    • Donate to Member
Each time I've downloaded a new Caps-Run copy, I manually go in and clear out its directory before extracting it.  I just did so again and tried...  Setting a calc.exe shortcut to run minimized doesn't work.

Don't sweat it...
« Next Edit: Tomorrow at 12:13:47 AM by Scott »

lanux128

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 6,219
    • View Profile
    • Coding Snacks by Lanux128
    • Donate to Member
this must be just of the those things that refuses to work. :D maybe i should make a screen-cast showing that it works here, what do you think?

anyway, if you're willing to try again, please download from this alternate link and let me know the results.

http://lanux128.dcme...c/Caps-Run-v1205.zip

P.S. are you running this on WinXP or some other OS? because i have tested only on WinXP.

lanux128

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 6,219
    • View Profile
    • Coding Snacks by Lanux128
    • Donate to Member
the calculator is not a very good example because i think calc.exe doesn't recognise the 'Run mimimized' command. even a normal shortcut pointing to "C:\WINDOWS\system32\calc.exe" and set run minimized will always start in normal mode. that's what happens on my PC.

i'm going to do some googling to see if this is common behaviour.

edit: even this command - "cmd /k start /min calc.exe" in the run box starts the calculator in the normal window.
« Last Edit: September 07, 2009, 12:32:51 AM by lanux128 »