#include <GUIConstantsEx.au3>
#include <EditConstants.au3>
#include <ProgressConstants.au3>
#include <WindowsConstants.au3>
#include <StaticConstants.au3>
#include <TreeViewConstants.au3>
#include <File.au3>
#NoTrayIcon
Opt('MustDeclareVars', 1)
GUICreate('v1', 310, 180, -1, -1)
Dim $p, $Button, $Button2, $nMsg,$i,$Str,$InputNum,$l1,$l2,$Radio1,$Radio2,$Combo1,$p2,$Button3,$ywxx,$Str2,$R,$p3
$p = GUICtrlCreateInput("0", 100, 105, 70, 20)
$p2 = GUICtrlCreateInput("", 35, 45, 170, 20)
$Button = GUICtrlCreateButton("创建联系人", 180, 105, 110, 20)
$Button2 = HotKeySet("{ESC}","Terminate")
$Button3 = GUICtrlCreateButton("目标文件夹", 210, 45, 80, 20)
$Radio1 = GUICtrlCreateRadio('前缀 000',20,90)
$Radio2 = GUICtrlCreateRadio('无前缀',20,110)
$Combo1 = GUICtrlCreateCombo('请选择版本',80,15,150,20)
GUICtrlSetData(-1, "2.1|3.0")
$l1 = GUICtrlCreateLabel('输入数目',35,70,250,15)
$l2 = GUICtrlCreateLabel("按'Esc'来终止程序",55,150,250,15)
GUICtrlSetColor(-1, 0xff0000)
GUISetState()
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button2
Terminate()
Case $Button3
$ywxx = FileSelectFolder("选择文件夹", "", 4)
If @error Then ContinueLoop
GUICtrlSetData($p2, $ywxx)
Case $Button
Switch $R=GUICtrlRead($Combo1)
Case '2.1'
If BitAND(GUICtrlRead($Radio1), $GUI_CHECKED) Then Create()
If BitAND(GUICtrlRead($Radio2), $GUI_CHECKED) Then Create2()
Case '3.0'
If BitAND(GUICtrlRead($Radio1), $GUI_CHECKED) Then Create4()
If BitAND(GUICtrlRead($Radio2), $GUI_CHECKED) Then Create3()
EndSwitch
EndSwitch
WEnd
Func Terminate()
Exit 0
EndFunc ;==>Terminate
Func Create()
$InputNum=GUICtrlRead($p)
$p3=GUICtrlRead($p2)
For $i=1 to $InputNum step 1
$Str = 'BEGIN:VCARD'&@CRLF&'VERSION:2.1'&@CRLF&'N;LANGUAGE=zh-sg:Contact'&$i&@CRLF&'FN:Contact' &$i&@CRLF&'ORG:Creative'&$i&';'&'PDE'&$i&@CRLF&'TITLE:SQA'&$i&@CRLF&'TEL;WORK;VOICE:B 00000'&$i&@CRLF&'TEL;HOME;VOICE:H 00000'&$i&@CRLF&'TEL;CELL;VOICE:M 00000'&$i&@CRLF&'TEL;WORK;FAX:BF 00000'&$i&@CRLF&'ADR;WORK;PREF:;;SQA Road;Creative;PDE;00000'&$i&';Singapore'&@CRLF&'LABEL;WORK;PREF;ENCODING=QUOTED-PRINTABLE:SQA Road=0D=0A='&@CRLF&'Creative PDE 00000'&$i&@CRLF&'X-MS-OL-DEFAULT-POSTAL-ADDRESS:2'&@CRLF&'URL;WORK:www.contact'&$i&'.com'&@CRLF&'EMAIL;PREF;INTERNET:Contact'&$i&'@hotmail.com'&@CRLF&'X-MS-IMADDRESS:Contact'&$i&'@hotmail.com'&@CRLF&'X-MS-CARDPICTURE;TYPE=JPEG;ENCODING=BASE64:'&@CRLF&' /9j/4AAQSkZJRgABAQEAYABgAAD/2wBDAAYEBQYFBAYGBQYHBwYIChAKCgkJChQODwwQFxQY'&@CRLF&' GBcUFhYaHSUfGhsjHBYWICwgIyYnKSopGR8tMC0oMCUoKSj/2wBDAQcHBwoIChMKChMoGhYa'&@CRLF&' KCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCj/wAAR'&@CRLF&' CACUACcDASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAA'&@CRLF&' AgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkK'&@CRLF&' FhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZ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CRLF&' sU9P0NMMfv8AmKaetAYjoSKAAo2OOfoaKN57gH8KKAJ0+434Ux/vt9aKKAIz1ooooAZRRRQB'&@CRLF&' /9k='&@CRLF&''&@CRLF&'X-MS-OL-DESIGN;CHARSET=utf-8:<card xmlns="http://schemas.microsoft.com/office/outlook/12/electronicbusinesscards" ver="1.0" layout="left" bgcolor="ffffff"><img xmlns="" align="fit" area="16" use="cardpicture"/><fld xmlns="" prop="name" align="left" dir="ltr" style="b" color="000000" size="12"/><fld xmlns="" prop="org" align="left" dir="ltr" color="000000" size="10"/><fld xmlns="" prop="title" align="left" dir="ltr" color="000000" size="10"/><fld xmlns="" prop="dept" align="left" dir="ltr" color="000000" size="10"/><fld xmlns="" prop="telwork" align="left" dir="ltr" color="000000" size="10"><label align="left" color="626262">Work</label></fld><fld xmlns="" prop="telcell" align="left" dir="ltr" color="000000" size="10"><label align="left" color="626262">Mobile</label></fld><fld xmlns="" prop="telhome" align="left" dir="ltr" color="000000" size="10"><label align="left" color="626262">Home</label></fld><fld xmlns="" prop="email" align="left" dir="ltr" color="000000" size="10"/><fld xmlns="" prop="addrwork" align='&@CRLF&'"left" dir="ltr" color="000000" size="10"/><fld xmlns="" prop="webwork" align="left" dir="ltr" color="000000" size="10"/><fld xmlns="" prop="blank" size="10"/><fld xmlns="" prop="blank" size="10"/><fld xmlns="" prop="blank" size="10"/><fld xmlns="" prop="blank" size="10"/><fld xmlns="" prop="blank" size="10"/><fld xmlns="" prop="blank" size="10"/></card>'&@CRLF&'REV:20100205T072550Z'&@CRLF&'END:VCARD'
FileWrite($p3&'\'&'Contact' &'00'& $i & '.vcf', $Str)
Next
EndFunc
Func Create2()
$InputNum=GUICtrlRead($p)
$p3=GUICtrlRead($p2)
For $i=1 to $InputNum step 1
$Str = 'BEGIN:VCARD'&@CRLF&'VERSION:2.1'&@CRLF&'N;LANGUAGE=zh-sg:Contact'&$i&@CRLF&'FN:Contact' &$i&@CRLF&'ORG:Creative'&$i&';'&'PDE'&$i&@CRLF&'TITLE:SQA'&$i&@CRLF&'TEL;WORK;VOICE:B 00000'&$i&@CRLF&'TEL;HOME;VOICE:H 00000'&$i&@CRLF&'TEL;CELL;VOICE:M 00000'&$i&@CRLF&'TEL;WORK;FAX:BF 00000'&$i&@CRLF&'ADR;WORK;PREF:;;SQA Road;Creative;PDE;00000'&$i&';Singapore'&@CRLF&'LABEL;WORK;PREF;ENCODING=QUOTED-PRINTABLE:SQA Road=0D=0A='&@CRLF&'Creative PDE 00000'&$i&@CRLF&'X-MS-OL-DEFAULT-POSTAL-ADDRESS:2'&@CRLF&'URL;WORK:www.contact'&$i&'.com'&@CRLF&'EMAIL;PREF;INTERNET:Contact'&$i&'@hotmail.com'&@CRLF&'X-MS-IMADDRESS:Contact'&$i&'@hotmail.com'&@CRLF&'X-MS-CARDPICTURE;TYPE=JPEG;ENCODING=BASE64:'&@CRLF&' /9j/4AAQSkZJRgABAQEAYABgAAD/2wBDAAYEBQYFBAYGBQYHBwYIChAKCgkJChQODwwQFxQY'&@CRLF&' GBcUFhYaHSUfGhsjHBYWICwgIyYnKSopGR8tMC0oMCUoKSj/2wBDAQcHBwoIChMKChMoGhYa'&@CRLF&' KCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCj/wAAR'&@CRLF&' CACUACcDASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAA'&@CRLF&' AgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkK'&@CRLF&' FhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWG'&@CRLF&' h4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl'&@CRLF&' 5ufo6erx8vP09fb3+Pn6/8QAH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="http://schemas.microsoft.com/office/outlook/12/electronicbusinesscards" ver="1.0" layout="left" bgcolor="ffffff"><img xmlns="" align="fit" area="16" use="cardpicture"/><fld xmlns="" prop="name" align="left" dir="ltr" style="b" color="000000" size="12"/><fld xmlns="" prop="org" align="left" dir="ltr" color="000000" size="10"/><fld xmlns="" prop="title" align="left" dir="ltr" color="000000" size="10"/><fld xmlns="" prop="dept" align="left" dir="ltr" color="000000" size="10"/><fld xmlns="" prop="telwork" align="left" dir="ltr" color="000000" size="10"><label align="left" color="626262">Work</label></fld><fld xmlns="" prop="telcell" align="left" dir="ltr" color="000000" size="10"><label align="left" color="626262">Mobile</label></fld><fld xmlns="" prop="telhome" align="left" dir="ltr" color="000000" size="10"><label align="left" color="626262">Home</label></fld><fld xmlns="" prop="email" align="left" dir="ltr" color="000000" size="10"/><fld xmlns="" prop="addrwork" align='&@CRLF&'"left" dir="ltr" color="000000" size="10"/><fld xmlns="" prop="webwork" align="left" dir="ltr" color="000000" size="10"/><fld xmlns="" prop="blank" size="10"/><fld xmlns="" prop="blank" size="10"/><fld xmlns="" prop="blank" size="10"/><fld xmlns="" prop="blank" size="10"/><fld xmlns="" prop="blank" size="10"/><fld xmlns="" prop="blank" size="10"/></card>'&@CRLF&'REV:20100205T072550Z'&@CRLF&'END:VCARD'
FileWrite($p3&'\'&'Contact' & $i & '.vcf', $Str)
Next
EndFunc
Func Create3()
$InputNum=GUICtrlRead($p)
$p3=GUICtrlRead($p2)
For $i=1 to $InputNum step 1
$Str2 = 'BEGIN:VCARD'&@CRLF&'VERSION:3.0'&@CRLF&'UID:00000000DE68105447DED646B28E5393F7B7F46224C02000'&@CRLF&'FN;CHARSET=UTF-8:Contact'&$i&@CRLF&'N;CHARSET=UTF-8:Contact'&$i&';;;;'&@CRLF&'ADR;TYPE=WORK;CHARSET=UTF-8:;;SQA Road;Creative;PDE;00000'&$i&';Singapore'&@CRLF&'LABEL;TYPE=WORK;CHARSET=UTF-8:SQA Road Creative PDE 00000'&$i&' Singapore'&@CRLF&'TEL;TYPE=WORK,VOICE:B 00000'&$i&@CRLF&'TEL;TYPE=HOME,VOICE:H 00000'&$i&@CRLF&'TEL;TYPE=WORK,FAX:BF 00000'&$i&@CRLF&'TEL;TYPE=CELL:M 00000'&$i&@CRLF&'EMAIL;TYPE=INTERNET:Contact'&$i&'@hotmail.com'&@CRLF&'TITLE;CHARSET=UTF-8:SQA'&$i&@CRLF&'ORG;CHARSET=UTF-8:Creative'&$i&';PDE'&$i&@CRLF&'URL;TYPE=HOME:www.contact'&$i&'.com'&@CRLF&'REV:20100208T173250Z'&@CRLF&'END:VCARD'&@CRLF&''
FileWrite($p3&'\'&'Contacts.vcf', $Str)
Next
EndFunc
Func Create4()
$InputNum=GUICtrlRead($p)
$p3=GUICtrlRead($p2)
For $i=1 to $InputNum step 1
$Str2 = 'BEGIN:VCARD'&@CRLF&'VERSION:3.0'&@CRLF&'UID:00000000DE68105447DED646B28E5393F7B7F46224C02000'&@CRLF&'FN;CHARSET=UTF-8:Contact000'&$i&@CRLF&'N;CHARSET=UTF-8:Contact000'&$i&';;;;'&@CRLF&'ADR;TYPE=WORK;CHARSET=UTF-8:;;SQA Road;Creative;PDE;00000000'&$i&';Singapore'&@CRLF&'LABEL;TYPE=WORK;CHARSET=UTF-8:SQA Road Creative PDE 00000000'&$i&' Singapore'&@CRLF&'TEL;TYPE=WORK,VOICE:B 00000000'&$i&@CRLF&'TEL;TYPE=HOME,VOICE:H 00000000'&$i&@CRLF&'TEL;TYPE=WORK,FAX:BF 00000000'&$i&@CRLF&'TEL;TYPE=CELL:M 00000000'&$i&@CRLF&'EMAIL;TYPE=INTERNET:Contact000'&$i&'@hotmail.com'&@CRLF&'TITLE;CHARSET=UTF-8:SQA000'&$i&@CRLF&'ORG;CHARSET=UTF-8:Creative000'&$i&';PDE000'&$i&@CRLF&'URL;TYPE=HOME:www.contact000'&$i&'.com'&@CRLF&'REV:20100208T173250Z'&@CRLF&'END:VCARD'&@CRLF&''
FileWrite($p3&'\'&'Contacts.vcf', $Str)
Next
EndFunc
那些 create() create2() create3() create4()里面可以忽略掉,单独的时候他们都是可以工作了,问题应该就在下拉选项和radio按键那边没有判断好,不知道应该怎样更改。谢谢大家。