【iMessage群发】imessage群发软件之批量自动群发苹果推信功能

时间: 作者: 点击量:
  网上很多发送imessage群发短信的文章和代码片段,但多是无法运行或者仅能发送一些固定文本。所以特写此文,给大家分享一下完整的iMessage群发短信功能,以及过程中踩到的坑。
  
  脚本简介:
  
  群发功能使用 AppleScript 编写,为了方便,直接使用Mac自带的脚本编辑器 编辑并运行;
  
  运行脚本会自动打开iMessage软件,并自动使用IMessage群发,不可在后台运行,所以大批量发送号码时,电脑会有点卡;
  
  实现了读取指定文本文件内容中的所有手机号进行短信群发;
  
  实现了同时发送文字短信和发送图片短信;
  
  实现了写日志文件,记录已发送号码;
  
  实现了短信内容中随机更改嵌入表情,简单去重防封,苹果检测到同一账号下大量发送重复短信会做封号处理;
  
 
imessage代发、苹果imessage代发、苹果推信群发、苹果推信群发软件、苹果推信群发工具/苹果推信代发、苹果推信代发软件、苹果推信代发工具/imessage营销软件、imessage推广软件、imessage推广工具/苹果推信、苹果推广、苹果推广工具、苹果推广软件、苹果营销软件

  
  检测账号是否是iMessage账号的方案:通过脚本将手机号自动写入iMessage的收件人输入框内,然后通过判断颜色偏蓝即为iMessage账号。其本质是iMessage会在后台调接口判断文本框中的账号是否为合法账号,接口一般只能调200次左右,之后重启系统次数会清零;
  
  全自动化思路:在windows系统上自动克隆并多开虚拟机,自动控制每台虚拟机发送数量达到200条时,关机-并修改序列号-启动-重新自动切换ID进行发送;
  
  自动切换登录ID的思路:通过脚本识别UI和操控登录与退出,当然,直接用私有API会强一些,听别人说有人用,我没找到。;
  
  自动检测手机是否为iMessage账号的脚本我写了一个。切换登录账号的也写了一个。过些天共享如何切换iMessage登录账号给大家.
 
话不多说,上代码!
 
主要代码


set successCount to 0
set errorCount to 0

tell application "Messages"
	with timeout of 8 * 3600 seconds
		set phoneFilePath to my current_folder_path() & "phoneNumber.txt"
		set phoneData to read phoneFilePath
		set phoneEntries to paragraphs of phoneData
		
		repeat with i from 1 to count phoneEntries
			-- *******************************************
			-- 将要发送的短信文本内容
			-- *******************************************
			set msgText to (my AppendFace("锄禾日当午,")) & my AppendFace("汗滴禾下土。") & my AppendFace("谁知盆中餐,") & my AppendFace("全粒粒皆辛苦!") & my AppendFace("+微信:xxxxxxxxx")
			
			set phone to (phoneEntries's item i)'s text
			set targetService to (1st service whose service type = iMessage)
			set theBuddy to buddy phone of targetService
			
			-- 假如字符串不是11位,则草率判定不是手机号
			set num to the length of phone
			
			if (num = 11 and (my isSendPhone(phone)) = false) then
				try
					send msgText to theBuddy
					
					-- *******************************************
					-- 将要发送的短信图片,默认发送脚本同路径下,名为“img.jpg”的图片
					-- *******************************************
					-- 图片路径
					set imageFilePath to my current_folder_path() & "img.jpg"
					send file (POSIX file imageFilePath as string) to theBuddy
					
					--send msgText to theBuddy
					
					set logText to phone & " *** " & "1" & " *** " & date string of (current date) & " " & time string of (current date) & " *** " & "发送成功
"
					-- 25秒发一条消息
					-- delay (random number from 2 to 5)
					delay 1
					
					my WriteLog(logText)
					my WritePhone(phone)
					
					set successCount to successCount + 1 -- 记录成功个数		
				on error errorMessage number errorNumber
					
					set logText to phone & " *** " & "0" & " *** " & date string of (current date) & " " & time string of (current date) & " *** " & "发送失败
"
					my WriteLog(logText)
					log "捕获的异常:" & errorMessage & "异常的编号:" & errorNumber
					set errorCount to errorCount + 1 -- 记录失败个数
				end try
			end if
		end repeat
		
		set titleStr to "发送成功:" & successCount & "个
" & "发送失败:" & errorCount & "个
"
		set btns to {"知道了"}
		display dialog titleStr buttons btns default button 1 --默认选择第1个按钮(return时就会让弹出框消失)
		get the button returned of the result -- 弹出框
	end timeout
end tell


文案拼接表情:

每条简短文案后面会加上个换行符,简单内容排版

 

on AppendFace(msgText)
	set face to my RandomFace()
	set content to face & msgText & "
"
end AppendFace


随机生成表情:

on RandomFace()
	-- 表情数组
	set faceList to {"?", "?", "?�1�5", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?"}
	set face to item (random number from 1 to count faceList) of faceList
	return face
end RandomFace


写日志:imessage群发软件、imessage群发、imessage群发软件、群发imessage、imessage批量自动群发、imessage推信群发

– the_text(日志内容)

-- 日志写入
-- 	the_text(日志内容)
on WriteLog(the_text)
	set fileName to date string of (current date)
	set logFilePath to my current_folder_path() & "log/" & fileName & ".txt"
	set this_file to (POSIX file logFilePath as string)
	my write_to_file(the_text, this_file, true, false)
end WriteLog

写入文件;

– the_text(日志内容)

-- 写入文件
--	this_data(文本内容,string)
--	target_file(文件路径,string)
--	append_data(是否拼接,boolean)
--	append_end(是否从后面拼接,boolean)
on write_to_file(this_data, target_file, append_data, append_end)
	try
		set the target_file to the target_file as text
		set the open_target_file to �0�1
			open for access file target_file with write permission
		
		if append_data is false then
			set eof of the open_target_file to 0
			write this_data to the open_target_file starting at eof
		else if append_end is false then
			-- 1、读取原来内容;
			-- 2、清空文件,写入新内容;
			-- 3、在新内容后面拼接原始内容
			try
				set fp to open for access target_file
				set myText to read fp
				set eof of the open_target_file to 0
				write this_data to the open_target_file starting at eof
				write myText to the open_target_file starting at eof
			on error
				write this_data to the open_target_file starting at eof
			end try
		else
			write this_data to the open_target_file starting at eof
		end if
		
		close access the open_target_file
		return target_file
	on error
		try
			close access file target_file
		end try
		return false
	end try
end write_to_file

获取当前文件路径:

on current_file_path()
	set CurrentActiveDocument to document 1 whose name ends with (word -1 of (get name of window 1))
	set WhatYouWant to path of CurrentActiveDocument
	return WhatYouWant
end current_file_path


获取当前文件的父文件夹路径

on current_folder_path()
	set UnixPath to POSIX path of ((path to me as text) & "::")
	return UnixPath
end current_folder_path

imessage群发软件、imessage群发、imessage群发软件、群发imessage、imessage批量自动群发、imessage推信群发

注意事项及爬坑
需要群发的iMessage账号,需要提前通过iMessage客户端校验,才能用脚本进行发短信,否则会出现如下错误:
Messages”遇到一个错误:不能获得“buddy id “A5C910FC-500C-4DBD-A50C-0A019E4CD87C:+86182xxxx4444””
 
账号校验教程看图解
打开iMessage:
在这里插入图片描述
 
新建信息,将要校验的账号全部复制到收件人输入框中:(蓝色的为iMessage账号,红色为非iMessage账号)
在这里插入图片描述
 
偶尔会遇到如下无法读取文件内容报错:
“Messages”遇到一个错误:不能将“"/Users/xx/Desktop/SendMsg/phoneNumber1.txt"”转换为“file”类型
解决方法:
修改文件名。没错!就是这么简单粗暴!
 
 AppleScript国内资料太少,想尽量把一些常用功能(如字符串拼接、随机数、设置超时、文件读写等)写出来让初学者学习。
脚本无法实现准确记录短信发送是否到达,只能记录发送是否会出现异常,翻了好多外国网站,没发现AppleScript提供有短信发送是否到达的回调函数。



imessage群发软件、imessage群发、imessage群发软件、群发imessage、imessage批量自动群发、imessage推信群发
imessage代发、苹果imessage代发、苹果推信群发、苹果推信群发软件、苹果推信群发工具/苹果推信代发、苹果推信代发软件、苹果推信代发工具/imessage营销软件、imessage推广软件、imessage推广工具/苹果推信、苹果推广、苹果推广工具、苹果推广软件、苹果营销软件


imessage代发、苹果imessage代发、苹果推信群发、苹果推信群发软件、苹果推信群发工具/苹果推信代发、苹果推信代发软件、苹果推信代发工具/imessage营销软件、imessage推广软件、imessage推广工具/苹果推信、苹果推广、苹果推广工具、苹果推广软件、苹果营销软件
 

上一篇:没有了

下一篇:iMessage群发软件推广技术实现原理分析,imessage推广工具

注册体验: