Go Back   The macosxhints Forums > OS X Help Requests > AppleScript



Reply
 
Thread Tools Rate Thread Display Modes
Old 11-06-2012, 03:10 PM   #21
zengara
Prospect
 
Join Date: Nov 2012
Posts: 16
okay, I use exactly the same script and the script opens and after 5 seconds it closes and never opens again.
zengara is offline   Reply With Quote
Old 11-06-2012, 03:29 PM   #22
hayne
Site Admin
 
Join Date: Jan 2002
Location: Montreal
Posts: 31,940
Umm, if you are running the script "with no changes", then you are missing the point - the script is set up to show you how to do the operation - but it refers to fake (non-existent) apps and so you need to edit it to refer to the apps you want.
__________________
hayne.net/macosx.html
hayne is offline   Reply With Quote
Old 11-07-2012, 01:37 AM   #23
mark hunte
MVP
 
Join Date: Apr 2004
Location: Hello London Calling
Posts: 1,787
I do not think you are saving the script correctly.

see the last part of the post
__________________
MH.
mark hunte is offline   Reply With Quote
Old 11-07-2012, 11:52 AM   #24
zengara
Prospect
 
Join Date: Nov 2012
Posts: 16
Hi,

What I mean was I didnīt change the main code, I only add my apps.
zengara is offline   Reply With Quote
Old 11-07-2012, 12:10 PM   #25
chabig
Hall of Famer
 
Join Date: Jan 2002
Posts: 2,932
There is a Prefpane called "Do Something When" that can monitor the system and take actions when an application is quit. For example, you can build a rule that quits another app when the one you're watching quits. You can cascade rules to achieve whatever you want.

http://www.azarhi.com/Projects/DSW/index.php
chabig is offline   Reply With Quote
Old 11-07-2012, 02:01 PM   #26
zengara
Prospect
 
Join Date: Nov 2012
Posts: 16
okay it works

thanks.

what if I want to close and app when other is running, but first I want to check if that app exist.

So far I got this code and is working.
But I need to check if the Lessons are running or exist.

Code:
repeat
	
	set myProcesses to {"Lesson1", "Lesson1.1"} -- The ones to quit.
	
	tell application "System Events"
		repeat with myProcess in myProcesses
			set theID to (unix id of processes whose name is myProcess)
			try
				-- Should stop the application with no dialogs and no items saved.
				do shell script "kill -9 " & theID
			end try
		end repeat
	end tell
	
	tell application "System Events"
		if "Test" is not in (name of application processes) then exit repeat
	end tell
	delay 2
	
end repeat

Last edited by zengara; 11-07-2012 at 02:11 PM.
zengara is offline   Reply With Quote
Old 11-07-2012, 02:23 PM   #27
DeltaMac
League Commissioner
 
Join Date: Jan 2002
Posts: 7,957
Can you ask that in a different way, so it's more understandable?
How could an app be running, if it does NOT exist?
I suppose you mean to check to see if an app is installed?
Why should that matter, unless you want to leave an app running, but only if the OTHER app is either not running, or not installed?
I would think you only need to check if that other app is NOT running, as it can't possibly be running if it's not installed (does not exist on that computer)
(and, now I am confused?? )
DeltaMac is online now   Reply With Quote
Old 11-07-2012, 03:10 PM   #28
zengara
Prospect
 
Join Date: Nov 2012
Posts: 16
Sorry,

I wish to find out first is the person has the app installed.
Because is posible they donīt install the Lessons apps (some will come in a second CD).
So, I will like to run the script and donīt get an error if the apps are not installed.

Thanks
zengara is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



All times are GMT -5. The time now is 03:42 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2013, vBulletin Solutions, Inc.
Site design © IDG Consumer & SMB; individuals retain copyright of their postings
but consent to the possible use of their material in other areas of IDG Consumer & SMB.