-
Notifications
You must be signed in to change notification settings - Fork 0
/
LWBlat GUI.au3
1757 lines (1483 loc) · 66.6 KB
/
LWBlat GUI.au3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#AutoIt3Wrapper_Run_After=del "%scriptfile%_x32.exe"
#AutoIt3Wrapper_Run_After=ren "%out%" "%scriptfile%_x32.exe"
#AutoIt3Wrapper_Run_After=del "%scriptfile%_stripped.au3"
#AutoIt3Wrapper_Run_Au3Stripper=y
#Au3Stripper_Parameters=/PreExpand /StripOnly /RM ;/RenameMinimum
#AutoIt3Wrapper_Compile_both=y
#AutoIt3Wrapper_Res_Description=LWBlat GUI
#cs
[FileVersion]
#ce
#AutoIt3Wrapper_Res_Fileversion=1.4.3
#AutoIt3Wrapper_Res_LegalCopyright=Copyright (C) https://lior.weissbrod.com
#cs
Copyright (C) https://lior.weissbrod.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Additional restrictions under GNU GPL version 3 section 7:
In accordance with item 7b), it is required to preserve the reasonable legal notices/author attributions in the material and in the Appropriate Legal Notices displayed by works containing it (including in the footer).
In accordance with item 7c), misrepresentation of the origin of the material must be marked in reasonable ways as different from the original version.
#ce
#include <GuiButton.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>
#include <TabConstants.au3>
#include <EditConstants.au3>
#include <ComboConstants.au3>
#include <GUIConstantsEx.au3>
#include <UpDownConstants.au3>
#include <ColorConstants.au3>
#Include <File.au3>
#include <Inet.au3>
#include <Crypt.au3>
#include <LWServer.au3>
$default_content_type="Plain Text"
$html_content_type="HTML"
$enriched_content_type="Rich Text"
$default_charset="Auto"
$charsets=$default_charset & "|Windows-1255|UTF-8|*Custom*"
$default_profile="Default"
$profiles=$default_profile & "|*Custom*"
$default_debug="No debug"
$default_attachmentpath=""
$default_signaturepath="signature.txt"
$default_bodypath = "body.txt"
$default_logpath = "log.txt"
$default_editorpath = "%windir%\notepad.exe"
$default_blatexepath = "full\blat.exe"
$default_blatpath = "full\blat.dll"
$default_helppath = ""
$default_search = "build"
$content_types=$default_content_type & "|" & $enriched_content_type & "|" & $html_content_type
$sPassword = ""
$programname="LWBlat GUI"
$extension=".ini"
$version =StringRegExpReplace(@Compiled ? StringRegExpReplace(FileGetVersion(@ScriptFullPath), "\.0+$", "") : IniRead(@ScriptFullPath, "FileVersion", "#AutoIt3Wrapper_Res_Fileversion", "0.0.0"), "(\d+\.\d+\.\d+)\.(\d+)", "$1 beta $2")
$thedate=@YEAR
$search_keyword=""
if $cmdline[0]>0 then
exit launchdll_execute($cmdline[1], StringEncrypt(False, $cmdline[ubound($cmdline)-1]))
EndIf
$configfile = $programname & $extension
$windowtitle = $programname & " - " & $configfile
$_HiddenAUTHPassword = ""
$_HiddenPOP3Password = ""
$_HiddenIMAPPassword = ""
$configfile_default=defaultpath($configfile)
$MainWindow = GUICreate($windowtitle, 440, 580, -1, -1, -1, $WS_EX_ACCEPTFILES)
Opt("GUICoordMode", 1)
; --- Menu ---
$filemenu = GUICtrlCreateMenu("&File")
$fileitem_open = GUICtrlCreateMenuItem("&Open", $filemenu)
$fileitem_saveas = GUICtrlCreateMenuItem("&Save as", $filemenu)
GUICtrlCreateMenuItem("", $filemenu)
$fileitem_save = GUICtrlCreateMenuItem("&Save default", $filemenu)
$fileitem_load = GUICtrlCreateMenuItem("&Load default", $filemenu)
$fileitem_reset = GUICtrlCreateMenuItem("&Reset default", $filemenu)
$commandmenu = GUICtrlCreateMenu("C&ommand")
$commanditem_create = GUICtrlCreateMenuItem("&Create", $commandmenu)
$commanditem_simulator = GUICtrlCreateMenuItem("&Open Simulator", $commandmenu)
$commanditem_send = GUICtrlCreateMenuItem("&Send", $commandmenu)
$profilemenu = GUICtrlCreateMenu("&Profiles")
$profileitem_listprofiles = GUICtrlCreateMenuItem("&List installed profiles", $profilemenu)
$profileitem_saveprofile = GUICtrlCreateMenuItem("&Save to registry", $profilemenu)
$profileitem_deleteprofile = GUICtrlCreateMenuItem("&Delete from registry", $profilemenu)
$profileitem_deleteprofiles = GUICtrlCreateMenuItem("Delete &all from registry", $profilemenu)
$helpmenu = GUICtrlCreateMenu("&Help")
$helpitem_blathomepage = GUICtrlCreateMenuItem("&Visit Blat homepage", $helpmenu)
$helpitem_syntax = GUICtrlCreateMenuItem("&Blat Syntax", $helpmenu)
$helpitem_searchsyntax = GUICtrlCreateMenuItem("&Search Blat Syntax", $helpmenu)
$helpitem_about = GUICtrlCreateMenuItem("&About", $helpmenu)
; --- Tab ---
$MainTab = GUICtrlCreateTab(5, 5, 430, 440, $TCS_MULTILINE + $TCS_RIGHTJUSTIFY)
GUICtrlCreateTabItem("Mail")
GUICtrlCreateLabel("From", 15, 45)
$Input_from = GUICtrlCreateInput("", 85, 45, 340, 20)
GUICtrlCreateLabel("(Organization", 15, 70)
$Input_organization = GUICtrlCreateInput("", 85, 70, 335, 20)
GUICtrlCreateLabel(")", 421, 70)
GUICtrlCreateLabel("(Reply-to", 15, 95)
$Input_replyto = GUICtrlCreateInput("", 85, 95, 335, 20)
GUICtrlCreateLabel(")", 421, 100)
GUICtrlCreateLabel("To", 15, 130)
$Input_to = GUICtrlCreateInput("", 85, 130, 340, 20)
GUICtrlCreateLabel("CC", 15, 155)
$Input_cc = GUICtrlCreateInput("", 85, 155, 340, 20)
GUICtrlCreateLabel("BCC", 15, 180)
$Input_bcc = GUICtrlCreateInput("", 85, 180, 340, 20)
GUICtrlCreateLabel("Subject", 15, 215)
$Input_subject = GUICtrlCreateInput("", 85, 215, 340, 20)
GUICtrlCreateLabel("Attachment", 15, 240)
$Checkbox_attachment = GUICtrlCreateCheckbox("", 85, 240, 20, 20)
$Input_attachment = GUICtrlCreateInput("", 105, 240, 275, 20)
GUICtrlSetState(-1, $GUI_DROPACCEPTED)
$Button_chooseattachmentpath = GUICtrlCreateButton("Select", 385, 240, 40, 20)
$env_Input_attachment = GUICtrlCreateInput("", -1, -1)
GUICtrlSetState(-1, $GUI_HIDE)
GUICtrlCreateLabel("Signature", 15, 265)
$Checkbox_signature = GUICtrlCreateCheckbox("", 85, 265, 20, 20)
$Input_signature = GUICtrlCreateInput("", 105, 265, 230, 20)
GUICtrlSetState(-1, $GUI_DROPACCEPTED)
$env_Input_signature = GUICtrlCreateInput("", -1, -1)
GUICtrlSetState(-1, $GUI_HIDE)
$Button_choosesignaturepath = GUICtrlCreateButton("Select", 385, 265, 40, 20)
$Button_signature = GUICtrlCreateButton("Edit", 340, 265, 40, 20)
GUICtrlCreateLabel("Body file", 15, 290)
$Checkbox_bodypath = GUICtrlCreateCheckbox("", 85, 290, 20, 20)
$Input_file = GUICtrlCreateInput("", 105, 290, 230, 20)
GUICtrlSetState(-1, $GUI_DROPACCEPTED)
$env_Input_file = GUICtrlCreateInput("", -1, -1)
GUICtrlSetState(-1, $GUI_HIDE)
$Button_editbody = GUICtrlCreateButton("Edit", 340, 290, 40, 20)
$Button_choosebodypath = GUICtrlCreateButton("Select", 385, 290, 40, 20)
GUICtrlCreateLabel("Body text", 15, 315)
$Checkbox_bodytext = GUICtrlCreateCheckbox("", 85, 315, 20, 20)
$Input_bodytext = GUICtrlCreateInput("", 105, 315, 320, 100, bitor($ES_AUTOVSCROLL, $ES_MULTILINE, $ES_WANTRETURN)) ; no default=use wrapping
GUICtrlCreateTabItem("") ;==>Mail
GUICtrlCreateTabItem("Options")
GUICtrlCreateLabel("Content type", 15, 43)
$input_content_type=GUICtrlCreateCombo("", 90, 40, 75, default, $CBS_DROPDOWNLIST)
GUICtrlSetData(-1, $content_types)
GUICtrlCreateLabel("Charset", 15, 73)
$input_charset=GUICtrlCreateCombo("", 90, 70, 100)
GUICtrlSetData(-1, $charsets)
GUICtrlCreateLabel("Auto = iso-8859-1 / UTF-7 / UTF-8", 195, 74)
GUICtrlSetTip(-1, "Based on the content and server")
GUICtrlSetFont(-1, 8.4)
GUICtrlCreateLabel("Confirmation", 15, 103)
$Checkbox_disposition = GUICtrlCreateCheckbox("Disposition notification", 90, 100, 120, 20)
$Checkbox_receipt = GUICtrlCreateCheckbox("Return receipt", 220, 100, 90, 20)
GUICtrlCreateLabel("Priority", 15, 128)
$Input_priority = GUICtrlCreateCombo("", 90, 125, 50, 20, $CBS_DROPDOWNLIST)
GUICtrlSetData(-1, "None|Low|High")
GUICtrlCreateLabel("Max. names", 15, 155)
GUICtrlSetTip(-1, "Send to groups of <x> number of recipients")
$Checkbox_maxNames = GUICtrlCreateCheckbox("", 90, 155, 20, 20)
$Input_maxNames = GUICtrlCreateInput("", 110, 155, 50, 20, $ES_NUMBER + $ES_RIGHT)
GUICtrlCreateUpdown(-1, bitor($UDS_ARROWKEYS, $UDS_NOTHOUSANDS))
GUICtrlSetLimit(-1,32767,1)
GUICtrlCreateLabel("Multipart", 15, 180)
GUICtrlSetTip(-1, "Send multipart messages, breaking attachments on <size>")
$Checkbox_multipart_yes = GUICtrlCreateCheckbox("", 90, 180, 20, 20)
$Input_multipart = GUICtrlCreateInput("", 110, 180, 55, 20, $ES_NUMBER + $ES_RIGHT)
GUICtrlCreateUpdown(-1, bitor($UDS_ARROWKEYS, $UDS_NOTHOUSANDS))
GUICtrlSetLimit(-1,32767,0)
GUICtrlCreateLabel(",000 B", 165, 185)
GUICtrlCreateLabel("(0=max)", 110, 200)
GUICtrlSetFont(-1, 8.4)
$Checkbox_multipart_no = GUICtrlCreateCheckbox("Do not allow multipart messages", 220, 180, 175, 20)
GUICtrlCreateLabel("X-mailer", 15, 220)
$Checkbox_xmailer = GUICtrlCreateCheckbox("Hide x-mailer", 90, 217, 100, 20)
$Checkbox_xmailerurl = GUICtrlCreateCheckbox("Hide blat url", 217, 217, 100, 20)
GUICtrlCreateLabel("Log", 15, 245)
$Checkbox_log = GUICtrlCreateCheckbox("", 90, 245, 20, 20)
$Input_log = GUICtrlCreateInput("", 110, 245, 225, 20)
GUICtrlSetState($Input_log, $GUI_DROPACCEPTED)
$Button_chooselogpath = GUICtrlCreateButton("Select", 385, 245, 40, 20)
$Button_log = GUICtrlCreateButton("Edit", 340, 245, 40, 20)
$Checkbox_timestamp = GUICtrlCreateCheckbox("Use timestamp", 90, 265)
GUICtrlSetTip(-1, "Add a timestamp is added to each log line")
$Checkbox_overwritelog = GUICtrlCreateCheckbox("Overwrite", 220, 265)
$input_debug=GUICtrlCreateCombo("", 305, 269, 115, default, $CBS_DROPDOWNLIST)
GUICtrlSetData(-1, $default_debug & "|Debug|Superdebug text|Superdebug|SuperDuperDebug")
GUICtrlCreateLabel("Send attempts", 15, 290)
$Input_try = GUICtrlCreateInput("", 90, 290, 55, 20)
GUICtrlCreateUpdown(-1, bitor($UDS_ARROWKEYS, $UDS_NOTHOUSANDS))
GUICtrlSetLimit(-1, 32767, 1)
GUICtrlCreateLabel("(1=infinite)", 150, 292)
GUICtrlCreateLabel("Hostname", 15, 315)
GUICtrlSetTip(-1, "Select the hostname used to send the message via SMTP")
$Button_hostinfo = GUICtrlCreateButton("Default info", 67, 315, 65, 20)
GUICtrlSetTip(-1, "Get information about the default hostname")
$Input_host = GUICtrlCreateInput("", 140, 315, 285, 20)
GUICtrlCreateLabel("Final header 1 (name: value)", 15, 340)
GUICtrlSetTip(-1, "Custom header")
$Input_finalheader1 = GUICtrlCreateInput("", 155, 340, 270, 20)
GUICtrlCreateLabel("Final header 2 (name: value)", 15, 365)
GUICtrlSetTip(-1, "Custom header")
$Input_finalheader2 = GUICtrlCreateInput("", 155, 365, 270, 20)
GUICtrlCreateLabel("Extra arguments", 15, 390)
$Input_arguments = GUICtrlCreateInput("", 96, 390, 329, 20)
GUICtrlCreateLabel("Custom registry", 15, 418)
$checkbox_registry=GUICtrlCreateCheckbox("", 90, 415, 20, 20)
GUICtrlCreateLabel("Profile", 115, 418, 35, 20)
$Input_profile = GUICtrlCreateCombo("", 150, 415, 90)
GUICtrlSetData(-1, $profiles)
GUICtrlCreateTabItem("") ;==>Options
$auth_tab = GUICtrlCreateTabItem("Authentication")
GUICtrlCreateLabel("Server", 15, 43)
$Input_server = GUICtrlCreateInput("", 85, 40, 220, 20)
$Button_serverinfo = GUICtrlCreateButton("&Info", 315, 40, 40, 20)
GUICtrlCreateLabel("Port", 360, 43)
$Input_port = GUICtrlCreateInput("", 385, 40, 40, 20, bitor($GUI_SS_DEFAULT_INPUT,$ES_NUMBER))
GUICtrlCreateLabel("AUTH user", 15, 65)
$Input_authuser = GUICtrlCreateInput("", 85, 65, 340, 20)
GUICtrlCreateLabel("AUTH pass", 15, 90)
$Input_authpass = GUICtrlCreateInput("", 85, 90, 340, 20, $ES_PASSWORD)
GUICtrlCreateLabel("POP3 user", 15, 125)
$Input_pop3user = GUICtrlCreateInput("", 85, 125, 340, 20)
GUICtrlCreateLabel("POP3 pass", 15, 150)
$Input_pop3pass = GUICtrlCreateInput("", 85, 150, 340, 20, $ES_PASSWORD)
GUICtrlCreateLabel("IMAP user", 15, 190)
$Input_imapuser = GUICtrlCreateInput("", 85, 190, 340, 20)
GUICtrlCreateLabel("IMAP pass", 15, 215)
$Input_imappass = GUICtrlCreateInput("", 85, 215, 340, 20, $ES_PASSWORD)
GUICtrlCreateTabItem("") ;==>Authentication
GUICtrlCreateTabItem("Preferences")
GUICtrlCreateLabel("Blat DLL path", 15, 40)
$Input_blatpath = GUICtrlCreateInput("", 85, 40, 295, 20)
GUICtrlSetState($Input_blatpath, $GUI_DROPACCEPTED)
$env_Input_blatpath = GUICtrlCreateInput("", -1, -1)
GUICtrlSetState(-1, $GUI_HIDE)
$Button_chooseblatpath = GUICtrlCreateButton("Select", 385, 40, 40, 20)
GUICtrlCreateLabel("Blat EXE path", 15, 65)
$Input_blatexepath = GUICtrlCreateInput("", 85, 65, 295, 20)
GUICtrlSetState($Input_blatexepath, $GUI_DROPACCEPTED)
$Button_chooseblatexepath = GUICtrlCreateButton("Select", 385, 65, 40, 20)
GUICtrlCreateLabel("Editor path", 15, 90)
$Input_editorpath = GUICtrlCreateInput("", 85, 90, 295, 20)
GUICtrlSetState($Input_editorpath, $GUI_DROPACCEPTED)
$env_editorpath = GUICtrlCreateInput("", -1, -1)
GUICtrlSetState(-1, $GUI_HIDE)
$Button_chooseeditorpath = GUICtrlCreateButton("Select", 385, 90, 40, 20)
GUICtrlCreateLabel("Help path", 15, 115)
$Input_helppath = GUICtrlCreateInput("", 85, 115, 295, 20)
GUICtrlSetState($Input_helppath, $GUI_DROPACCEPTED)
$env_Input_helppath = GUICtrlCreateInput("", -1, -1)
GUICtrlSetState(-1, $GUI_HIDE)
$Button_choosehelppath = GUICtrlCreateButton("Select", 385, 115, 40, 20)
GUICtrlCreateLabel("File names", 15, 150)
$Checkbox_absolutepaths = GUICtrlCreateCheckbox("Use absolute paths", 85, 150, 125, 20)
GUICtrlCreateLabel("Shutdown", 15, 190)
$Checkbox_shutdown = GUICtrlCreateCheckbox("Shutdown computer", 85, 190, 115, 20)
$Input_shutdown = GUICtrlCreateInput("", 205, 190, 40, 20, $ES_NUMBER + $ES_RIGHT)
GUICtrlCreateLabel("seconds after sending", 250, 190, 180)
GUICtrlCreateTabItem("") ;==>Preferences
; --- Buttons ---
$Button_create = GUICtrlCreateButton("&Create", 5, 445, 85, 25)
GUICtrlSetTip(-1, "Combine all info into a synatx that can be sent")
$Button_simulator = GUICtrlCreateButton("&Open Simulator", 120, 445, 85, 25)
GUICtrlSetTip(-1, "Simulate how the messages will appear in the inbox without actually sending them")
$Button_send = GUICtrlCreateButton("&Send", 240, 445, 85, 25)
GUICtrlCreateLabel("Status:", 330, 451)
$status = GUICtrlCreateLabel("Pending", 370, 451)
GUICtrlSetColor(-1, eval("COLOR_BLUE"))
; --- Command Line ---
$Input_commandline = GUICtrlCreateInput("", 5, 472, 430, 80, bitor($ES_AUTOVSCROLL, $ES_MULTILINE)) ; no default=use wrapping
loadconfig($configfile_default)
GUISetState()
While 1
local $msg_array = GUIGetMsg(1); Use advanced parameter to get array to support multiple menus
local $msg = $msg_array[0]
If Not IsHWnd($msg_array[1]) Then ContinueLoop; preventing subsequent lines from processing when nothing happens
global $used_simulator = IsDeclared("simulator_MainWindow") and IsHWnd($simulator_MainWindow)
Switch $msg_array[1]; check which GUI sent the message
case $MainWindow
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $fileitem_open
$new_configfile = FileOpenDialog("Open " & $programname& " Configuration File", "", _
$programname & " Configuration File (*" & $extension & ")", 3, "", $MainWindow)
If Not $new_configfile = "" Then
$configfile = $new_configfile
LoadConfig($configfile)
$StringSplitConfigFile = StringSplit($configfile, "\")
$windowtitle = $programname & " - " & $StringSplitConfigFile[$StringSplitConfigFile[0]]
WinSetTitle($MainWindow, "", $windowtitle)
EndIf
Case $msg = $fileitem_save
SaveConfig($configfile_default)
Case $msg = $fileitem_saveas
$new_configfile = FileSaveDialog("Save as", "", $programname & " Configuration File (*" & $extension & ")", 18, "")
If Not $new_configfile = "" Then
If StringRight($new_configfile, 4) = $extension Then
$configfile = $new_configfile
Else
$configfile = $new_configfile & $extension
EndIf
SaveConfig($configfile)
$StringSplitConfigFile = StringSplit($configfile, "\")
$windowtitle = $programname & " - " & $StringSplitConfigFile[$StringSplitConfigFile[0]]
WinSetTitle($MainWindow, "", $windowtitle)
EndIf
Case $msg = $fileitem_load
LoadConfig($configfile_default)
Case $msg = $fileitem_reset
filedelete($configfile_default)
LoadConfig($configfile_default)
Case $msg = $profileitem_listprofiles
Run(@ComSpec & ' /c title ' & $programname & ' && color 0A && "' & _
defaultpath(GUICtrlRead($Input_blatexepath, 1)) & '" -profile|more' & ' && pause')
Case $msg = $profileitem_saveprofile
$blat_command="-SaveSettings "
If GUICtrlRead($Input_server, 1) = "" Then
GUICtrlSetState($auth_tab, $GUI_SHOW)
GUICtrlSetState($Input_server, $GUI_FOCUS)
GUICtrlSetData($Input_server, "Please supply a server")
GUICtrlSetBkColor($Input_server, eval("COLOR_RED"))
msgbox(48, "No server supplied", "You must supply a server", default, $MainWindow)
GUICtrlSetData($Input_server, "")
GUICtrlSetBkColor($Input_server, eval("COLOR_WHITE"))
else
$blat_command &= GUICtrlRead($Input_server, 1)
$blat_command &= command_add(filtertext(GUICtrlRead($Input_from, 1)))
$blat_command &= command_add(GUICtrlRead($Input_try, 1), "numeric")
$blat_command &= command_add(GUICtrlRead($Input_port, 1))
$blat_command &= command_add(GUICtrlRead($Input_profile, 1), "default")
if GUICtrlRead($Input_authuser, 1)<>"" then
$blat_command &= " " & GUICtrlRead($Input_authuser, 1)
if GUICtrlRead($Input_authpass, 1)<>"" then
$blat_command &= " " & GUICtrlRead($Input_authpass, 1)
endif
endif
$blat_command &= " -hkcu"
$return_code = launchdll($blat_command)
if IsNumber($return_code) then
switch $return_code
case 0
$return_title="Success"
$return_msg="Successfully saved"
case Else
$return_title="Failure"
$return_msg="Failed saving"
endswitch
if GUICtrlRead($Input_profile, 1)="" then
$return_msg &= " the default profile"
else
$return_msg &= ' profile "' & GUICtrlRead($Input_profile, 1) & '"'
endif
msgbox(0, $return_title, $return_msg & " to the registry.", default, $MainWindow)
endif
endif
Case $msg = $profileitem_deleteprofile or $msg = $profileitem_deleteprofiles
$blat_command = "-profile -delete -hkcu "
if $msg = $profileitem_deleteprofiles then
$blat_command &= '"<all>"'
elseif GUICtrlRead($Input_profile, 1)="" or GUICtrlRead($Input_profile, 1)=$default_profile or _
GUICtrlRead($Input_profile, 1)="*Custom*" then
$blat_command &= '"<default>"'
else
$blat_command &= GUICtrlRead($Input_profile, 1)
endif
$return_code = launchdll($blat_command)
if IsNumber($return_code) then
switch $return_code
case 0
$return_title="Success"
$return_msg="Successfully deleted"
case Else
$return_title="Failure"
$return_msg="Failed deleting"
endswitch
if $msg = $profileitem_deleteprofiles then
$return_msg &= " all profiles "
elseif GUICtrlRead($Input_profile, 1)="" then
$return_msg &= " the default profile "
else
$return_msg &= ' the following profiles:' & @crlf & GUICtrlRead($Input_profile, 1) & @crlf
endif
msgbox(0, $return_title, $return_msg & "from the registry.", default, $MainWindow)
endif
Case $msg = $helpitem_blathomepage
ShellExecute("https://www.blat.net")
Case $msg = $helpitem_syntax OR $msg = $helpitem_searchsyntax
$helppath_temp=""
if GUICtrlRead($Input_helppath, 1)<>"" then
$helppath_temp=pathfull(defaultpath(_WinAPI_ExpandEnvironmentStrings(GUICtrlRead($Input_helppath, 1))))
endif
If $helppath_temp<>"" AND fileexists($helppath_temp) Then
ShellExecute($helppath_temp)
Else
$findsyntax_error=false
$findsyntax_title=""
$findsyntax_str=""
if $msg = $helpitem_searchsyntax Then
if $search_keyword="" Then
$search_keyword=$default_search
endif
$findsyntax_str=InputBox("Search", "Enter search word", $search_keyword)
if $findsyntax_str<>"" Then
$search_keyword=$findsyntax_str
$findsyntax_title='The word "' & $findsyntax_str & '" in the help'
$findsyntax_str='|find /i "' & $findsyntax_str & '"'
elseif @error>0 then
$findsyntax_error=true
endif
endif
if not $findsyntax_error then
Run(@ComSpec & ' /c title ' & $findsyntax_title & ' && color 0A && "' & _
defaultpath(GUICtrlRead($Input_blatexepath, 1)) & '" -h' & $findsyntax_str & '|more' & ' && pause')
endif
EndIf
Case $msg = $helpitem_about
about()
Case $msg = $Button_create Or $msg = $commanditem_create
GUICtrlSetData($env_Input_file, _WinAPI_ExpandEnvironmentStrings(GUICtrlRead($Input_file, 1)))
GUICtrlSetData($env_Input_blatpath, _WinAPI_ExpandEnvironmentStrings(GUICtrlRead($Input_blatpath, 1)))
GUICtrlSetData($env_Input_attachment, _WinAPI_ExpandEnvironmentStrings(GUICtrlRead($Input_attachment, 1)))
GUICtrlSetData($env_Input_signature, _WinAPI_ExpandEnvironmentStrings(GUICtrlRead($Input_signature, 1)))
If GUICtrlRead($Input_bodytext) = "" Or GUICtrlRead($Checkbox_bodytext, 0) = $GUI_UNCHECKED Then
$_bodytext = ''
Else
$_bodytext = '-body "' & filtertext(GUICtrlRead($Input_bodytext)) & '"'
EndIf
If GUICtrlRead($Input_file, 1) = "" Or GUICtrlRead($Checkbox_bodypath, 0) = $GUI_UNCHECKED Then
$_bodyfile = ''
Else
$_bodyfile=localize($Input_blatpath, $Input_file)
EndIf
if (GUICtrlRead($Checkbox_bodytext, 0) = $GUI_UNCHECKED and GUICtrlRead($Checkbox_bodypath, 0) = $GUI_UNCHECKED) or _
($_bodytext="" and $_bodyfile="") Then
$_bodytext='-body " "'
endif
If GUICtrlRead($Input_from, 1) = "" Then
$_f = ''
Else
$_f = ' -f "' & filtertext(GUICtrlRead($Input_from, 1)) & '"'
EndIf
If GUICtrlRead($Input_organization, 1) = "" Then
$_organization = ''
Else
$_organization = ' -organization "' & filtertext(GUICtrlRead($Input_organization, 1)) & '"'
EndIf
If GUICtrlRead($Input_replyto, 1) = "" Then
$_replyto = ''
Else
$_replyto = ' -replyto "' & filtertext(GUICtrlRead($Input_replyto, 1)) & '"'
EndIf
If GUICtrlRead($Input_to, 1) = "" Then
if GUICtrlRead($Input_from, 1) = "" and GUICtrlRead($Input_cc, 1) = "" then
$_to = ' -ur'
else
$_to = ' -to "' & filtertext(GUICtrlRead($Input_from, 1)) & '"'
endif
Else
$_to = ' -to "' & filtertext(GUICtrlRead($Input_to, 1)) & '"'
EndIf
If GUICtrlRead($Input_cc, 1) = "" Then
$_cc = ''
Else
$_cc = ' -cc "' & filtertext(GUICtrlRead($Input_cc, 1)) & '"'
EndIf
If GUICtrlRead($Input_bcc, 1) = "" Then
$_bcc = ''
Else
$_bcc = ' -bcc "' & filtertext(GUICtrlRead($Input_bcc, 1)) & '"'
EndIf
If GUICtrlRead($Input_subject, 1) = "" Then
$_subject = ' -ss'
Else
$_subject = ' -subject "' & filtertext(GUICtrlRead($Input_subject, 1)) & '"'
EndIf
If GUICtrlRead($Input_attachment, 1) = "" Or GUICtrlRead($Checkbox_attachment, 0) = $GUI_UNCHECKED Then
$_attachment = ''
Else
$_attachment = ' -attach ' & localize($Input_blatpath, $Input_attachment)
EndIf
If GUICtrlRead($Input_host, 1) = "" Then
$_hostname = ''
Else
$_hostname = ' -hostname "' & GUICtrlRead($Input_host, 1) & '"'
EndIf
if $used_simulator then
$_server = ' -server "' & GUICtrlRead($simulator_hIP, 1) & '"'
ElseIf GUICtrlRead($Input_server, 1) = "" Then
$_server = ''
Else
$_server = ' -server "' & GUICtrlRead($Input_server, 1) & '"'
EndIf
If $used_simulator or GUICtrlRead($Input_port, 1) = "" Then
$_port = ''
Else
$_port = ' -port ' & GUICtrlRead($Input_port, 1)
EndIf
$_htmlenriched = ''
Switch GUICtrlRead($Input_content_type, 1)
case $html_content_type
$_htmlenriched = ' -html'
case $enriched_content_type
$_htmlenriched = ' -enriched'
endswitch
If GUICtrlRead($Input_maxNames, 1) = "" Or GUICtrlRead($Checkbox_maxNames, 0) = $GUI_UNCHECKED Then
$_maxNames = ''
Else
$_maxNames = ' -maxNames "' & GUICtrlRead($Input_maxNames, 1) & '"'
EndIf
If GUICtrlRead($Checkbox_signature, 0) = $GUI_UNCHECKED Then
$_signature = ''
Else
$_signature = ' -sig ' & localize($Input_blatpath, $Input_signature)
EndIf
If GUICtrlRead($Checkbox_multipart_yes, 0) = $GUI_CHECKED Then
if GUICtrlRead($Input_multipart, 1)="" or GUICtrlRead($Input_multipart, 1)=0 then
$_multipart = ' -multipart'
else
$_multipart = ' -multipart "' & GUICtrlRead($Input_multipart, 1) & '"'
endif
ElseIf GUICtrlRead($Checkbox_multipart_no, 0) = $GUI_CHECKED Then
$_multipart = ' -nomps'
Else
$_multipart = ''
EndIf
If GUICtrlRead($Checkbox_log, 0) = $GUI_UNCHECKED Then
$_log = ''
elseif GUICtrlRead($Input_log, 1)="" then
$_log = '' ; Always on anyway in DLL mode
Else
$_log = ' -log ' & localize($Input_blatpath, $Input_log)
If GUICtrlRead($Checkbox_timestamp, 0) = $GUI_CHECKED Then
$_log &= ' -timestamp'
EndIf
If GUICtrlRead($Checkbox_overwritelog, 0) = $GUI_CHECKED Then
$_log &= ' -overwritelog'
EndIf
If GUICtrlRead($input_debug) = "Debug" Then
$_log &= ' -debug'
elseif GUICtrlRead($input_debug) = "Superdebug Text" Then
$_log &= ' -superdebugT'
elseif GUICtrlRead($input_debug) = "Superdebug" Then
$_log &= ' -superdebug'
elseif GUICtrlRead($input_debug) = "superDuperDebug" Then
$_log &= ' -superDuperDebug'
EndIf
EndIf
If GUICtrlRead($Checkbox_xmailer, 0) = $GUI_CHECKED Then
$_xmailer = ' -noh2'
Else
If GUICtrlRead($Checkbox_xmailerurl, 0) = $GUI_CHECKED Then
$_xmailer = ' -noh'
Else
$_xmailer = ''
EndIf
EndIf
If GUICtrlRead($input_charset, 1) = "" OR GUICtrlRead($input_charset, 1) = $default_charset _
OR GUICtrlRead($input_charset, 1) = "*custom*" Then
$_charset = ''
ElseIf GUICtrlRead($input_charset, 1)="Unicode" then
$_charset = ' -unicode'
else
$_charset = ' -charset "' & GUICtrlRead($Input_charset, 1) & '"'
EndIf
If GUICtrlRead($Input_priority, 1)<>"low" AND GUICtrlRead($Input_priority, 1)<>"high" then
$_priority = ''
Else
$_priority = ' -priority ' & filterpriority(GUICtrlRead($Input_priority, 1))
EndIf
If GUICtrlRead($Checkbox_disposition, 0) = $GUI_UNCHECKED Then
$_disposition = ''
Else
$_disposition = ' -d'
Endif
If GUICtrlRead($Checkbox_receipt, 0) = $GUI_UNCHECKED Then
$_receipt = ''
Else
$_receipt = ' -r'
Endif
If GUICtrlRead($Input_try, 1) < 2 Then
$_retry = ''
Else
$_retry = ' -try ' & GUICtrlRead($Input_try, 1)
EndIf
If GUICtrlRead($Input_finalheader1, 1) = "" Then
$_finalheader1 = ''
Else
$_finalheader1 = ' -a1 "' & GUICtrlRead($Input_finalheader1, 1) & '"'
EndIf
If GUICtrlRead($Input_finalheader2, 1) = "" Then
$_finalheader2 = ''
Else
$_finalheader2 = ' -a2 "' & GUICtrlRead($Input_finalheader2, 1) & '"'
EndIf
If GUICtrlRead($Input_arguments, 1) = "" Then
$_arguments = ''
Else
$_arguments = ' ' & GUICtrlRead($Input_arguments, 1)
EndIf
$_profile = ''
If GUICtrlRead($Checkbox_registry, 0)=$GUI_CHECKED and GUICtrlRead($Input_profile, 1)<>"" _
and GUICtrlRead($Input_profile, 1)<>$default_profile and GUICtrlRead($Input_profile, 1)<>"*Custom*" Then
$_profile &= ' -p "' & GUICtrlRead($Input_profile, 1) & '"'
EndIf
If GUICtrlRead($Input_authuser, 1) = "" Then
$_u = ''
Else
$_u = ' -u "' & GUICtrlRead($Input_authuser, 1) & '"'
EndIf
If GUICtrlRead($Input_authpass, 1) = "" Then
$_pw = ''
Else
$_pw = ' -pw "<auth_password>"'
$_HiddenAUTHPassword = GUICtrlRead($Input_authpass, 1)
EndIf
If GUICtrlRead($Input_pop3user, 1) = "" Then
$_pu = ''
Else
$_pu = ' -pu "' & GUICtrlRead($Input_pop3user, 1) & '"'
EndIf
If GUICtrlRead($Input_pop3pass, 1) = "" Then
$_ppw = ''
Else
$_ppw = ' -ppw "<pop3_password>"'
$_HiddenPOP3Password = GUICtrlRead($Input_pop3pass, 1)
EndIf
If GUICtrlRead($Input_imapuser, 1) = "" Then
$_iu = ''
Else
$_iu = ' -iu "' & GUICtrlRead($Input_imapuser, 1) & '"'
EndIf
If GUICtrlRead($Input_imappass, 1) = "" Then
$_ipw = ''
Else
$_ipw = ' -ipw "<imap_password>"'
$_HiddenIMAPPassword = GUICtrlRead($Input_imappass, 1)
EndIf
$CreateCommand = $_bodytext & $_bodyfile & $_f & $_organization & $_replyto & $_to & $_cc & $_bcc & $_subject & _
$_attachment & $_hostname & $_server & $_port & $_retry & $_htmlenriched & $_maxNames & $_signature & $_xmailer & $_multipart & $_log _
& $_u & $_pw & $_pu & $_ppw & $_iu & $_ipw & $_priority & $_charset & $_disposition & $_receipt & $_finalheader1 & _
$_finalheader2 & $_arguments & $_profile
GUICtrlSetData($Input_commandline, $CreateCommand)
; --- Validate arguments ---
$val_body = 0
$val_recipient = 0
$val_sender = 0
$val_server = 0
$val_sendmail = 0
$val_installation = 0
$val_listprofiles = 0
$val_help = 0
$val_optionfile = 0
$StSpCom = StringSplit($CreateCommand, " ")
For $CommandE = 1 To $StSpCom[0]
If $StSpCom[$CommandE] = "-body" Or GUICtrlRead($Checkbox_bodypath, 0) = $GUI_CHECKED Then
$val_body = 1
EndIf
If $StSpCom[$CommandE] = "-t" Or $StSpCom[$CommandE] = "-to" Or $StSpCom[$CommandE] = "-tf" Or $StSpCom[$CommandE] = "-c" Or $StSpCom[$CommandE] = "-cc" Or $StSpCom[$CommandE] = "-cf" Or $StSpCom[$CommandE] = "-b" Or $StSpCom[$CommandE] = "-bcc" Or $StSpCom[$CommandE] = "-bf" Then
$val_recipient = 1
EndIf
If $StSpCom[$CommandE] = "-f" Or $StSpCom[$CommandE] = "-p" Then
$val_sender = 1
EndIf
If $StSpCom[$CommandE] = "-server" Or $StSpCom[$CommandE] = "-p" Then
$val_server = 1
EndIf
If $val_body = 1 And $val_recipient = 1 And $val_sender = 1 And $val_server = 1 Then
$val_sendmail = 1
Else
$val_sendmail = 0
EndIf
If $StSpCom[$CommandE] = "-SaveSettings" Or $StSpCom[$CommandE] = "-install" Or $StSpCom[$CommandE] = "-installSMTP" Or $StSpCom[$CommandE] = "-installNNTP" Or $StSpCom[$CommandE] = "-installPOP3" Or $StSpCom[$CommandE] = "-installIMAP" Then
$val_installation = 1
EndIf
If $StSpCom[$CommandE] = "-profile" Then
$val_listprofiles = 1
EndIf
If $StSpCom[$CommandE] = "-h" Or $StSpCom[$CommandE] = "-help" Or $StSpCom[$CommandE] = "/help" Or $StSpCom[$CommandE] = "-?" Or $StSpCom[$CommandE] = "/?" Then
$val_help = 1
EndIf
If $StSpCom[$CommandE] = "-of" Then
$val_optionfile = 1
EndIf
Next
$val_msg = ""
if $_to="" then $val_msg &= "Empty To" & @CRLF
If GUICtrlRead($Input_from, 1) = "" Then
if GUICtrlRead($Checkbox_registry, 0) = $GUI_UNCHECKED then
$val_msg &= "Empty From" & @CRLF
endif
ElseIf ValidateEMailInput($Input_from) = 2 Then
$val_msg &= "Input 'from' contains an invalid e-mail address." & @CRLF
EndIf
If ValidateEMailInput($Input_to) = 2 Then
$val_msg &= "Input 'to' contains an invalid e-mail address." & @CRLF
EndIf
If ValidateEMailInput($Input_cc) = 2 Then
$val_msg &= "Input 'cc' contains an invalid e-mail address." & @CRLF
EndIf
If ValidateEMailInput($Input_bcc) = 2 Then
$val_msg &= "Input 'bcc' contains an invalid e-mail address." & @CRLF
EndIf
If GUICtrlRead($Checkbox_attachment, 0) = $GUI_CHECKED And _
Not FileExistsRelative(GUICtrlRead($env_Input_attachment, 1), $Input_blatpath) Then
$val_msg &= "File 'attachment' does not exist." & @CRLF
EndIf
If GUICtrlRead($Checkbox_signature, 0) = $GUI_CHECKED And _
Not FileExistsRelative(GUICtrlRead($env_Input_signature, 1), $Input_blatpath) Then
$val_msg &= "File 'signature' does not exist." & @CRLF
EndIf
If GUICtrlRead($Checkbox_bodypath, 0) = $GUI_CHECKED And _
Not FileExistsRelative(GUICtrlRead($env_Input_file, 1), $Input_blatpath) Then
$val_msg &= "File 'body file' does not exist." & @CRLF
EndIf
If Not GUICtrlRead($Input_server, 1) = "" And StringInStr(GUICtrlRead($Input_server), ".") = 0 Then
$val_msg &= "Input 'server' is not a valid server address." & @CRLF
EndIf
If GUICtrlRead($Checkbox_maxNames, 0) = $GUI_CHECKED And GUICtrlRead($Input_maxNames, 1) = "0" Then
$val_msg &= "Input 'max. names' is '0'." & @CRLF
EndIf
If GUICtrlRead($Checkbox_maxNames, 0) = $GUI_CHECKED And GUICtrlRead($Input_maxNames, 1) = "" Then
$val_msg &= "Input 'max. names' is blank." & @CRLF
EndIf
If Not $val_msg = "" Then
MsgBox(262144, "Warning", $val_msg, default, $MainWindow)
EndIf
Case $msg = $Button_simulator Or $msg = $commanditem_simulator
if $used_simulator then
GUIDelete($simulator_MainWindow)
_simulator_OnExit()
else
simulator($MainWindow, -WinGetPos($MainWindow)[2]+44, WinGetPos($MainWindow)[1]-113, "SMTP")
EndIf
_GUICtrlButton_Click($Button_create)
Case $msg = $Button_send Or $msg = $commanditem_send
If GUICtrlRead($Input_commandline) = "" Then
MsgBox(262144, "No command created", "Create a command first.", default, $MainWindow)
Else
$blat_command_1 = StringReplace(GUICtrlRead($Input_commandline), "<auth_password>", $_HiddenAUTHPassword)
$blat_command_2 = StringReplace($blat_command_1, "<pop3_password>", $_HiddenPOP3Password)
$blat_command = StringReplace($blat_command_2, "<imap_password>", $_HiddenIMAPPassword)
$return_code = launchdll($blat_command, true)
if IsNumber($return_code) then
switch $return_code
case 0
$return_title="Sent"
case Else
$return_title="Failed"
endswitch
switch $return_code
Case 2
$return_msg="Failure due to either:" & @crlf & _
"* The server actively denied our connection." & @crlf & _
"* The mail server doesn't like the sender name."
Case 1
$return_msg="Failure due to either:" & @crlf & _
"* Unable to open SMTP socket" & @crlf & _
"* SMTP get line did not return 220" & @crlf & _
"* command unable to write to socket" & @crlf & _
"* Server does not like To: address" & @crlf & _
"* Mail server error accepting message data"
Case 0
$return_msg="The message was sent."
Case 12
$return_msg="-server or -f options not specified and not found in registry"
Case 14 ; documented in ChangeLog.txt
$return_msg="Unicode is not supported with Windows earlier than Windows 2000"
case Else
$return_msg=""
endswitch
if $return_msg<>"" then $return_msg&=@crlf & @crlf
$return_msg &= "(Code " & $return_code & ")" & _
@crlf & @crlf & _
"- From https://www.blat.net/examples/blat_return_codes.htm"
GUICtrlSetData($status, $return_title)
Msgbox(($return_code == 0) ? $MB_ICONINFORMATION : $MB_ICONERROR, $return_title, $return_msg, 10, $MainWindow)
If $return_code == 0 And GUICtrlRead($Checkbox_shutdown, 0) = $GUI_CHECKED Then
AdlibRegister("PerformShutdown", GUICtrlRead($Input_shutdown) * 1000)
EndIf
EndIf
EndIf
Case $msg = $Checkbox_bodytext
If GUICtrlRead($Checkbox_bodytext) = $GUI_CHECKED Then
GUICtrlSetState($Checkbox_bodypath, $GUI_UNCHECKED)
GUICtrlSetState($Input_bodytext, $GUI_ENABLE)
GUICtrlSetState($Input_file, $GUI_DISABLE)
Else
GUICtrlSetState($Input_bodytext, $GUI_DISABLE)
EndIf
Case $msg = $Checkbox_bodypath
If GUICtrlRead($Checkbox_bodypath) = $GUI_CHECKED Then
GUICtrlSetState($Checkbox_bodytext, $GUI_UNCHECKED)
GUICtrlSetState($Input_file, $GUI_ENABLE)
GUICtrlSetState($Input_bodytext, $GUI_DISABLE)
Else
GUICtrlSetState($Input_file, $GUI_DISABLE)
EndIf
Case $msg = $Button_editbody
editor(GUICtrlRead($Input_file, 1), GUICtrlRead($Input_editorpath, 1), "body")
Case $msg = $Button_choosebodypath
$new_bodypath = FileOpenDialog("Select File", "", "All (*.*)", 0, "", $MainWindow)
If Not $new_bodypath = "" Then
$bodypath = $new_bodypath
GUICtrlSetData($Input_file, localize($Input_blatpath, $bodypath, false))
GUICtrlSetState($Checkbox_bodytext, $GUI_UNCHECKED)
GUICtrlSetState($Input_file, $GUI_ENABLE)
GUICtrlSetState($Checkbox_bodypath, $GUI_CHECKED)
GUICtrlSetState($Input_bodytext, $GUI_DISABLE)
EndIf
Case $msg = $Checkbox_attachment
If GUICtrlRead($Checkbox_attachment) = $GUI_CHECKED Then
GUICtrlSetState($Input_attachment, $GUI_ENABLE)
Else
GUICtrlSetState($Input_attachment, $GUI_DISABLE)
EndIf
Case $msg = $Button_serverinfo
If StringInStr(GUICtrlRead($Input_server), ".") = 0 Then
MsgBox(262144, "Error", "Enter a valid server name first.", default, $MainWindow)
Else
GUICtrlSetState($Button_serverinfo, $GUI_DISABLE)
$serverclean = StringSplit(GUICtrlRead($Input_server), ":")
$getping = Ping($serverclean[1])
If $getping = 0 And @error = 1 Then
$ping = "ERROR - Host is offline"
ElseIf $getping = 0 And @error = 2 Then