terminal.scpt 695 字节
Newer Older
A
Andre Weinand 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
-------------------------------------------------------------------
-- Copyright (c) Microsoft Corporation. All rights reserved.
-- Licensed under the MIT License.
-- See License.txt in the project root for license information.
-------------------------------------------------------------------

on run argv
	set command to "cd \"" & argv & "\"; clear" as string

	tell application "Terminal"
		activate
		set targetWindow to null

		repeat with currentWindow in windows
			if currentWindow is not busy then
				set targetWindow to currentWindow
			end if
		end repeat

		if targetWindow  null then
			do script command in targetWindow
		else
			do script command
		end if
	end tell
end run