Login Register






Thread Rating:
  • 0 Vote(s) - 0 Average


batch files and .exe programs filter_list
Author
Message
RE: batch files and .exe programs #11
(03-30-2013, 04:32 AM)Linuxephus Wrote:
(03-30-2013, 03:41 AM)ArkPhaze Wrote: What is to invoke the batch script when you open the program? Understand that this would require functionality from the program that would call the batch script or a hack to the program in question... There's no way to do this in batch.

Yet as you stated, there is a way for a given program to invoke a batch script.
Redshift and Xflux (Google those 2 Linux programs for further referencing) come to mind immediately.
And M[ostly]S[hoddy]'s Windows?
There's a way.
So please, do tell what you're already aware of.

Yes Smile Although for things like Firefox and other programs that aren't really meant to have this functionality, I'm not sure what you would want to do that for... Might as well be better off writing a Firefox addon in some cases, if for instance Firefox was the target.

I wouldn't even hardly write a program myself if all it did was act as a wrapper for invoking a batch script to run via command line through a shell.

I would like to hear why he wants to do this though. There's probably a better alternative here. If he needed it to work this way, it might be better to go through a windows service, that checks the running processes and calls to the batch script based on the conditions it finds for what process you are waiting for.
ArkPhaze
"Object oriented way to get rich? Inheritance"
Getting Started: C/C++ | Common Mistakes
[ Assembly / C++ / .NET / Haskell / J Programmer ]

Reply

RE: batch files and .exe programs #12
(03-30-2013, 04:32 AM)Linuxephus Wrote:
(03-30-2013, 03:41 AM)ArkPhaze Wrote: What is to invoke the batch script when you open the program? Understand that this would require functionality from the program that would call the batch script or a hack to the program in question... There's no way to do this in batch.

Yet as you stated, there is a way for a given program to invoke a batch script.
Redshift and Xflux (Google those 2 Linux programs for further referencing) come to mind immediately.
And M[ostly]S[hoddy]'s Windows?
There's a way.
So please, do tell what you're already aware of.

Yes Smile Although for things like Firefox and other programs that aren't really meant to have this functionality, I'm not sure what you would want to do that for... Might as well be better off writing a Firefox addon in some cases, if for instance Firefox was the target.

I wouldn't even hardly write a program myself if all it did was act as a wrapper for invoking a batch script to run via command line through a shell.

I would like to hear why he wants to do this though. There's probably a better alternative here. If he needed it to work this way, it might be better to go through a windows service, that checks the running processes and calls to the batch script based on the conditions it finds for what process you are waiting for.
ArkPhaze
"Object oriented way to get rich? Inheritance"
Getting Started: C/C++ | Common Mistakes
[ Assembly / C++ / .NET / Haskell / J Programmer ]

Reply

RE: batch files and .exe programs #13
(03-30-2013, 06:46 AM)ArkPhaze Wrote: Yes Smile Although for things like Firefox and other programs that aren't really meant to have this functionality, I'm not sure what you would want to do that for... Might as well be better off writing a Firefox addon in some cases, if for instance Firefox was the target.

I wouldn't even hardly write a program myself if all it did was act as a wrapper for invoking a batch script to run via command line through a shell.

I would like to hear why he wants to do this though. There's probably a better alternative here. If he needed it to work this way, it might be better to go through a windows service, that checks the running processes and calls to the batch script based on the conditions it finds for what process you are waiting for.

I had essentially reached the same conclusion.
However, I wanted further input on the subject from you before commenting with an affirmative.
And yes, a window's service would also have been or would be my own suggestion as it is more of a targeted approach versus a haphazardly needless invocation of a script based upon the executing of a single program to call the scripts function.

Reply

RE: batch files and .exe programs #14
(03-30-2013, 06:46 AM)ArkPhaze Wrote: Yes Smile Although for things like Firefox and other programs that aren't really meant to have this functionality, I'm not sure what you would want to do that for... Might as well be better off writing a Firefox addon in some cases, if for instance Firefox was the target.

I wouldn't even hardly write a program myself if all it did was act as a wrapper for invoking a batch script to run via command line through a shell.

I would like to hear why he wants to do this though. There's probably a better alternative here. If he needed it to work this way, it might be better to go through a windows service, that checks the running processes and calls to the batch script based on the conditions it finds for what process you are waiting for.

I had essentially reached the same conclusion.
However, I wanted further input on the subject from you before commenting with an affirmative.
And yes, a window's service would also have been or would be my own suggestion as it is more of a targeted approach versus a haphazardly needless invocation of a script based upon the executing of a single program to call the scripts function.

Reply

RE: batch files and .exe programs #15
Well, you could do something like

Code:
:loop
tasklist /fi "IMAGENAME eq firefox.exe" 2 > nul | find /i /n "firefox.exe" > nul
if "%ERRORLEVEL%"=="0" (
rem - do here whatever you want to do while the browser is running
)
goto loop

but it wouldn't start itself when the browser is started, it would just act when the browser runs.
My Bitcoin address: 1AtxVsSSG2Z8JfjNy9KNFDUN6haeKr7LiP
Give me money by visiting www.google.com here: http://coin-ads.com/6Ol83U

If you want a Bitcoin URL shortener/advertiser, please, use this referral: http://coin-ads.com/register.php?refid=noize

Reply

RE: batch files and .exe programs #16
Well, you could do something like

Code:
:loop
tasklist /fi "IMAGENAME eq firefox.exe" 2 > nul | find /i /n "firefox.exe" > nul
if "%ERRORLEVEL%"=="0" (
rem - do here whatever you want to do while the browser is running
)
goto loop

but it wouldn't start itself when the browser is started, it would just act when the browser runs.
My Bitcoin address: 1AtxVsSSG2Z8JfjNy9KNFDUN6haeKr7LiP
Give me money by visiting www.google.com here: http://coin-ads.com/6Ol83U

If you want a Bitcoin URL shortener/advertiser, please, use this referral: http://coin-ads.com/register.php?refid=noize

Reply

RE: batch files and .exe programs #17
(03-30-2013, 07:25 PM)noize Wrote: Well, you could do something like

Code:
:loop
tasklist /fi "IMAGENAME eq firefox.exe" 2 > nul | find /i /n "firefox.exe" > nul
if "%ERRORLEVEL%"=="0" (
rem - do here whatever you want to do while the browser is running
)
goto loop

but it wouldn't start itself when the browser is started, it would just act when the browser runs.

as long as you endlessly run this script... That script looks like it has errors in it though. I would do this:
Code:
@echo off & setlocal enabledelayedexpansion
:loop
set lookfor=firefox.exe
for /f "tokens=1" %%G in ('tasklist /FI "ImageName eq %lookfor%" /NH') do set found=%%G
if /i %found%==%lookfor% (
    echo %lookfor% is running...
)
goto loop
ArkPhaze
"Object oriented way to get rich? Inheritance"
Getting Started: C/C++ | Common Mistakes
[ Assembly / C++ / .NET / Haskell / J Programmer ]

Reply

RE: batch files and .exe programs #18
(03-30-2013, 07:25 PM)noize Wrote: Well, you could do something like

Code:
:loop
tasklist /fi "IMAGENAME eq firefox.exe" 2 > nul | find /i /n "firefox.exe" > nul
if "%ERRORLEVEL%"=="0" (
rem - do here whatever you want to do while the browser is running
)
goto loop

but it wouldn't start itself when the browser is started, it would just act when the browser runs.

as long as you endlessly run this script... That script looks like it has errors in it though. I would do this:
Code:
@echo off & setlocal enabledelayedexpansion
:loop
set lookfor=firefox.exe
for /f "tokens=1" %%G in ('tasklist /FI "ImageName eq %lookfor%" /NH') do set found=%%G
if /i %found%==%lookfor% (
    echo %lookfor% is running...
)
goto loop
ArkPhaze
"Object oriented way to get rich? Inheritance"
Getting Started: C/C++ | Common Mistakes
[ Assembly / C++ / .NET / Haskell / J Programmer ]

Reply







Users browsing this thread: 1 Guest(s)