8
10

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Xcodeで開いているファイルをAppCodeで開くAppleScript

Posted at

Xcodeで開いているファイルをAppCodeで開くAppleScriptを作成しました。

まずAppCodeのメニューTools->Create Command-line Launcher…でコマンドを作成します。

以下のスクリプトを実行するとXcodeで開いているファイルがAppCodeで開かれます。Xcodeでカーソルがある行にカーソルが移動します。

tell application "Xcode"
	set projectPath to path of active workspace document
	set projectFolder to characters 1 thru -((offset of "/" in (reverse of items of projectPath as string)) + 1) of projectPath as string
	
	set currentDocument to document 1 whose name ends with (word -1 of (get name of window 1))
	set filePath to path of currentDocument
	
	set range to selected paragraph range of currentDocument
	set lineNumber to item 1 of range
	
	do shell script "/usr/local/bin/appcode " & projectFolder & " " & filePath & ":" & lineNumber
end tell

私はAlfredで実行できるように設定しました。これでXcodeからAppCodeへの移動が楽になりました。

8
10
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
8
10

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?