ActionScript 3 用于将URL与您的bit.ly帐户相关联的TextExpander的bit.ly URL缩短脚本

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ActionScript 3 用于将URL与您的bit.ly帐户相关联的TextExpander的bit.ly URL缩短脚本相关的知识,希望对你有一定的参考价值。

set the ClipURL to (the clipboard as string)

	ignoring case
		if ((characters 1 through 4 of ClipURL as string) is not "http") then
			return "Malformed URL."
		else
  		set the EncodedClipURL to urlencode(ClipURL) of me
			set curlCMD to ¬
				"curl --stderr /dev/null \"http://bit.ly/api?url=" & EncodedClipURL & "&login=[your_username]&apiKey=[your_API_key]\""

			-- Run the script and get the result:
			set tinyURL to (do shell script curlCMD)

			return tinyURL
		end if
	end ignoring


on urlencode(theText)
	set theTextEnc to ""
	repeat with eachChar in characters of theText
		set useChar to eachChar
		set eachCharNum to ASCII number of eachChar
		if eachCharNum = 32 then
			set useChar to "+"
		else if (eachCharNum ≠ 42) and (eachCharNum ≠ 95) and (eachCharNum < 45 or eachCharNum > 46) and (eachCharNum < 48 or eachCharNum > 57) and (eachCharNum < 65 or eachCharNum > 90) and (eachCharNum < 97 or eachCharNum > 122) then
			set firstDig to round (eachCharNum / 16) rounding down
			set secondDig to eachCharNum mod 16
			if firstDig > 9 then
				set aNum to firstDig + 55
				set firstDig to ASCII character aNum
			end if
			if secondDig > 9 then
				set aNum to secondDig + 55
				set secondDig to ASCII character aNum
			end if
			set numHex to ("%" & (firstDig as string) & (secondDig as string)) as string
			set useChar to numHex
		end if
		set theTextEnc to theTextEnc & useChar as string
	end repeat
	return theTextEnc
end urlencode

以上是关于ActionScript 3 用于将URL与您的bit.ly帐户相关联的TextExpander的bit.ly URL缩短脚本的主要内容,如果未能解决你的问题,请参考以下文章

无法打开与您的身份验证代理的连接 opensuse 13.2

#1064 - 您的 SQL 语法有错误;检查与您的 MySQL 服务器版本相对应的手册,以获取在附近使用的正确语法

iPhone 使用 AlAssetsLibrary 与您的应用程序自动同步照片

ActionScript:电影完成加载 URL 后

Ionic2:此应用与您的手机不兼容

ActionScript 3 检测您的SWF是通过HTTP还是本地运行