• 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: saving front window using osascript...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: saving front window using osascript...


  • Subject: Re: saving front window using osascript...
  • From: Rick Ballard <email@hidden>
  • Date: Thu, 8 Nov 2007 10:52:14 -0800

The problem with your current script is that the output of an Xcode user script is buffered until the end of the script, as is appropriate in most cases. In your case, since you want to execute more actions (an applescript save command) after the output goes to the document, I'd suggest using another applescript command to dump your output to the document instead of doing so with the user script's output destination. You can manipulate text documents in Xcode with applescript similarly to how you can in other applications.

	- Rick

On Nov 8, 2007, at 1:51 AM, Fons Rademakers wrote:

Hi Rick,

many thanks that help, to use "document". However, what I try to achieve is to have a user script that:

- strips all trailing blanks and tabs from a file
- saves the file

I tried:

- Input: "Entire Document"
- Directory: "Home Directory"
- Script:

#!/bin/sh
#
# Removes trailing blanks (spaces and tabs) from the file + save.
#

perl -pe 's/[\t ]+$//g' <&0

osascript << ENDOFSCRIPT
tell application "Xcode"
  save the front document
end tell
ENDOFSCRIPT

but this does not work as the save is of the document before the perl modified text is pasted in. How can I make such a two step script?

Cheers, Fons.




Rick Ballard wrote:
On Nov 7, 2007, at 5:02 PM, Fons Rademakers wrote:
Hi,

something very trivial. I want to save the Xcode front window via osascript:

tell application "Xcode"
 save front window
 close front window
end tell

only closes but does not save the window. What script command should I use? write to file? If so how do I get the type?
tell application "Xcode"
   close front document saving <yes/no/ask>
end tell
   - Rick

_______________________________________________ Do not post admin requests to the list. They will be ignored. Xcode-users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: saving front window using osascript...
      • From: Fons Rademakers <email@hidden>
References: 
 >saving front window using osascript... (From: Fons Rademakers <email@hidden>)
 >Re: saving front window using osascript... (From: Rick Ballard <email@hidden>)
 >Re: saving front window using osascript... (From: Fons Rademakers <email@hidden>)

  • Prev by Date: Re: SDK 10.3.9, XCode 3 symbol(s) not found
  • Next by Date: What happened to Find Selected Text in Xcode 3
  • Previous by thread: Re: saving front window using osascript...
  • Next by thread: Re: saving front window using osascript...
  • Index(es):
    • Date
    • Thread