DonationCoder.com forum
 
Read-only archive. This is a static copy of the DonationCoder.com forum. Reading and searching work as before; logging in, posting and private messages do not.
Archive of 2026-10-21 · About this archive · Main site

Author Topic: IDEA: Run Before / After something  (Read 17,917 times)

justice

  • Solve issues simply.
  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,898
    • Participated in NANY Challenge Four Times
    • Cody Award
    • Coding Snacks
    • DJ Badge - DJ
IDEA: Run Before / After something
« on: April 24, 2007, 08:40 AM »
Some software allows you to run a command before or after the software itself is run. For example: Syncback allows you to run a command so that you can do something with the backup. I would be interested in using a program that does this on a more general basis:

For example I could set up a "link" to download the newest  Keepass database from ftp before running the Keepass program (synchronisation) and upload it again afterwards.

ideally
Ideally It would be good if it worked with a list of entries, each entry specifying program and the commands it should run before / after. This is easier to maintain then something decentralised.
Ideally it would still allow you to run a program the usual way (run Keepass from the start menu and FARR). I guess it would intercept the run call or modify the shortcut or some other clever way.
I guess that some people would want to run more than one command, although of course you could just run a script or batch file.

Hopefully this sparks someone's interest or someone could point me to a similar program.
Thanks!
« Last Edit: April 24, 2007, 11:35 AM by justice »

lanux128

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 6,277
    • Coding Snacks
    • Volunteers/Staff
    • Gathering Badge
    • Participated in NANY Challenge Once
    • Linux User
Re: IDEA: Run Before / After something
« Reply #1 on: May 21, 2007, 05:14 AM »
there used to be a program called Omni Shortcut that is able to do this but i can't find it anymore.. however for simple, sequential execution of programs, i use Batchrun.. btw, this freeware is no longer in active development.. :huh:


http://www.donationcoder.com/forum/index.php?topic=6492.0

also, there's always the "Start /w" command.. :)
To start programs sequentially in Windows, create a text file containing the following lines:
start /w <program1.exe>
start /w <program2.exe>
start /w <program3.exe>
<additional lines as necessary>

Save the text file with a .bat extension.
http://support.microsoft.com/kb/198044

justice

  • Solve issues simply.
  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,898
    • Participated in NANY Challenge Four Times
    • Cody Award
    • Coding Snacks
    • DJ Badge - DJ
Re: IDEA: Run Before / After something
« Reply #2 on: May 21, 2007, 12:01 PM »
Thanks Lanux128. An alternative also would be to make an autohotkey script and use RunWait. I was hoping there would have been a program that would detect program x was started, instead started y, then started x, and afterwards start z.
The benefit of this would be that I can just keep running X as normal, or via file associations etc.

However the more I think about it, the more this seems to be impossible, also Windows might not like it, basically you're creating a dodgy piece of software. :)

skrommel

  • Fastest code in the west
  • Developer
  • Joined in 2005
  • ***
  • Posts: 933
    • Participated in NANY Challenge Twice
    • Coding Snacks
Re: IDEA: Run Before / After something
« Reply #3 on: May 23, 2007, 01:20 AM »
:) Here's something that may work.

PauseProcess - Pause a program and run other programs before and after.

Command line:
  PauseProcess.exe "<program to pause>" ["<program to run before>" "<program to run after>"]
Example:
  PauseProcess.exe "Notepad.exe" "Pbrush.exe" "Calc.exe"

Uses PauseP.exe by Daniel Turion at http://www.codeproject.com/threads/pausep.asp

You'll find the downloads and more info at 1 Hour Software by Skrommel.

It would be possible to make a real interception using hooks, but a pause is much simpler.
The author of PauseP.exe warns that it may crash multithreaded apps.

Skrommel
« Last Edit: May 23, 2007, 01:24 AM by skrommel »

Original address: https://www.donationcoder.com/forum/index.php?topic=8234.0