/
RXAUTOUT.VRX
1593 lines (1515 loc) · 47.3 KB
/
RXAUTOUT.VRX
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
/*:VRX Main
*/
/* Main
*/
Main:
/* Process the arguments.
Get the parent window.
*/
Parse Source . calledas .
parent = ""
argcount = Arg()
argoff = 0
If( calledas \= "COMMAND" )Then
Do
If argcount >= 1 Then
Do
parent = Arg(1)
argcount = argcount - 1
argoff = 1
End
End; Else
Do
Call VROptions 'ImplicitNames'
Call VROptions 'NoEchoQuit'
End
initargs.0 = argcount
If( argcount > 0 )Then
Do i = 1 To argcount
initargs.i = Arg( i + argoff )
End
Drop calledas argcount argoff
/* Load the windows
*/
Call VRInit
Parse Source . . spec
_vreprimarywindowpath = ,
VRParseFileName( spec, "dpn" ) || ".VRW"
_vreprimarywindow = ,
VRLoad( parent, _vreprimarywindowpath )
Drop parent spec
If( _vreprimarywindow == "" )Then
Do
Call VRMessage "", "Cannot load window:" VRError(), ,
"Error!"
_vrereturnvalue = 32000
Signal _vreleavemain
End
/* Process events
*/
Call Init
Signal On Halt
Do While( \ VRGet( _vreprimarywindow, "Shutdown" ) )
_vreevent = VREvent()
Interpret _vreevent
End
_vrehalt:
_vrereturnvalue = Fini()
Call VRDestroy _vreprimarywindow
_vreleavemain:
Call VRFini
Exit _vrereturnvalue
Vrloadsecondary:
__vrlswait = Abbrev( 'WAIT', Translate(Arg(2)), 1 )
If __vrlswait Then
Do
Call VRFlush
End
__vrlshwnd = VRLoad( VRWindow(), VRWindowPath(), Arg(1) )
If __vrlshwnd = '' Then
Signal __vrlsdone
If __vrlswait \= 1 Then
Signal __vrlsdone
Call VRSet __vrlshwnd, 'WindowMode', 'Modal'
__vrlstmp = __vrlswindows.0
If( Datatype(__vrlstmp) \= 'NUM' ) Then
Do
__vrlstmp = 1
End
Else
Do
__vrlstmp = __vrlstmp + 1
End
__vrlswindows.__vrlstmp = VRWindow( __vrlshwnd )
__vrlswindows.0 = __vrlstmp
Do While( VRIsValidObject( VRWindow() ) = 1 )
__vrlsevent = VREvent()
Interpret __vrlsevent
End
__vrlstmp = __vrlswindows.0
__vrlswindows.0 = __vrlstmp - 1
Call VRWindow __vrlswindows.__vrlstmp
__vrlshwnd = ''
__vrlsdone:
Return __vrlshwnd
/*:VRX _INIWrite
*/
_iniwrite:
ok = VRSetIni( "workplace_shell", "wps_wait", wps_wait, our_ini, "Noclose" )
ok = VRSetIni( "workplace_shell", "sc_wait", sc_wait, our_ini, "Noclose" )
ok = VRSetIni( "workplace_shell", "sc_open", sc_open, our_ini, "Noclose" )
Call Update_autostart 'warpcenter', sc_wait, sc_open
ok = VRSetIni( "workplace_shell", "tb_wait", tb_wait, our_ini, "Noclose" )
ok = VRSetIni( "workplace_shell", "tb_open", tb_open, our_ini, "Noclose" )
Call Update_autostart 'toolbar', tb_wait, tb_open
ok = VRSetIni( "workplace_shell", "xc_wait", xc_wait, our_ini, "Noclose" )
ok = VRSetIni( "workplace_shell", "xc_open", xc_open, our_ini, "Noclose" )
ok = VRSetIni( "workplace_shell", "startup_wait", wps_wait, our_ini, "Noclose" )
ok = VRSetIni( "workplace_shell", "delay_wait", delay_wait, our_ini, "Noclose" )
ok = VRSetIni( "object_desktop", "od_wait", od_cc | od_tlp, our_ini, "Noclose" )
ok = VRSetIni( "object_desktop", "od_cc", od_cc, our_ini, "Noclose" )
ok = VRSetIni( "object_desktop", "od_tlp", od_tlp, our_ini, "NoClose" )
ok = VRSetIni( "object_desktop", "od_tries", od_tries, our_ini, "Noclose" )
ok = VRSetIni( "folders", "startupfolder", startupfolder, our_ini )
If enablexstart Then
Do
folder_id = VRGetIni('XWorkplace', 'XStartupFolders', 'User')
If folder_id <> '' Then
Do
If VRSetIni( "folders", "XStartupFolders", folder_id, our_ini ) Then
ok = VRDelIni('XWorkplace', 'XStartupFolders', 'User')
End
folder_id = VRGetIni('XWorkplace', 'XSavedStartupFolders', 'User')
If folder_id <> '' Then
Do
If VRSetIni( "folders", "XSavedStartupFolders", folder_id, our_ini ) Then
ok = VRDelIni('XWorkplace', 'XSavedStartupFolders', 'User')
End
End
Else
Do
folder_id = VRGetIni('folders', 'XStartupFolders', our_ini)
If folder_id <> '' Then
Do
If VRSetIni( "XWorkplace", "XStartupFolders", folder_id, "User" ) Then
ok = VRDelIni('folders', 'XStartupFolders', our_ini)
End
folder_id = VRGetIni('folders', 'XSavedStartupFolders', our_ini)
If folder_id <> '' Then
Do
If VRSetIni( "XWorkplace", "XSavedStartupFolders", folder_id, "User" ) Then
ok = VRDelIni('folders', 'XSavedStartupFolders', our_ini)
End
End
ok = VRSetIni( "folders", "enablexstart", enablexstart, our_ini, "Noclose" )
ok = VRSetIni( "objects", "sleepsec", sleepsec, our_ini, "Noclose" )
ok = VRSetIni( "objects", "retries", retries, our_ini, "Noclose" )
ok = VRSetIni( "folders", "enablelanstart", enablelanstart, our_ini, "Noclose" )
ok = VRSetIni( "folders", "simplelogononly", simplelogononly, our_ini, "Noclose" )
ok = VRSetIni( "folders", "lanstartupfolder", lanstartupfolder, our_ini, "Noclose" )
ok = VRSetIni( "objects", "ls_sleepsec", ls_sleepsec, our_ini, "Noclose" )
ok = VRSetIni( "objects", "ls_retries", ls_retries, our_ini, "Noclose" )
ok = VRSetIni( "debug", "log_out", log_out, our_ini, "Noclose" )
ok = VRSetIni( "debug", "verbose", verbose, our_ini, "Noclose" )
ok = VRSetIni( "RexxAutoStart", "Sound", sound, our_ini, "Noclose" )
ok = VRSetIni( "sound", "sound_open", sound_open, our_ini, "Noclose" )
ok = VRSetIni( "sound", "sound_done", sound_done, our_ini, "Noclose" )
ok = VRSetIni( "sound", "sound_abort", sound_abort, our_ini, "Noclose" )
ok = VRSetIni( "sound", "sound_start", sound_start, our_ini )
ini_changes = 0
If new_autostart <> old_autostart Then
Do
/* update CONFIG.SYS */
Parse Value(_rxfindlines(old_autostart, config_sys)) ,
With autostart_line_no autostart_line '|' autostart_line_rem
If autostart_line_no <> 0 Then
Do
file_lines. = ''
file_lines.0 = 0
/* REM out the current SET AUTOSTART= line */
autostart_line = 'REM' autostart_line
xrc = _rxupdline(autostart_line_no, autostart_line, config_sys)
/* add updated SET AUTOSTART= */
new_autostart = 'SET AUTOSTART='||new_autostart
xrc = _rxupdline(autostart_line_no, new_autostart, config_sys, 'insert', 'close')
End
End
Return
/*:VRX _RxFindLines
*/
_rxfindlines: Procedure
/* find a phrase in a file and return the line number,
line, and all remmed out lines containing the phrase */
Parse Arg phrase, file
found_line_no = 0
found_line = ''
line_rem_no = ''
If phrase <> '' & Stream(file, 'c', 'query exists') <> '' Then
Do
Call Stream file, 'c', 'close'
xrc = SysFileSearch(phrase, file, 'lines.', 'N')
If xrc = 0 & lines.0 <> 0 Then
Do i = 1 To lines.0
Parse Var lines.i line_no line
line_test = Strip(Strip(Translate(line), , "'"), , '"')
If Abbrev(line_test, 'REM') ,
| Abbrev(line_test, '/*') ,
| Abbrev(line_test, ';') Then
Do
line_rem_no = line_rem_no line_no
Iterate i
End
Else
Do
found_line_no = line_no
found_line = line
End
End
End
Return found_line_no found_line '|' Strip(line_rem_no)
/*:VRX _RxReadLines
*/
_rxreadlines: Procedure Expose file_lines.
Parse Arg file
Call Stream file, 'c', 'open read'
file_lines. = ''
file_lines.0 = 0
Do i = 1 While Lines(file) > 0
file_lines.i = Linein(file)
End
file_lines.0 = i
Call Stream file, 'c', 'close'
Return
/*:VRX _RxUpdLine
*/
_rxupdline: Procedure Expose file_lines.
Parse Arg line_no, line, file, action, close
xrc = 1
replace = 0
insert = Abbrev(Translate(action), 'I')
If \insert Then
replace = 1
close = Abbrev(Translate(close), 'C')
If file_lines.0 = 0 Then
Call _rxreadlines file
If replace Then
file_lines.line_no = line
Else /* insert a new line */
Do
Do i = file_lines.0 To (line_no + 1) By -1
j = i + 1
file_lines.j = file_lines.i
End
j = line_no + 1
file_lines.j = line
file_lines.0 = file_lines.0 + 1
End
If close Then
Do
xrc = 0
save_file = SysTempFileName(VRParseFileName( file, "DPN" ) || '.???')
buttons.1 = "OK"
buttons.2 = "Cancel"
buttons.0 = 2
id = VRMessage( VRWindow(), "Ready to rewrite" file, "", "Query", "Buttons.", , )
If id = 1 Then
Do
ok = VRCopyFile( file, save_file )
If ok Then
Do
ok = VRDeleteFile( file )
If ok Then
Do
Call _rxwritelines file
xrc = 1
lines.1 = "Updated" file
lines.2 = file "was saved as" save_file
lines.0 = 2
id = VRMessageStem( VRWindow(), "Lines.", "", "Information", , , )
End
Else
Do
error = VRError()
id = VRMessage( VRWindow(), error, "", "Information", , , )
xrc = 0
lines.1 = "Deletion of" file "failed"
lines.2 = file "was saved as" save_file
lines.0 = 2
id = VRMessageStem( VRWindow(), "Lines.", "", "Information", , , )
End
End
Else
Do
error = VRError()
id = VRMessage( VRWindow(), error, "", "Information", , , )
xrc = 0
lines.1 = "Unable to copy" file
lines.2 = file "should be intact"
lines.0 = 2
id = VRMessageStem( VRWindow(), "Lines.", "", "Information", , , )
End
End
Else
Do
xrc = 0
id = VRMessage( VRWindow(), "Update of" file "aborted", "", "Information", , , )
End
file_lines. = ''
file_lines.0 = 0
End
Return xrc
/*:VRX _RxWriteLines
*/
_rxwritelines: Procedure Expose file_lines.
Parse Arg file
Call Stream file, 'c', 'open write'
Do i = 1 To file_lines.0
Call Lineout file, file_lines.i
End
Call Stream file, 'c', 'close'
Return
/*:VRX AboutBox_Close
*/
Aboutbox_close:
Call Aboutbox_fini
Return
/*:VRX AboutBox_Create
*/
Aboutbox_create:
Call Aboutbox_init
Return
/*:VRX AboutBox_Fini
*/
Aboutbox_fini:
window = VRInfo( "Window" )
Call VRDestroy window
Drop window
Return
/*:VRX AboutBox_Init
*/
Aboutbox_init:
window = VRInfo( "Object" )
If( \VRIsChildOf( window, "Notebook" ) ) Then
Do
Call VRMethod window, "CenterWindow"
Call VRSet window, "Visible", 1
Call VRMethod window, "Activate"
End
Drop window
Return
/*:VRX CB_DELAY_Click
*/
Cb_delay_click:
If VRGet("CB_DELAY","set") Then
Do
ok = VRSet("SPIN_delay_wait","Enabled", 1)
delay_wait = VRGet("SPIN_delay_wait","Value")
End
Else
Do
ok = VRSet("SPIN_delay_wait","Value", 0)
ok = VRSet("SPIN_delay_wait","Enabled", 0)
End
ini_changes = 1
Return
/*:VRX CB_EnableLanStartUpFolder_Click
*/
Cb_enablelanstartupfolder_click:
enablelanstart = VRGet("CB_EnableLanStartUpFolder","set")
If \enablelanstart Then
simplelogononly = 0
ok = VRSet("CB_SimpleLogonOnly","Set", simplelogononly)
ok = VRSet( "CB_SimpleLogonOnly", "Enabled", enablelanstart )
ok = VRSet("EF_LANStartupfolder","Enabled", enablelanstart )
ok = VRSet("SPIN_ls_sleepsec","Enabled", enablelanstart )
ok = VRSet("SPIN_ls_retries","Enabled", enablelanstart )
ini_changes = 1
Return
/*:VRX CB_EnableXStartUpFolder_Click
*/
Cb_enablexstartupfolder_click:
enablexstart = VRGet("CB_EnableXStartUpFolder","Set")
xwpstartup = (VRGetIni('XWorkplace', 'XStartupFolders', 'User') <> '')
xstartup = (VRGetIni( "folders", "xstartupfolder", our_ini ) <> '')
ok = VRSet("CB_EnableXStartupfolder","Enabled", xwpstartup | xstartup )
ini_changes = 1
Return
/*:VRX CB_log_out_Click
*/
Cb_log_out_click:
log_out = VRGet("CB_log_out","set")
ini_changes = 1
Return
/*:VRX CB_od_cc_Click
*/
Cb_od_cc_click:
od_cc = VRGet("CB_od_cc","set")
If (od_cc | od_tlp) & objdesk Then
od_wait = 1
Else
od_wait = 0
ini_changes = 1
Return
/*:VRX CB_od_tlp_Click
*/
Cb_od_tlp_click:
od_tlp = VRGet("CB_od_tlp","set")
If (od_cc | od_tlp) & objdesk Then
od_wait = 1
Else
od_wait = 0
ini_changes = 1
Return
/*:VRX CB_ODInstalled_Click
*/
Cb_odinstalled_click:
ok = SysIni('USER', 'WPTS','ALL:',appstem.)
objdesk = (appstem.0 > 0)
ok = VRSet("CB_ODInstalled","set",objdesk)
If objdesk Then
ok = VRSet("CB_ODInstalled", "caption", "Object Desktop is installed")
Else
ok = VRSet("CB_ODInstalled", "caption", "Object Desktop is not installed")
If (od_cc | od_tlp) & objdesk Then
od_wait = 1
Else
od_wait = 0
Return
/*:VRX CB_SimpleLogonOnly_Click
*/
Cb_simplelogononly_click:
simplelogononly = VRGet("CB_SimpleLogonOnly","set")
ini_changes = 1
Return
/*:VRX CB_Sound_Click
*/
Cb_sound_click:
sound = VRGet("CB_Sound","set")
ini_changes = 1
Return
/*:VRX CB_startup_wait_Click
*/
Cb_startup_wait_click:
startup_wait = VRGet( "CB_startup_wait", "Set" )
ini_changes = 1
Return
/*:VRX CB_verbose_Click
*/
Cb_verbose_click:
verbose = VRGet("CB_verbose","set")
ini_changes = 1
Return
/*:VRX CB_wps_wait_Click
*/
Cb_wps_wait_click:
wps_wait = VRGet( "CB_wps_wait", "Set" )
ini_changes = 1
Return
/*:VRX Check_startup
*/
Check_startup:
Procedure Expose old_autostart
Parse Arg auto, obj, class, startup, .
If auto <> '' Then
test_auto = (Pos(Translate(auto), Translate(old_autostart)) <> 0)
Else
test_auto = 1
test_obj = WPToolsQueryObject(obj)
test_class = 0
test_startup = 0
If test_auto & test_obj Then
Do
Call SysQueryClassList 'classes.'
Do x = 1 To classes.0
If Abbrev(Translate(classes.x), Translate(class)),
| class = '' Then
Do
test_class = 1
If WPToolsFolderContent(startup, 'objects.') Then
Do y = 1 To objects.0
If Abbrev(Translate(objects.y), Translate(obj)) Then
Do
test_startup = 1
Leave y
End
If WPToolsQueryObject(objects.y, , , 'szSetup') Then
Do
Parse Value('.' szSetup) With . 'SHADOWID=' shadow ';'
If Abbrev(Translate(Strip(shadow)), Translate(obj)) Then
Do
test_startup = 1
Leave y
End
End
End
Drop objects.
Leave x
End
End
Drop classes.
End
Return (test_auto & test_obj & test_class & \test_startup)
/*:VRX EF_LANStartUpFolder_Change
*/
Ef_lanstartupfolder_change:
ini_changes = (lanstartupfolder <> VRGet("EF_LANstartUpFolder","Value"))
lanstartupfolder = VRGet("EF_LANstartUpFolder","Value")
If Left(lanstartupfolder,1) \= '<' | Right(lanstartupfolder,1) \= '>' Then
Do
ok = VRSet("EF_LANstartUpFolder","BackColor","Red")
End
Else
ok = VRSet("EF_LANstartUpFolder","BackColor","<default>")
Return
/*:VRX EF_StartUpFolder_Change
*/
Ef_startupfolder_change:
ini_changes = (startupfolder <> VRGet("EF_StartUpFolder","Value"))
startupfolder = VRGet("EF_StartUpFolder","Value")
If Left(startupfolder,1) \= '<' | Right(startupfolder,1) \= '>' Then
Do
ok = VRSet("EF_StartUpFolder","BackColor","Red")
End
Else
ok = VRSet("EF_StartUpFolder","BackColor","<default>")
Return
/*:VRX Fini
*/
Fini:
window = VRWindow()
Call VRSet window, "Visible", 0
Drop window
Return 0
/*:VRX GetBootDrive
*/
Getbootdrive:
/* Use SysBootDrive if possible */
If Rxfuncadd('SysBootDrive', 'RexxUtil', 'SysBootDrive') Then
Return Left(Value('RUNWORKPLACE',,'OS2ENVIRONMENT'),2)
Else
Return SysBootDrive()
/*:VRX Halt
*/
Halt:
Signal _vrehalt
Return
/*:VRX Init
*/
Init:
Call Rxfuncadd 'SysLoadFuncs','Rexxutil','SysLoadFuncs'
Call SysLoadFuncs
Call Rxfuncadd 'WPToolsLoadFuncs', 'WPTOOLS', 'WPToolsLoadFuncs'
Call WPToolsLoadFuncs
ok = VRRedirectStdIO('OFF')
bootdrive = Getbootdrive()
config_sys = bootdrive||'\config.sys'
startup_cmd = bootdrive||'\startup.cmd'
our_drive = VRCurrDrive()
our_dir = our_drive || VRCurrDir( our_drive )
our_ini = our_dir || '\RXAUTOST.INI'
our_log = our_dir || '\RXAUTOST.LOG'
startup_line = Translate('@START /MIN' our_dir||'\RXAUTOST.EXE' our_dir||'\RXAUTOST.EXE')
If VRFileExists( our_dir || '\rxautost.lvl' ) Then
Do
level = Strip(Linein(our_dir || '\rxautost.lvl'))
Call Stream our_dir || '\rxautost.lvl', 'c', 'close'
level = level Stream(our_dir || '\rxautout.exe', 'c', 'query timestamp')
End
Else
level = ''
caption = VRGet( "RxAutoUtMain", "Caption" )
ok = VRSet( "RxAutoUtMain", "Caption", caption level )
window = VRWindow()
Call VRMethod window, "CenterWindow"
Call VRSet window, "Visible", 1
Call VRMethod window, "Activate"
Drop window
ini_changes = Migrate_rexxautostart(our_ini, bootdrive)
Parse Value(_rxfindlines('autostart=', config_sys)) ,
With line_no . '=' old_autostart '|' .
old_autostart = Strip(old_autostart)
new_autostart = old_autostart
Return
/*:VRX MenuFileExit_Click
*/
Menufileexit_click:
Call Quit
Return
/*:VRX MenuHelp_Click
*/
Menuhelp_click:
Return
/*:VRX MenuHelpAbout_Click
*/
Menuhelpabout_click:
window = Vrloadsecondary( "AboutBox", "W" )
Return
/*:VRX MenuHelpViewManual_Click
*/
Menuhelpviewmanual_click:
'view rxautost.inf'
Return
/*:VRX MenuRexxAutostartActivate_Click
*/
Menurexxautostartactivate_click: Procedure Expose bootdrive file_lines. isrexx ini_changes startup_line
config_sys = bootdrive || '\config.sys'
startup_cmd = bootdrive || '\startup.cmd'
/* update CONFIG.SYS */
Parse Value(_rxfindlines('restartobjects=no', config_sys)) ,
With restart_line_no restart_line '|' restart_line_rem
If restart_line_no = 0 Then
Do
file_lines. = ''
file_lines.0 = 0
Parse Value(_rxfindlines('restartobjects=', config_sys)) ,
With restart_line_no restart_line '|' .
/* REM out the current SET RESTARTOBJECTS= line */
restart_line = 'REM' restart_line
xrc = _rxupdline(restart_line_no, restart_line, config_sys)
/* do we have a SET RESTARTOBJECTS=NO line? */
save_restart_line_no = restart_line_no
If Words(restart_line_rem) \= 0 Then
Do
restart_line_no = Word(restart_line_rem, 1)
restart_line = 'SET RESTARTOBJECTS=NO'
action = 'replace'
End
Else
Do
restart_line_no = save_restart_line_no
restart_line = 'SET RESTARTOBJECTS=NO'
action = 'insert'
End
xrc = _rxupdline(restart_line_no, restart_line, config_sys, action, 'close')
End
Else
xrc = 1
/* update STARTUP.CMD */
If xrc Then
Do
file_lines. = ''
file_lines.0 = 0
If isrexx Then
startup_line = 'Address cmd' '"' || startup_line || '"'
/* do we have a startup.cmd file ? */
If Stream(startup_cmd, 'c', 'query exists') \= '' Then
Do
Parse Value(_rxfindlines('rxautost.exe', startup_cmd)) With ,
startup_line_no startup_line_current '|' startup_line_rem
/* do we have a rxautost.exe line? */
If startup_line_no = 0 Then
Do
/* is it REMed out? */
If Words(startup_line_rem) \= 0 Then
Do
action = 'replace'
startup_line_no = Word(startup_line_rem, 1)
End
Else
Do
action = 'insert'
startup_line_no = 0
End
xrc = _rxupdline(startup_line_no, startup_line, startup_cmd, action, 'close')
End
Else
Do
If Pos(startup_line, startup_line_current) = 0 Then
xrc = _rxupdline(startup_line_no, startup_line, startup_cmd, 'replace', 'close')
End
End
Else
Do
xrc = _rxupdline(0, 'REM * * * added by RxAutoUt * * *', startup_cmd, 'insert')
xrc = _rxupdline(1, startup_line, startup_cmd, 'insert')
xrc = _rxupdline(2, 'EXIT', startup_cmd, 'insert', 'close')
End
End
Else
id = VRMessage( VRWindow(), "Update of" startup_cmd "bypassed due to failure to update" config_sys, "", "Information", "", , )
Call Page4_create 'no_init'
ini_changes = 1
Return
/*:VRX MenuRexxAutostartDeactivate_Click
*/
Menurexxautostartdeactivate_click: Procedure Expose bootdrive file_lines. isrexx ,
enablexstart ini_changes
config_sys = bootdrive || '\config.sys'
startup_cmd = bootdrive || '\startup.cmd'
/* update CONFIG.SYS */
Parse Value(_rxfindlines('restartobjects=no', config_sys)) With ,
restart_line_no restart_line '|' restart_line_rem
If restart_line_no \= 0 Then
Do
file_lines. = ''
file_lines.0 = 0
/* REM out the SET RESTARTOBJECTS=NO line */
restart_line = 'REM' restart_line
xrc = _rxupdline(restart_line_no, restart_line, config_sys)
save_restart_line_no = restart_line_no
/* do we have a SET RESTARTOBJECTS=STARTUPFOLDERSONLY line? */
Parse Value(_rxfindlines('restartobjects=startupfoldersonly',config_sys)) With ,
restart_line_no restart_line '|' restart_line_rem
If Words(restart_line_rem) \= 0 Then
Do
restart_line_no = Word(restart_line_rem, 1)
restart_line = 'SET RESTARTOBJECTS=STARTUPFOLDERSONLY'
action = 'replace'
End
Else
Do
restart_line_no = save_restart_line_no
restart_line = 'SET RESTARTOBJECTS=STARTUPFOLDERSONLY'
action = 'insert'
End
xrc = _rxupdline(restart_line_no, restart_line, config_sys, action, 'close')
End
Else
xrc = 1
/* update STARTUP.CMD */
If xrc Then
Do
file_lines. = ''
file_lines.0 = 0
Parse Value(_rxfindlines('rxautost.exe', startup_cmd)) With ,
startup_line_no startup_line '|' startup_line_rem
If startup_line_no \= 0 Then
Do
If \isrexx Then
startup_line = 'REM' startup_line
Else
startup_line = '/*' startup_line '*/'
xrc = _rxupdline(startup_line_no, startup_line, startup_cmd, , 'close')
End
xrc = 1
End
Else
id = VRMessage( VRWindow(), "Update of" startup_cmd "bypassed due to failure to update" config_sys, "", "Information", "", , )
Call Page4_create 'no_init'
If enablexstart Then
enablexstart = 0
ini_changes = 1
Return 0
/*:VRX Migrate_rexxautostart
*/
Migrate_rexxautostart: Procedure
Parse Arg our_ini, bootdrive
ini_changes = 0
migrated = (VRGetIni( "RexxAutoStart", "migrate", our_ini ) = 1)
old_parms = ''
If \migrated Then
Do
/* do we have a startup.cmd file ? */
If VRFileExists( bootdrive || '\startup.cmd' ) Then
Do
Parse Value _rxfindlines('rxautost', bootdrive || '\startup.cmd') With ,
startup_line_no startup_line '|' .
/* do we have a rxautost.exe line ? */
If startup_line_no <> 0 Then
Do
/* get any parameters */
exe_pos = Pos('RXAUTOST', Translate(startup_line))
Parse Value Substr(startup_line, exe_pos) With . old_parms
End
End
old_parms = Space(old_parms Value('rxautost', , 'os2environment'))
If old_parms = '' Then
ok = VRSetIni( "RexxAutoStart", "migrate", '1', our_ini )
Else
Do
If VRGetIni( "workplace_shell", "wps_wait", our_ini) = '' ,
& Pos('/WPS', Translate(old_parms)) <> 0 Then
ok = VRSetIni( "workplace_shell", "wps_wait", '1', our_ini)
If VRGetIni( "workplace_shell", "sc_wait", our_ini) = '' ,
& Pos('/SC', Translate(old_parms)) <> 0 ,
& Pos('WARPCENTER', Translate(Value('AUTOSTART', , 'OS2ENVIRONMENT'))) <> 0 Then
ok = VRSetIni( "workplace_shell", "sc_wait", '1', our_ini)
If VRGetIni( "workplace_shell", "tb_wait", our_ini) = '' ,
& Pos('/TB', Translate(old_parms)) <> 0 ,
& Pos('TOOLBAR', Translate(Value('AUTOSTART', , 'OS2ENVIRONMENT'))) <> 0 Then
ok = VRSetIni( "workplace_shell", "tb_wait", '1', our_ini)
If VRGetIni( "workplace_shell", "delay_wait", our_ini) = '' ,
& Pos('/D:',Translate(old_parms)) <> 0 Then
Do
Parse Value Translate('.' old_parms) With . '/D:' delay_wait '/' .
delay_wait = Strip(delay_wait)
If delay_wait <> '' & Datatype(delay_wait, 'W') Then
ok = VRSetIni( "workplace_shell", "delay_wait", delay_wait, our_ini)
End
If VRGetIni( "object_desktop", "od_wait", our_ini) = '' ,
& Pos('/OD ', Translate(old_parms)) <> 0 ,
& VRGetIni('WPTS', 'TSMasterSetup:StartupFlags', 'User') <> '' Then
ok = VRSetIni( "object_desktop", "od_wait", '1', our_ini )
If VRGetIni( "object_desktop", "od_cc", our_ini) = '' ,
& Pos('/ODC ', Translate(old_parms)) <> 0 Then
ok = VRSetIni( "object_desktop", "od_wait", '1', our_ini )
If VRGetIni( "object_desktop", "od_tlp", our_ini) = '' ,
& Pos('/ODT ', Translate(old_parms)) <> 0 Then
ok = VRSetIni( "object_desktop", "od_wait", '1', our_ini )
If VRGetIni( "object_desktop", "od_tries", our_ini) = '' ,
& Pos('/OD:', Translate(old_parms)) <> 0 Then
Do
Parse Value Translate('.' old_parms) With . '/OD:' od_tries '/' .
od_tries = Strip(od_tries)
If od_tries <> '' & Datatype(od_tries, 'W') Then
ok = VRSetIni( "object_desktop", "od_tries", od_tries, our_ini)
End
If VRGetIni( "folders", "startupfolder", our_ini) = '' ,
& Pos('/F:', Translate(old_parms)) <> 0 Then
Do
f_pos = Pos('/F:', Translate(old_parms))
If f_pos <> 0 Then
Do
Parse Value '.' old_parms With . + (f_pos) + 4 startupfolder '/' .
startupfolder = Strip(Strip(Strip(startupfolder), , '"'), , "'")
ok = VRSetIni( "folders", "startupfolder", startupfolder, our_ini)
End
End
If VRGetIni( "objects", "retries", our_ini) = '' ,
& Pos('/R:', Translate(old_parms)) <> 0 Then
Do
Parse Value Translate('.' old_parms) With . '/R:' retries '/' .
retries = Strip(retries)
If retries <> '' & Datatype(retries, 'W') Then
ok = VRSetIni( "objects", "retries", retries, our_ini)
End
If VRGetIni( "objects", "sleepsec", our_ini) = '' ,
& Pos('/P:', Translate(old_parms)) <> 0 Then
Do
Parse Value Translate('.' old_parms) With . '/P:' sleepsec '/' .
sleepsec = Strip(sleepsec)
If sleepsec <> '' & Datatype(sleepsec, 'W') Then
ok = VRSetIni( "objects", "sleepsec", sleepsec, our_ini)
End
If VRGetIni( "debug", "log_out", our_ini) = '' ,
& Pos('/L', Translate(old_parms)) <> 0 Then
ok = VRSetIni( "debug", "log_out", '1', our_ini)
If VRGetIni( "debug", "verbose", our_ini ) = '' ,
& Pos('/V', Translate(old_parms)) <> 0 Then
ok = VRSetIni( "debug", "verbose", '1', our_ini)
ok = VRSetIni( "RexxAutoStart", "migrate", '1', our_ini )
ini_changes = 1
End
End
Return ini_changes
/*:VRX Page1_Close
*/
Page1_close:
Call Page1_fini
Return
/*:VRX Page1_Create
*/
Page1_create:
Parse Arg no_init
p_init = (no_init = '')
startup_wait = VRGetIni( "workplace_shell", "startup_wait", our_ini, 'Noclose')
If startup_wait = '' Then
Do
startup_wait = VRGet("CB_startup_wait","set")
ini_changes = 1
End
ok = VRSet("CB_startup_wait","set", startup_wait, "Enabled", VRFileExists( bootdrive || "\startup.cmd" ) )
wps_wait = VRGetIni( "workplace_shell", "wps_wait", our_ini, 'Noclose')
If wps_wait = '' Then
Do
wps_wait = VRGet("CB_wps_wait","set")
ini_changes = 1
End
ok = VRSet("CB_wps_wait","set", wps_wait )
sc_test = Check_startup('WARPCENTER', '<WP_WARPCENTER>', , '<WP_START>')
sc_wait = VRGetIni( "workplace_shell", "sc_wait", our_ini, 'Noclose')
If sc_wait = '' Then
Do
sc_wait = sc_test
ini_changes = 1
End
sc_wait = (sc_wait & sc_test)
ok = VRSet( "RB_sc_wait","set", sc_wait, "Enabled", sc_test)
sc_test = Check_startup(, '<WP_WARPCENTER>', , '<WP_START>')
sc_open = VRGetIni( "workplace_shell", "sc_open", our_ini, 'Noclose')
If sc_open = '' Then
Do
sc_open = 0
ini_changes = 1
End
ok = VRSet("RB_sc_open","set",(sc_open & \sc_wait),"Enabled",sc_test)
tb_test = Check_startup('TOOLBAR', '<WP_LAUNCHPAD>', , '<WP_START>')
tb_wait = VRGetIni( "workplace_shell", "tb_wait", our_ini, 'Noclose')
If tb_wait = '' Then
Do
tb_wait = tb_test
ini_changes = 1
End
tb_wait = (tb_wait & tb_test)
ok = VRSet( "RB_tb_wait","set", tb_wait, "Enabled", tb_test)
tb_test = Check_startup(, '<WP_LAUNCHPAD>', , '<WP_START>')
tb_open = VRGetIni( "workplace_shell", "tb_open", our_ini, 'Noclose')
If tb_open = '' Then
Do
tb_open = 0
ini_changes = 1
End
tb_open = (tb_open & tb_test)
ok = VRSet( "RB_tb_open","set",(tb_open & \tb_wait),"Enabled",tb_test)
xc_test = Check_startup(,'<XWP_XCENTER>', 'XCenter', '<WP_START>')
ec_wait = VRGetIni( "workplace_shell", "ec_wait", our_ini, 'Noclose')
If ec_wait <> '' Then
Do
ok = VRDelIni( "workplace_shell", "ec_wait", our_ini, 'Noclose') Then
xc_wait = (ec_wait & xc_test)
ok = VRSetIni( "workplace_shell", "xc_wait", xc_wait, our_ini, 'Noclose' )
End
xc_wait = VRGetIni( "workplace_shell", "xc_wait", our_ini, 'Noclose')
xc_wait = (xc_wait & xc_test)
ok = VRSet( "RB_xc_wait","set",xc_wait,"Enabled",xc_test)
xc_open = VRGetIni( "workplace_shell", "xc_open", our_ini, 'Noclose')
If \Datatype(xc_open, 'B') Then
Do
xc_open = 0
ini_changes = 1
End
ok = VRSet( "RB_xc_open","set",xc_open,"Enabled",xc_test)
delay_wait = VRGetIni( "workplace_shell", "delay_wait", our_ini, 'Noclose')
If delay_wait = '' Then
Do
delay_wait = VRGet("SPIN_delay_wait", "Value")
ini_changes = 1
End
ok = VRSet("SPIN_delay_wait", "Value", delay_wait )
ok = VRSet("CB_delay","Set", (delay_wait > 0))
od_wait = VRGetIni( "object_desktop", "od_wait", our_ini, 'Noclose')
If od_wait = '' Then
Do
od_wait = (VRGetIni('WPTS', 'TSMasterSetup:StartupFlags', 'User') <> '')
ini_changes = 1
End
objdesk = (VRGetIni( "WPTS", "InstallDir", "User" ) <> '')
ok = VRSet("CB_ODInstalled","set",objdesk)
If objdesk Then
Do
ok = VRSet("CB_ODInstalled", "caption", "Object Desktop is installed")
od_cc = VRGetIni( "object_desktop", "od_cc", our_ini, 'Noclose')
If od_cc = '' Then
od_cc = 0
ok = VRSet("CB_od_cc", "Set", od_cc, "Enabled", WPToolsQueryObject('<OBJD_CONTROLCENTER>'))
od_tlp = VRGetIni( "object_desktop", "od_tlp", our_ini )
If od_tlp = '' Then
od_tlp = 0
ok = VRSet("CB_od_tlp", "Set", od_tlp, "Enabled", WPToolsQueryObject('<OBJD_TABLAUNCHPAD>'))
End
Else
Do
ok = VRSet("CB_ODInstalled", "caption", "Object Desktop is not installed")
od_cc = 0
od_tlp = 0
End
od_tries = VRGetIni( "object_desktop", "od_tries", our_ini, 'Noclose')
If od_tries = '' Then
Do
od_tries = 30
ini_changes = 1
End
ok = VRSet("SPIN_od_tries","Value", od_tries )
If p_init Then
Call Page1_init
Return
/*:VRX Page1_Fini
*/
Page1_fini:
window = VRInfo( "Window" )