Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Verify a running program
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Nova




PostPosted: Thu Jun 12, 2008 9:35 pm   Post subject: Verify a running program

I was wondering if it were possible for Turing to be able to tell wether or not some other application is currently running
For example, if media player were running then don't play sound
Any help would be great..

I'm not expecting much because Turing doesn't usually have that kind of resources
Sponsor
Sponsor
Sponsor
sponsor
riveryu




PostPosted: Thu Jun 12, 2008 9:46 pm   Post subject: RE:Verify a running program

I dont think so, the closest you can get is probably the things in Sys. Now why would you want to know the running applications?
DemonWasp




PostPosted: Thu Jun 12, 2008 9:57 pm   Post subject: RE:Verify a running program

If you happened to be running a Linux system, then you could manage a kind of huge kludge / hack to get that information. It wouldn't work well on Windows though...and since Turing doesn't execute so well on Linux it's pretty much a lost cause.

The hack I'm thinking of is to write a testForRunningApps.sh file that does this:

ps -ef | grep username.*appname > out.txt

Then running that, reading its output, and going from there.

On Windows, I don't know of any way to use the CLI to enumerate running processes (possibly because the Windows CLI is barely powerful enough to scratch your virtual hindquarters with)...so no, there's no way, short of making a program to detect this (with another language) and calling it from Turing.
Tony




PostPosted: Thu Jun 12, 2008 10:07 pm   Post subject: RE:Verify a running program

but even then, you just get the application names. A user could be running any one of hundreds of media players available. Possibly one of their own.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
DemonWasp




PostPosted: Thu Jun 12, 2008 10:16 pm   Post subject: RE:Verify a running program

That's true. You could probably (on *nix) check for resource allocation (sound card usage - though you'd pick up media players, other games, etc)...but again, only with C/C++ or similar.

Honestly, the OP's best bet is probably to just put a handy Mute button on the UI somewhere so that the user can decide for themselves (after all, there are times where you don't want to make noise, even if you have no media players running).
SNIPERDUDE




PostPosted: Fri Jun 13, 2008 12:17 am   Post subject: RE:Verify a running program

true.
But as for finding out if a certain app is running, it is posible to write a small programme in another language, then call the exe to create a text file - which is then read.

But like mentioned you best bet is to do the mute idea...
Nova




PostPosted: Fri Jun 13, 2008 12:20 am   Post subject: RE:Verify a running program

That's about what I thought
Maybe I'll look into something with C/C++
Tony




PostPosted: Fri Jun 13, 2008 12:29 am   Post subject: Re: RE:Verify a running program

Nova @ Fri Jun 13, 2008 12:20 am wrote:
Maybe I'll look into something with C/C++

It's not a C/C++ thing. You'd be looking into system access API. Which is in the libraries, and are not exclusive to certain languages.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Sponsor
Sponsor
Sponsor
sponsor
Nova




PostPosted: Fri Jun 13, 2008 12:43 am   Post subject: RE:Verify a running program

I have some limited experience with C++ so it just seemed like the best place to start
Thanks tho, I'll check the API first and work from then I guess
DaveAngus




PostPosted: Fri Jun 13, 2008 9:58 am   Post subject: RE:Verify a running program

I dont think you can in Turing. Its not that advanced. Haha. You could do it in Java probably. I know nothing about that program though. Im not the most advanced programmer. Haha
SNIPERDUDE




PostPosted: Fri Jun 13, 2008 10:05 am   Post subject: RE:Verify a running program

If you don't know java, it is a good thing to learn. But trust me learning it can sometimes be a PAIN.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 11 Posts ]
Jump to:   


Style:  
Search: