Conditional check if program is running

Just starting out? Need help? Post your questions and find answers here.
User avatar
doctorized
Addict
Addict
Posts: 882
Joined: Fri Mar 27, 2009 9:41 am
Location: Athens, Greece

Re: Conditional check if program is running

Post by doctorized »

Marc56us wrote: Fri May 06, 2022 4:36 pm Numbered programs often start with the same prefix, so only one line is needed
I try to avoid something like this because, as I said before, the user may be doing things like renaming the app.
AZJIO
Addict
Addict
Posts: 2190
Joined: Sun May 14, 2017 1:48 am

Re: Conditional check if program is running

Post by AZJIO »

You can coerce the *.db filename to the executable filename.

Code: Select all

db$ = GetPathPart(ProgramFilename()) + GetFilePart(ProgramFilename(), #PB_FileSystem_NoExtension) + ".db"
Replace GetCurrentDirectory() with GetPathPart(ProgramFilename())
User avatar
C87
Enthusiast
Enthusiast
Posts: 178
Joined: Mon Jul 17, 2017 7:22 am
Location: Cotswolds England

Re: Conditional check if program is running

Post by C87 »

doctorized wrote : Why should a user run and use twice an app? I do not know.
This reminds me of the tale from around the campfire at Microsoft. Back in the dark days of DOS, staff were trying to convince Bill Gates to go with a graphics interface to compete with Apple. Bill's response was : "Why would anyone want to do two things at once?"

(Bill Gate is also reputed to have said that by 2000 all offices will be paperless. Mind you he's now telling everyone who will listen, that his next pandemic is on the way. So we'll see how that works out.)

Years ago at a client of mine, when I visited their offices I noticed that the owner had opened the program, then another, then another etc, etc. When I counted up she had 16 instances of the program across the taskbar. "Handy for me to click one to another instead of opening and closing screens in one copy" she said.

Maybe my design prompted this to some extent because I tend to use Modal Screens in each section of the application, so that I can have more control over what the user can do. I found over time that the ingenuity of users to do the unimaginable is limitless. The result was wasting a huge amount of time working out just how they did it.
Modal screen sets can prevent some of that. It was a database application and I advised that she didn't have so many open, or at least close them after use rather than leaving older screens open all day. They never had any issues with their database though. I did consider creating a function to prevent this but it was such a can of worms I forgot about it. (Edited: I will add that the above example was written in Microsoft Access and not PureB)

Mind you I'll sometimes open the odd program a couple of times and wouldn't like to be restricted myself.

It's all good fun. :)
If it's falling over......just remember the computer is never wrong!
Post Reply