|
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] |
On Aug 9, 2005, at 10:48 PM, Takashi Mochizuki wrote:
Programmatically, not AppleScript, and that of course is still only valid for running processes. For the running Finder, ProcessManager process types something like... #include <Processes.h> #include <Files.h> #include <sys/types.h> /** Compile with... gcc -I/System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers -I/System/Library/Frameworks/ApplicationServices.framework/Frameworks/HIServices.framework/Headers -framework CoreServices -framework ApplicationServices -o mps mps.c */ int main(void) { mps(); } int mps() { ProcessSerialNumber psn; ProcessInfoRec info; Str255 name; FSSpec appspec; short err; pid_t pid = 0; info.processName = name; info.processInfoLength = sizeof(ProcessInfoRec); info.processAppSpec = &appspec; err = noErr; psn.highLongOfPSN = 0; psn.lowLongOfPSN = kNoProcess; for (;;) { err = GetNextProcess(&psn); if (err == procNotFound) break; if (err != 0) printf("mps: error getting process. err: %i\n",err); else { err = GetProcessInformation(&psn,&info); if (err == noErr) { printf("Name: %s\n",p2cstr(info.processName)); } else printf("mps: error getting process info. err - %i. continuing...\n",err); } } } should work. Although again thats not AppleScript. Where I've had problems since I think 10.2 is finding non-running applications by creator OSType. I think I went with a dummied up supported file extension which I think worked as a fallback even if the application wasn't running. Although I haven't verified real recently that it is actually a valid fallback. This is code I pretty much just use myself as far as I know, so I've gotten into the habit of always just making sure the application I'm looking for is already running which will work including by creator type I think. It would be nice if I could get it to reliably launch when needed. |
_______________________________________________ Do not post admin requests to the list. They will be ignored. Applescript-implementors mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
| References: | |
| >Re: Applescript-implementors Digest, Vol 2, Issue 135 (From: Jonas Salling <email@hidden>) | |
| >Re: Applescript-implementors Digest, Vol 2, Issue 135 (From: Takashi Mochizuki <email@hidden>) |
| Home | Archives | Terms/Conditions | Contact | RSS | Lists | About |
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE
Contact Apple | Terms of Use | Privacy Policy
Copyright © 2011 Apple Inc. All rights reserved.