Rename when it is in process??

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
alemrantareq
Posts: 203
Joined: Wed Jul 23, 2008 8:46 am

Rename when it is in process??

Post by alemrantareq » Tue Jan 11, 2011 4:02 am

Hi everybody, How are you? Hope fine. I use rev ent 4.0 & I wonder that application made by rev can be renamed while it's in process. How is it possible & how could I stop this? :?

Klaus
Posts: 14208
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Rename when it is in process??

Post by Klaus » Tue Jan 11, 2011 11:53 am

Hi,
alemrantareq wrote:I use rev ent 4.0 & I wonder that application made by rev can be renamed while it's in process. How is it possible...
I have no idea, but I think this is an OS issue.
alemrantareq wrote:...how could I stop this? :?
You can't! Simply because you cannot control the users behavior outside of your app! 8)


Best

Klaus

alemrantareq
Posts: 203
Joined: Wed Jul 23, 2008 8:46 am

Re: Rename when it is in process??

Post by alemrantareq » Tue Jan 11, 2011 3:05 pm

Klaus wrote:....You can't! Simply because you cannot control the users behavior outside of your app!
But the other applications except rev can't rename while they're in process. :shock:

kray
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 56
Joined: Sat Apr 08, 2006 5:28 pm
Contact:

Re: Rename when it is in process??

Post by kray » Tue Jan 11, 2011 3:16 pm

Can I ask why you need to rename a running Rev app?
Ken Ray
Sons of Thunder Software
Email: kray@sonsothunder.com
Web site: http://www.sonsothunder.com

alemrantareq
Posts: 203
Joined: Wed Jul 23, 2008 8:46 am

Re: Rename when it is in process??

Post by alemrantareq » Tue Jan 11, 2011 4:48 pm

No, I've no need to rename running rev app, rather I need to prevent it, because I'm developing a program, and if you rename & run it while it's in process, it'll cause program crashes.

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10354
Joined: Wed May 06, 2009 2:28 pm

Re: Rename when it is in process??

Post by dunbarx » Tue Jan 11, 2011 5:33 pm

Wouldn't setting the cantModify property do the trick?

Craig Newman

Klaus
Posts: 14208
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Rename when it is in process??

Post by Klaus » Tue Jan 11, 2011 5:39 pm

I am sure he means renaming the app/exe in the FInder/Explorer while it is running.

I personally would not care, if the user of my app wants to do something dumb, hey, its her/his machine 8)
Free will(y) etc... :D


Best

Klaus

wsamples
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 264
Joined: Mon May 18, 2009 4:12 am

Re: Rename when it is in process??

Post by wsamples » Tue Jan 11, 2011 6:44 pm

Do you know why it crashes after the renaming? Perhaps there's a way to address that. For instance, if you've stored a reference to the app folder name before the name change that reference will no longer work but as inelegant as it may feel, doing the whole process of discovering the actual current location every time you need to use it should prevent that particular problem. Maybe just another silly question, but how did this issue occur to you? Ordinarily it would seem an extremely unusual thing for a user to be doing. Is there something about your app's function that would make this more likely than usual?

alemrantareq
Posts: 203
Joined: Wed Jul 23, 2008 8:46 am

Re: Rename when it is in process??

Post by alemrantareq » Tue Jan 11, 2011 7:27 pm

I'm working with some font fixing issues. Before my app open, it checks some errors; so while it is already in process to fix the errors, if any user rename & run it twice then it'll surely can't do the script well as well as the system will be crashed.

cantModify property not works in this issue. Does address property could help? How? Please, give me a sample. Thanks....

kray
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 56
Joined: Sat Apr 08, 2006 5:28 pm
Contact:

Re: Rename when it is in process??

Post by kray » Wed Jan 12, 2011 4:30 am

When does your stack crash after it's been renamed? On the next user action or only on certain actions?
Ken Ray
Sons of Thunder Software
Email: kray@sonsothunder.com
Web site: http://www.sonsothunder.com

alemrantareq
Posts: 203
Joined: Wed Jul 23, 2008 8:46 am

Re: Rename when it is in process??

Post by alemrantareq » Wed Jan 12, 2011 7:06 am

I've made a script which will check before starting whether the imagename of the app exists in the tasklist or not; if exists it'll show an error message & quit, but not the previous one. To make this script applicable, I don't want to let the users to rename while its running. Because if it's renamed & run, it'll show the renamed image in the tasklist checking that the app is not running in memory.

kray
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 56
Joined: Sat Apr 08, 2006 5:28 pm
Contact:

Re: Rename when it is in process??

Post by kray » Wed Jan 12, 2011 2:56 pm

So is this the scenario you're trying to prevent?
  1. User launches "Foo.exe", check function runs
  2. While "Foo.exe" is in the list of running processes, user renames app to "Bar.exe"
  3. User launches "Bar.exe"
  4. A second instance of the app is launched and runs the check function again, creating a crash
Of so, have you tried using a "relaunch" message trap (see "relaunch" in the LC docs). I know it works with a mutex, but I'm not sure if the relaunch handler will trigger if the app is renamed...
Ken Ray
Sons of Thunder Software
Email: kray@sonsothunder.com
Web site: http://www.sonsothunder.com

alemrantareq
Posts: 203
Joined: Wed Jul 23, 2008 8:46 am

Re: Rename when it is in process??

Post by alemrantareq » Wed Jan 12, 2011 5:02 pm

Thanks kray, relaunch message works perfectly even the app name is renamed. :D

Klaus
Posts: 14208
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Rename when it is in process??

Post by Klaus » Wed Jan 12, 2011 7:26 pm

Ah, good to know that the name of an app/exe in the Finder/Desktop is just a "Label" and not the "real" process name!

kray
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 56
Joined: Sat Apr 08, 2006 5:28 pm
Contact:

Re: Rename when it is in process??

Post by kray » Wed Jan 12, 2011 11:19 pm

Nice! Wasn't sure that would work, but in retrospect it makes sense (each app has a unique GUID, so even if renamed the GUID would be the same).
Ken Ray
Sons of Thunder Software
Email: kray@sonsothunder.com
Web site: http://www.sonsothunder.com

Post Reply