一、imessages数据检测的两种方式:
1.人工筛选,将要验证的号码输出到文件中,以逗号分隔。再将文件中的号码粘贴到iMessage客户端的地址栏,iMessage客户端会自动逐个检验该号码是否为iMessage账号,检验速度视网速而定。红色表示不是iMessage账号,蓝色表示iMessage账号。
2.编写苹果操作系统下的脚本程序进行过滤(全自动检测,无需人工干预),类似于群发iMessage;发送一条iMessage之后,如果捕获到发送失败的异常则不是iMessage账号,捕获到发送成功则把数据保存下来。
二、实现全自动检测数据是否启用或开通imessages
1.电脑版脚本全自动检测手机号是否注册imessages,注意:检测不同国家手机号需要在手机号的前缀 +国家代码即可(自动检测导入的txt数据,蓝色的手机号数据自动保存,有偿提供源码或脚本程序联系飞机: @fz66168 )
电脑版检测脚本代码示例:
1 startApp() 2 3 on clickOk() 4 tell application "Messages" to activate 5 tell application "System Events" 6 tell process "Messages" 7 tell window 1 8 entire contents 9 end tell 10 end tell 11 end tell 12 end clickOk 13 14 15 on startApp() 16 tell application "Finder" to activate 17 18 tell application "Finder" 19 set chosenfile to (choose file) --选择制定需要检测的数据例如: phone.txt 20 end tell 21 22 tell application "Messages" 23 tell application "Messages" to activate 24 25 set phoneData to read chosenfile 26 set cards to paragraphs of phoneData 27 28 repeat with phone in cards 29 --set msgText to (my AppendFace(" ")) 30 31 -- 假如字符串不是11位,则草率判定不是手机号 32 set num to the length of phone 33 if (num > 0) then 34 --执行发送 35 my sendMsg(phone, ".") 36 delay 1 37 38 # 及时删除多余的消息 39 set chatNum to (get count of chat) 40 if chatNum is greater than 1 then 41 my deleteMsg(chatNum, phone) 42 end if 43 44 end if 45 end repeat 46 47 end tell 48 end startApp 49 50 51 # 发送信息 52 on sendMsg(phone, msg) 53 tell application "System Events" 54 tell process "Messages" 55 tell window 1 56 delay 0.2 57 key code 55 & 45 58 --核心代码,省略......... 59 end tell 60 end tell 61 end tell 62 end sendMsg 63 64 65 # 删除信息 66 on deleteMsg(maxNum, thisphone) 67 tell application "Messages" to activate 68 69 tell application "System Events" 70 tell process "Messages" 71 tell window 1 72 repeat maxNum times 73 74 delay 0.2 -- 延时0.5秒 75 click row 1 of table 1 of scroll area 1 of splitter group 1 --选中第一个会话 76 delay 0.2 -- 延时0.5秒 77 click menu item "删除对话…" of menu "文件" of menu bar item "文件" of menu bar 1 of application process "Messages" of application "System Events" 78 --激活右键菜单中的删除对话 79 delay 0.2 -- 延时0.5秒 80 81 try 82 click button "删除" of sheet 1 83 --对启用了imessage功能的手机号码进行记录 84 my WritePhone(thisphone) 85 86 end try 87 end repeat 88 end tell 89 end tell 90 end tell 91 end deleteMsg 92 93 94 95 -- 记录有效手机号 96 on WritePhone(the_phone) 97 set num to the length of the_phone 98 if (num > 0) then 99 set fileName to date string of (current date) 100 set logFilePath to my current_folder_path() & "send/检测成功的数据.txt" 101 set this_file to (POSIX file logFilePath as string) 102 set this_story to the_phone & " 103 " 104 try 105 set fp to open for access this_file 106 set myText to read fp 107 108 if (myText does not contain the_phone) then 109 my write_to_file(this_story, this_file, true, true) 110 end if 111 on error 112 my write_to_file(this_story, this_file, true, true) 113 end try 114 end if 115 end WritePhone 116 117 118 119 -- 写入文件 120 -- this_data(文本内容,string) 121 -- target_file(文件路径,string) 122 -- append_data(是否拼接,boolean) 123 -- append_end(是否从后面拼接,boolean) 124 on write_to_file(this_data, target_file, append_data, append_end) 125 try 126 set the target_file to the target_file as text 127 set the open_target_file to ¬ 128 open for access file target_file with write permission 129 130 if append_data is false then 131 set eof of the open_target_file to 0 132 write this_data to the open_target_file starting at eof 133 else if append_end is false then 134 -- 1、读取原来内容; 135 -- 2、清空文件,写入新内容; 136 -- 3、在新内容后面拼接原始内容 137 try 138 set fp to open for access target_file 139 set myText to read fp 140 set eof of the open_target_file to 0 141 write this_data to the open_target_file starting at eof 142 write myText to the open_target_file starting at eof 143 on error 144 write this_data to the open_target_file starting at eof 145 end try 146 else 147 write this_data to the open_target_file starting at eof 148 end if 149 150 close access the open_target_file 151 return target_file 152 on error 153 try 154 close access file target_file 155 end try 156 return false 157 end try 158 end write_to_file 159 160 161 -- 获取当前文件的父文件夹路径 162 on current_folder_path() 163 set UnixPath to POSIX path of ((path to me as text) & "::") 164 return UnixPath 165 end current_folder_path
全自动检测脚本运行如下图:
2.手机版脚本全自动检测数据是否imessages(全自动检测用户导入的手机号数据,蓝色的数据自动保存。)
标签:set,end,注册,--,imessage,file,target,tell,手机号 From: https://www.cnblogs.com/bf66168/p/17501074.html