topbanner_forum
  *

avatar image

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

Login with username, password and session length
  • Thursday March 28, 2024, 12:46 pm
  • 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

Author Topic: IDEA: .exe to check for a file/folder existance and act accordingly  (Read 5557 times)

sri

  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 689
    • View Profile
    • Sridhar Katakam
    • Read more about this member.
    • Donate to Member
Hi all,

I am requesting for a tiny program (.exe) that would check for existance of a file/folder on the user's computer and prompt them for a download if they don't have it.

It should have the following input boxes:

1. Path of the file/folder to check (Ex.: C:\Program Files\AvaFind)

2. If present, the path to a file/folder to launch (Ex.: C:\%ProgramFiles%\blah\congrats.html)

3. If Not Present, path to a file/folder to launch (Ex.: c:\program files\internet explorer\iexplore.exe http://www.google.com/search?q=AvaFind)

If not a GUI, a file that can be edited by a text editor with the above modifiable parameters would work as well.

Thanks for any help.
<a href="https://sridharkatakam.com">My blog</a>
« Last Edit: January 11, 2007, 03:04 AM by brotherS »

jgpaiva

  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 4,727
    • View Profile
    • Donate to Member
Re: IDEA: .exe to check for a file/folder existance and act accordingly
« Reply #1 on: January 11, 2007, 05:11 AM »
Here's a small script i made for this:
.ahk version
.exe version
It's called CheckForFile and works with command line parameters:

CheckForFile.exe [FileToFind] [RunIfFound] [RunIfNotFound]
[FileToFind] is the file you want to check for existence,
[RunIfFound] is the comand you'd like it to run in case it found the file (can be a file, an url, etc)
[RunIfNotFound] is the command you'd like it to run in case it didn't find the file.

sri

  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 689
    • View Profile
    • Sridhar Katakam
    • Read more about this member.
    • Donate to Member
jgp,

Can you pls give me another version of the script which checks to see if the file is already running (open)?

i.e, check is to be done to see if a file is running and not to see if it exists.

Thanks.
<a href="https://sridharkatakam.com">My blog</a>

jgpaiva

  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 4,727
    • View Profile
    • Donate to Member
Sure, that's easy. Only notice that it'll only work by the name of the process. It cannot detect if it's a specific file under a specific path.
It works in the exact same way as the other one, only that instead of passing it the path to the file, you pass it the name of the executable.

sri

  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 689
    • View Profile
    • Sridhar Katakam
    • Read more about this member.
    • Donate to Member
Thanks for that but I was actually looking for a prog (.exe) that will check if a specific file (at the same location as the .exe) is open.
<a href="https://sridharkatakam.com">My blog</a>

jgpaiva

  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 4,727
    • View Profile
    • Donate to Member
Oh, you mean like checking if a .doc file is open in word or something? I don't think i know how to do that :(

Brad

  • Participant
  • Joined in 2006
  • *
  • default avatar
  • Posts: 4
    • View Profile
    • Donate to Member
Re: IDEA: .exe to check for a file/folder existance and act accordingly
« Reply #6 on: September 27, 2007, 01:06 AM »
Hello,

I have something similar that I wrote.

http://www.easyhr.co...easy_file_in_use.htm
Checks whether a file is in use.

http://www.easyhr.co...easy_is-it-there.htm
Checks to see if a directory exists and if it does, runs an EXE with parameters

Both work independantly.