• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: How do I move my running app?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How do I move my running app?


  • Subject: Re: How do I move my running app?
  • From: Satoshi Matsumoto <email@hidden>
  • Date: Tue, 04 Jul 2006 09:33:18 +0900
  • Thread-topic: How do I move my running app?

Hi, Alan

on 06.7.4 8:24 AM, Alan Smith at email@hidden wrote:
> On queue, I want to move my app into a folder that would have just
> been created. I've found that this can't be done if the app is
> running.
> I need to find a way to run a command so it sleeps for a few seconds
> while my app quits, then move the app and restart it.

This is not a Cocoa app but an AppleSript "Restart Finder" that quit Finder
and wait while Finder is quitting, then launch Finder again.

---------------------------
tell application "Finder" to quit
set theTime to time of (current date)
set maxTime to theTime + 3
repeat while theTime < maxTime
    if time of (current date) > theTime then
        if IsProcessExist("Finder") is false then
            tell application "Finder" to launch
            return
        end if
        set theTime to time of (current date)
    end if
end repeat
display dialog "Failed to quit Finder!" buttons {"OK"}
return

on IsProcessExist(inAppName)
    tell application "System Events"
        copy every process to theList
        set outResult to false
        repeat with theItem in theList
            try
                if name of theItem is inAppName then
                    set outResult to true
                    return outResult
                end if
            on error
                set outResult to false
                return outResult
            end try
        end repeat
    end tell
    return outResult
end IsProcessExist

---------------------------

Satoshi
-----------------------------------------------------
Satoshi Matsumoto <email@hidden>
816-5 Odake, Odawara, Kanagawa, Japan 256-0802


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: How do I move my running app?
      • From: "Alan Smith" <email@hidden>
References: 
 >How do I move my running app? (From: "Alan Smith" <email@hidden>)

  • Prev by Date: Re: Model / View best practice
  • Next by Date: Re: Model / View best practice
  • Previous by thread: How do I move my running app?
  • Next by thread: Re: How do I move my running app?
  • Index(es):
    • Date
    • Thread