iOS啓動頁自動命名工具

前段時間作了個app模板,須要大量打包app。其中就涉到啓動頁命名。設計師給的是中文命名。哎,若是讓設計同窗一張一張給,可能也會有些麻煩。無奈,本身寫了利用app

AppleScript寫了個工具,在這裏分享出來。工具

主要思路就是判斷圖片的高,根據不一樣高度命不一樣的名字。this

iPhone4:640*960spa

iPhone5:640*1136設計

iPhone6:750*1334blog

iPhone6P:1242*2208圖片

set iPhone4_name to "Default-480h@2x.png" as string
set iPhone5_name to "Default-568h@2x.png" as string
set iPhone6_name to "Default-667h@2x.png" as string
set iPhone6P_name to "Default-736h@2x.png" as string

set f to choose folder
tell application "Finder"
	set all_files to (files of entire contents of f) as alias list
end tell

repeat with this_file in all_files
	try
		tell application "Image Events"
			set this_image to open this_file
			-- extract the value for the metadata tag
			tell this_image
				set the image_height to the value of metadata tag "pixelHeight"
			end tell
			-- purge the open image data
			close this_image
			
			if the image_height = 960 then
				set the name of this_file to iPhone4_name as string
			else if the image_height = 1136 then
				set the name of this_file to iPhone5_name as string
			else if the image_height = 1334 then
				set the name of this_file to iPhone6_name as string
			else if the image_height = 2208 then
				set the name of this_file to iPhone6P_name as string
			else
				display dialog buttons {"Cancel"} default button 1
			end if
			
		end tell
	on error error_message
		display dialog error_message
	end try
end repeat

我也打了個包,下載下來就能夠用了。ip

自動命名啓動圖.zip get

相關文章
相關標籤/搜索