-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathDOpus.ObjectDefs.vbs
4481 lines (3421 loc) · 222 KB
/
DOpus.ObjectDefs.vbs
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
'* Int - a whole number
'* Currency - this is a standard variant type, and is used by Opus in just a couple of cases that require numbers larger than an Int can hold (unfortunately ActiveX scripting does not support a 64 bit integer type).
'* String - a text string
'* Bool - a Boolean (either True or False)
'* Date - a date/time value
'* Collection - a collection of multiple objects of (generally) the same type. Collections can be easy enumerated in some languages (e.g. in VBScript, using the For Each construct). Collections are only returned by Opus - unlike an array (or a Vector object), they are never created or modified directly (although some script methods can be used to modify them in certain cases). For example, the Tab object has a property called selected that represents all currently selected items in that tab - it is a collection of items.
'* Object - an Opus script object with defined methods and properties (one of the object types listed below). Some objects can be both an object and a collection - that is, they have methods and properties, but can also be enumerated like a collection. Some objects also have a default value - that is, simply using the object's name without any method or property will return a value of its own. For example, the Metadata object's default value is a string indicating the primary type of metadata available. You can also refer to an object's default value using the special def_value property name.
'* Variant - a variable of any type (this is used with a few objects - for example, a Var object can store a variant)
' ! Red highlighted comment
' ? Blue highlighted comment
' * Green highlighted comment
' todo orange highlighted comment
' // Grey with strikethrough comment
' The DOpus object is one of the two global script objects provided by Opus, and is available to all scripts. It provides various helper methods, and collections that let you access things like Listers and toolbars.
Class DOpus
' The Aliases object gives the script access to the defined folder aliases.
Property Get Aliases ' Return Type object:Aliases
End Property
' Returns a collection of Format objects representing the used-defined favorite formats.
Property Get FavoriteFormats ' Return Type collection:Format
End Property
' Returns a Favorites object which lets you query and modify the user-defined favorite folders.
Property Get Favorites ' Return Type object:Favorites
End Property
' Returns a FiletypeGroups object which lets you enumerate and query the configured file type groups.
Property Get FileTypeGroups ' Return Type object:FiletypeGroups
End Property
' Returns a GlobalFilters object which lets you access information about the global filter settings (configured on the Folders / Global Filters page in Preferences).
Property Get Filters ' Return Type object:GlobalFilters
End Property
' Returns a string representing the current user interface language.
Property Get Language ' Return Type string
End Property
' Returns a Listers object which represents any currently open Lister windows (each one is represented by a Lister object).
Property Get Listers ' Return Type object:Listers
End Property
' Returns a SmartFavorites object which lets you query the SmartFavorites data.
Property Get SmartFavorites ' Return Type object:SmartFavorites
End Property
' Returns a ScriptStrings object which lets your script access any strings defined as string resources.
Property Get Strings ' Return Type object:ScriptStrings
End Property
' Returns a TabGroups object which lets your script access and manipulate the configured folder tab groups.
Property Get TabGroups ' Return Type object:TabGroups
End Property
' This Vars object represents all defined variables with global scope.
Property Get Vars ' Return Type object:Vars
End Property
' The Version object provides information about the current Opus program version.
Property Get Version ' Return Type object:Version
End Property
' Returns a Viewers object which represents any currently open standalone image viewers (each one is represented by a Viewer object).
Property Get Viewers ' Return Type object:Viewers
End Property
' Clears the script output log.
Sub ClearOutput
End Sub
' Creates and returns a new DOpusFactory object, which can be used to create various lightweight helper objects like Blob, Map and Vector.
Function Create ' Return Type object:DOpusFactory
End Function
' Delays for the specified number of milliseconds before returning.
Sub Delay(<int:time>)
End Sub
' Creates a new Dialog object, that lets you display dialogs and popup menus.
Function Dlg ' Return Type object:Dialog
End Function
' Creates the DPI helper object which assists when dealing with different system scaling settings (e.g. high-DPI monitors).
Function DPI ' Return Type object:DPI
End Function
' Creates a new FSUtil object, that provides helper methods for accessing the file system.
Function FSUtil ' Return Type object:FSUtil
End Function
' Retrieves the current contents of the system clipboard, if it contains either text or files.
Function GetClip(none or <string:type>) ' Return Type string
End Function
' Returns a string indicating the native format of the clipboard contents - ""text"", ""files"" or an empty string in any other case.
Function GetClipFormat ' Return Type string
End Function
' Returns a string indicating which qualifier keys are currently held down. If none are held down, the string will be ""none"". Otherwise, the string can contain any or all of the following, separated by commas: ""shift"", ""ctrl"", ""alt"", ""lwin"", ""rwin"".
Function GetQualifiers ' Return Type string
End Function
' Loads an image file from the specified external file. You can optionally specify the desired size to load the image at, and whether the alpha channel (if any) should be loaded or not.
Function LoadImage(<string:filename>,[<int:width>],[<int:height>],[<bool:alpha>]) ' Return Type object:Image
End Function
' Extracts a thumbnail from the specified external file. You can optionally specify a timeout (in milliseconds) and the desired size to load the thumbnail at.
Function LoadThumbnail(<string:filename>,[<int:timeout>],[<int:width>],[<int:height>]) ' Return Type object:Image or bool (False)
End Function
' Prints the specified text string to the script output log (found in the Utility Panel, the CLI in script mode, the Rename dialog and the Command Editor in script mode).
Sub Output(<string:text>,[<bool:error>],[<bool:timestamp>])
End Sub
' Causes Opus to reload and reinitialize the specified script. You must provide the full pathname of the script on disk (if a script add-in wants to reload itself you can pass the value of the Script.file property).
Sub ReloadScript(<string:file>)
End Sub
' Places the specified text, or Item collection (or Vector of Item objects) on the system clipboard. If called with no arguments the clipboard will be cleared.
Sub SetClip(<string:text> or collection:Item or none)
End Sub
' Returns a Toolbars object which lets you enumerate all defined toolbars (whether they are currently open or not).
Function Toolbars(<string:type>) ' Return Type object:Toolbars
End Function
' Returns a string indicating the type of an object or variable.
Function TypeOf(any) ' Return Type string
End Function
End Class
'The Script object is one of the two global script objects provided by Opus. This object is provided to script addins when their various event handlers are invoked (other than for the OnInit event). It provides information relating to the script itself.
Class Script
' Returns a ScriptConfig object representing the configuration values for this script. In the OnInit method a script can define the properties that make up its configuration - the user can then edit these values in Preferences. The object returned by the config property represents the values that the user has chosen.
Property Get config ' Return Type object:ScriptConfig
End Property
' Returns the path and filename of this script.
Property Get file ' Return Type string
End Property
' Returns a Vars object that represents the variables that are scoped to this particular script. This allows scripts to use variables that persist from one invocation of the script to another.
Property Get vars ' Return Type object:Vars
End Property
' Returns True if local HTTP help is enabled (that is, if help is shown in the user's web browser), False if the old HtmlHelp-style help is enabled. If HTTP help is enabled, your script is able to add its own help pages via the OnGetHelpContent event, and it can trigger the display of its own help pages using the ShowHelp method.
Function HttpHelpEnabled ' Return Type bool
End Function
' If your script implements the OnAddColumns event, you can call the InitColumns method at any time to reinitialize your columns. You may want to do this, for example, in response to the user modifying your script's configuration.
Sub InitColumns
End Sub
' If your script implements the OnAddCommands event, you can call the InitCommands method at any time to reinitialize your commands. You may want to do this, for example, in response to the user modifying your script's configuration.
Sub InitCommands
End Sub
' Using the OnGetHelpContent event your script can add its own content to the F1 help. If your script is bundled as a script package you can include .html files in a sub-directory of the package called help, and then load them easily using this method. You can then pass the loaded data to the GetHelpContentData.AddHelpPage method to add the page.
Function LoadHelpFile(<string:name>) ' Return Type string
End Function
' If your script is bundled as a script package you can include PNG and JPG image files in a sub-directory of the package called help, and then load them easily using this method. You can then pass the loaded data to the GetHelpContentData.AddHelpImage method to add the image.
Function LoadHelpImage(<string:name>) ' Return Type object:Blob
End Function
' Loads an image file from the specified external file. If your script is bundled as a script package you can place image files in a sub-directory of the package called images and then load them from your script by giving their name. You can optionally specify the desired size to load the image at, and whether the alpha channel (if any) should be loaded or not.
Function LoadImage(<string:name>,[<int:width>],[<int:height>],[<bool:alpha>]) ' Return Type object:Image
End Function
' Loads external script resources and makes them available to the script. You can either provide a filename or a raw XML string. If your script is bundled as a script package, the resource file must have a .odxml extension for LoadResources to be able to find it in the package.
Sub LoadResources(<string:name> or <string:XML>)
End Sub
' If your script implements any custom columns, you can use this method to cause them to be regenerated if they are currently shown in any tabs. You may want to do this, for example, in response to the user modifying your script's configuration. Pass the name of the column you want to regenerate as the argument to this method.
Sub RefreshColumn(<string:name>)
End Sub
' If your script adds its own help pages via the OnGetHelpContent event, and the user has http help enabled, you can call this method to display your help in the user's web browser. You might want to do this when the user clicks a Help button in your script dialog, for example. You can use the HttpHelpEnabled method to check if http help is enabled before calling this function.
Sub ShowHelp(<string:page>)
End Sub
End Class
' There are also a number of objects that Opus provides as parameters to methods within a script. For example, when a script function is invoked (e.g. when the button is clicked), Opus calls its OnClick method, passing it a ClickData object.
'This object represents a folder alias, and is retrieved using the Aliases object.
Class Alias
' 'Returns the name of the alias.
' Default Property Get Def_value 'Return Type string
' End Property
'Returns the target of the alias as a Path object.
Property Get path ' Return Type object:Path
End Property
'True if the object is a system-defined alias, False if it is user defined.
Property Get system ' Return Type bool
End Property
End Class
'This object is a collection of all defined folder aliases. It is retrieved using the DOpus.aliases collection property.
Class Aliases ' Default Return Type collection:Alias
'Adds a new alias to the system with the specified name and path. Note that you should not provide the leading forward-slash (/) in the alias name.
Sub Add(<string:name>,<string:path>)
End Sub
'Deletes the specified alias.
Sub Delete
End Sub
'Updates the state of this object. When the Aliases object is first retrieved via DOpus.aliases, a snapshot is taken of the aliases at that time. If you make changes via the object it will reflect them but any changes made outside the script (e.g. via the Favorites ADD=alias command) will not be detected unless you call the Update method.
Sub Update
End Sub
End Class
'This object represents the arguments supplied on the command line for script-defined internal commands. It is retrieved from the ScriptCommandData.Func.args property.
Class Args
'The Args object will have one property corresponding to each of the arguments in the command line template.
Property Get argument_name ' Return Type variant
End Property
'The got_arg property returns an object with a bool child property for each argument in the template. It lets you test if a particular argument was provided on the command line, before you actually query for the value of the argument. For example, If Args.got_arg.size Then...
Property Get got_arg ' Return Type object
End Property
End Class
'This object provides metadata properties relating to audio files. It is obtained from the Metadata object.
Class AudioMeta
'Returns the value of the specified column, as listed in the Music section of the Keywords for Columns page.
Property Get column_keyword ' Return Type variant
End Property
'Returns a collection of AudioCoverArt objects representing any cover art imagery stored in the audio file.
Property Get coverart ' Return Type collection:AudioCoverArt
End Property
End Class
'This object provides access to an audio file's embedded cover art. It is obtained from the AudioMeta.coverart property.
Class AudioCoverArt ' Default Return Type string
'Returns a Blob object representing the actual image data.
Property Get data ' Return Type object:Blob
End Property
'Returns the bit depth of this image.
Property Get depth ' Return Type int
End Property
'Returns the description of this image (if any).
Property Get desc ' Return Type string
End Property
'Returns the default file extension for this image, if it can be determined.
Property Get ext ' Return Type string
End Property
'Returns the height of this image, in pixels.
Property Get height ' Return Type int
End Property
'Returns the image's MIME type, if specified in the file.
Property Get mime ' Return Type string
End Property
'Returns a FileSize object representing the size of the image data.
Property Get size ' Return Type object:FileSize
End Property
'Returns a ""pretty"" form of the intended use string (i.e. the default value), translated to the current Opus user interface language.
Property Get type ' Return Type string
End Property
'Returns the width of this image, in pixels.
Property Get width ' Return Type int
End Property
End Class
'This object provides a simple interface for dealing with binary data. It is obtained from the DOpusFactory.Blob method and also returned by the AudioCoverArt.data property.
Class Blob
'Returns a FileSize object representing the size of this Blob in bytes.
Property Get size ' Return Type object:FileSize
End Property
'Compares the contents of this Blob against another Blob (or array). By default the entire contents of the two blobs are compared. The optional parameters that let you configure the operation are:
Function Compare(<Blob:source>,<int:to>,<int:from>,<int:size>) ' Return Type int
End Function
'Copies data from the source Blob (or array) into this Blob. By default the entire contents of the source Blob will be copied over the top of this one. The optional parameters that let you configure the operation are:
Sub CopyFrom(<Blob:source>,<int:to>,<int:from>,<int:size>)
End Sub
Sub CopyFrom(<string>,<type>)
End Sub
'Searches the contents of this Blob for the data contained in another Blob (or array). By default the entire contents of this Blob are searched. The optional from parameter lets you specify the starting position for the search, and the optional size parameter lets you specify the length of data in this Blob to search through.
Function Find(<Blob:search>,<int:from>,<int:size>) ' Return Type object:FileSize
End Function
'Frees the memory associated with this Blob and resets its size to 0.
Sub Free
End Sub
'Initialises the contents of the Blob (every byte within the blob will be set to 0). Equivalent to Set(0).
Sub Init
End Sub
'Resizes the Blob to the specified number of bytes.
Sub Resize
End Sub
'Reverses the contents of the Blob.
Sub Reverse
End Sub
'Sets the contents of the Blob to the specified byte value (every byte within the blob will be set to that value). By default the whole Blob will be affected. The option to parameter lets you specify a byte offset to start at, and the optional size parameter lets you control the number of bytes affected.
Sub Set(<byte:value>,<int:to>,<int:size>)
End Sub
'Converts the contents of this Blob to a SAFEARRAY of type VT_UI1. By default the entire contents of the Blob will be copied to the array. The optional parameters that let you configure the operation are:
Function ToArray(<int:from>,<int:size>) ' Return Type SAFEARRAY of VT_UI1
End Function
'Converts the contents of this Blob to a SAFEARRAY of type VT_VARIANT. Each variant in the array contains a VT_UI1. By default the entire contents of the Blob will be copied to the array. The optional parameters that let you configure the operation are:
Function ToVBArray ' Return Type SAFEARRAY of VT_VARIANT
End Function
End Class
'A BusyIndicator object lets you control the breadcrumbs bar busy indicator from your script.
Class BusyIndicator
'Before the Init method has been called, you can set this property to True to enable abort by the user (as shown above).
Property Get abort ' Return Type bool
End Property
' Removes the busy indicator from display and destroys its internal data structures. The BusyIndicator object itself can be re-used by calling the Init method again.
Sub Destroy
End Sub
' Removes the busy indicator from display, but does not destroy its internal data. The indicator can be re-displayed by calling the Show method.
Sub Hide
End Sub
' Initializes a BusyIndicator object and optionally displays it. The window parameter specifies the Lister that the indicator is to be attached to - you can pass either a Lister or a Tab object.
Function Init(<object:window>,<string:description>,<bool:visible>) ' Return Type bool
End Function
' Displays the busy indicator.
Sub Show
End Sub
' Updates the busy indicator. The description parameter lets you specify a new description string, and the optional percentage parameter lets you specify a new percentage complete value from 0 to 100.
Sub Update(<string:description>,<int:percentage>)
End Sub
End Class
'This object represents a column that has been added to the display in a tab. A collection of columns can be obtained from the Format object.
Class Column ' Default Return name of the column as string
'Returns True if the column width is set to auto.
Property Get autosize ' Return Type bool
End Property
'Returns True if the column width is set to collapse.
Property Get collapse ' Return Type bool
End Property
'Returns True if the column width is set to expand.
Property Get expand ' Return Type bool
End Property
'Returns True if the column width is set to fill.
Property Get fill ' Return Type bool
End Property
'Returns the name of the column as displayed in the Lister column header.
Property Get header ' Return Type string
End Property
'Returns the name of the column as displayed in the Columns tab in the Folder Options dialog.
Property Get label ' Return Type string
End Property
'Returns the maximum width of the column in pixels, or the string ""fill"" if the maximum is set to fill.
Property Get max ' Return Type int or string
End Property
'Returns the name of the column.
Property Get name ' Return Type string
End Property
'Returns True if the sort direction of the column is reversed.
Property Get reverse ' Return Type bool
End Property
'Returns the sort order of the column (e.g. 1 for the primary sort field, 2 for the secondary sort field, etc). Returns 0 if the display is not sorted by this column.
Property Get sort ' Return Type int
End Property
'Returns the current display width of the column in pixels.
Property Get width ' Return Type int
End Property
End Class
'This object is used to run Opus commands. It is obtained from the ScriptCommandData.func or ClickData.func properties, and can also be created by the DOpusFactory.Command method.
Class Command
'Set this property to False to prevent files used by this command from being deselected, and True to deselect them once the function is finished. Note that files will only be deselected if they came from a Tab object, and only then if the command is successful.
Property Get deselect ' Return Type bool
End Property
'Returns a Path object that represents the destination folder of this command. If a destination tab is set, this will be the path in the tab. You can not set this property directly - instead, use either the SetDest or SetDestTab methods to change the destination folder.
Property Get dest ' Return Type object:Path
End Property
'Returns a Tab object that represents the destination tab for this command (if it has one - not all commands require a destination). You can not set this property directly - instead, use the SetDestTab method to change the destination tab.
Property Get desttab ' Return Type object:Tab
End Property
'Returns the number of items in the files collection.
Property Get filecount ' Return Type int
End Property
'Returns a collection of all Item objects that represent the files and folders this command is to act upon. You can not modify this collection directly - instead you can use the various methods (ClearFiles, SetFiles, AddFile, RemoveFile, etc.) to modify the list of items to act upon.
Property Get files ' Return Type collection:Item
End Property
'Returns the number of instruction lines added to the command.
Property Get linecount ' Return Type int
End Property
'Returns a Progress object that you can use to display a progress indicator to the user.
Property Get progress ' Return Type object:Progress
End Property
'After every command that is run with this object, a Results object is available from this property. This provides information about the outcome of the command.
Property Get results ' Return Type object:Results
End Property
'Returns a Path object that represents the source folder of this command. If a source tab is set, this will be the path in the tab. You can not set this property directly - instead, use either the SetSource or SetSourceTab methods to change the source folder.
Property Get source ' Return Type object:Path
End Property
'Returns a Tab object that represents the source tab for this command. You can not set this property directly - instead, use the SetSourceTab method to change the source tab.
Property Get sourcetab ' Return Type object:Tab
End Property
'This Vars object represents all defined variables with command scope (that are scoped to this function - e.g. that were set using the @set directive).
Property Get vars ' Return Type object:Vars
End Property
' Adds the specified item to the collection of items this command is to act upon. You can pass the item's path as either a string or a Path object, and you can also pass an Item object directly.
Function AddFile(<string:path> or <Path:path> or <Item:item>) ' Return Type int
End Function
' Adds the items in the specified collection to the list of items this command is to act upon. The return value is the new number of items in the collection.
Function AddFiles(collection:Item or Vector:Item or Vector:Path or Vector:string) ' Return Type int
End Function
' Adds the contents of the clipboard to the collection of items this command is to act upon. This method supports both files and file paths copied to the clipboard as text. The return value is the new number of items in the collection.
Function AddFilesFromClipboard ' Return Type int
End Function
' Reads file paths from the contents of the specified file and adds them to the item collection. You can provide the file's path as either a string or a Path object. The file must consist of one absolute path per line.
Function AddFilesFromFile(<string:path>,<string:encoding>) ' Return Type int
End Function
' Adds the contents of the specified folder to the collection of items this command is to act upon. You can pass the folder's path as either a string or a Path object. You can also append a wildcard pattern to the path to only add files matching the specified pattern.
Function AddFilesFromFolder ' Return Type int
End Function
' Adds the specified instruction line to the command that this object will run. The AddLine method lets you build up complicated multiple line commands - add each line in turn and then run the command using the Run method. For a single line command it is simpler to use the RunCommand method.
Sub AddLine
End Sub
' Clears all instruction lines from the command.
Sub Clear
End Sub
' Clears the failure flags from the Item collection. Any items that fail when a command is run will have their failed property set to True, and once this has happened the file will be skipped over by any subsequent commands. You can call this method to reset all the failure flags.
Sub ClearFailed
End Sub
' Clears the collection of items this command is to act upon.
Sub ClearFiles
End Sub
' Clears any modifiers that have been set for this command. The supported modifiers are a subset of the full list of command modifiers - see the SetModifier method for a list of these. You can also pass * to clear all modifiers that have been set.
Sub ClearModifier
End Sub
' Returns a StringSet containing the names of all the Opus commands. You can optionally filter this set by providing one or more of the following flags as an argument to the CommandList method:
Function CommandList(none or <string:types>) ' Return Type object:StringSet
End Function
' Creates a new Dialog object, that lets you display dialogs and popup menus. The dialog's window property will be automatically assigned to the source tab.
Function Dlg ' Return Type object:Dialog
End Function
' Returns a Map of the modifiers that have been set for this command (either by the SetModifier method, or in the case of script add-ins any modifiers that were set on the button that invoked the script).
Function GetModifiers ' Return Type object:Map
End Function
' Returns True if the specified Set command condition is true. This is the equivalent of the @ifset command modifiers. The optional second parameter lets you test a condition based on a command other than Set - for example, IsSet(""VIEWERCMD=mark"", ""Show"") in the viewer to test if the current image is marked.
Function IsSet(<string:condition>,[<string:command>]) ' Return Type bool
End Function
' Removes the specified file from the Item collection. You can pass the file's path as either a string or a Path object. You can also pass the Item itself, or its index (starting from 0) within the collection. The return value is the new number of items in the collection.
Function RemoveFile(<string:path> or <Path:path> or <Item:item> or <int:index>) ' Return Type int
End Function
' Runs the command that has been built up with this object. The return value indicates whether or not the command ran successfully. Zero indicates the command could not be run or was aborted; any other number indicates the command was run for at least some files. (Note that this is not the ""exit code"" for external commands. For external commands it only indicates whether or not Opus launched the command. If you need the exit code of an external command, use the WScript.Shell Run or Exec methods to run the command.) You can use the Results property to find out more information about the results of the command, and also discover which files (if any) failed using the failed property of each Item in the files collection.
Function Run ' Return Type int
End Function
' Runs the single line command given by the instruction argument. Calling this method is the equivalent of adding the single line with the AddLine method and then calling the Run method.
Function RunCommand ' Return Type int
End Function
' Sets the command's destination to the specified path. You can provide the path as either a string or a Path object. Calling this method clears the destination tab property from the command.
Sub SetDest
End Sub
' Sets the command's destination to the specified tab. The destination path will be initialized from the tab automatically (so you don't need to call SetDest as well as SetDestTab).
Sub SetDestTab
End Sub
' Configures the command to use the files in the specified Item collection as the items the command will act upon.
Sub SetFiles
End Sub
' Turns on a modifier for this command. The supported modifiers are a subset of the full list of command modifiers:
Sub SetModifier(<string:modifier>,<string:value>)
End Sub
' Lets you share the progress indicator from one command with another command. You can pass this method the value of progress property obtained from another Command object.
Sub SetProgress
End Sub
' This method lets you control which qualifier keys the command run by this object will consider to have been pressed when it was invoked. For example, several internal commands change their behavior when certain qualifier keys are held down - calling this method allows you to set which keys they will see.
Sub SetQualifiers
End Sub
' Sets the command's source to the specified path. You can provide the path as either a string or a Path object. Calling this method clears the source tab property from the command.
Sub SetSource
End Sub
' Sets the command's source to the specified tab. The source path will be initialized from the tab automatically (so you don't need to call SetSource as well as SetSourceTab).
Sub SetSourceTab
End Sub
' Sets the type of function that this command will run. This is equivalent to the drop-down control in the Advanced Command Editor. The type argument must be one of the following strings: std, msdos, script, wsl. Standard (std) is the default if the type is not specifically set.
Sub SetType
End Sub
' This method can be used to update the appearance of toolbar buttons that use @toggle:if to set their selection state based on the existence of a global-, tab- or Lister-scoped variable. You would call this method if you have changed such a variable from a script to force buttons that use it to update their selection status.
Sub UpdateToggle
End Sub
End Class
'The Control object represents a control on a script dialog; it lets you read and modify a control's value (and contents).
Class Control
' Set or query the color used for the background (fill) of this control. This is in the format #RRGGBB (hexadecimal) or RRR,GGG,BBB (decimal).
Property Get bg ' Return Type string
End Property
' For a list view control, returns a DialogListColumns object that lets you query or modify the columns in Details mode.
Property Get columns ' Return Type object:DialogListColumns
End Property
' Returns the number of items contained in the control (e.g. in a combo box, list box or list view, returns the number of items in the list).
Property Get count ' Return Type int
End Property
' Set or query the width of the control, in pixels.
Property Get cx ' Return Type int
End Property
' Set or query the height of the control, in pixels.
Property Get cy ' Return Type int
End Property
' Set or query the enabled state of the control. Returns True if the control is enabled, False if it's disabled. You can set this property to change the state.
Property Get enabled ' Return Type bool
End Property
' Set or query the color used for the text (foreground) of this control. This is in the format #RRGGBB (hexadecimal) or RRR,GGG,BBB (decimal).
Property Get fg ' Return Type string
End Property
' Set or query the input focus state of the control. Returns True if the control currently has input focus, False if it doesn't. Set to True to give the control input focus.
Property Get focus ' Return Type bool
End Property
' Set or query the control's label. Not all controls have labels - this will have no effect on controls (like the list view) that don't.
Property Get label ' Return Type string orobject:Image
End Property
' For a list view control, lets you change or query the current view mode. Valid values are icon, details, smallicon, list.
Property Get mode ' Return Type string
End Property
' Set or query the read only state of an edit control.
Property Get readonly ' Return Type bool
End Property
' For a static text control set to ""image"" mode, you can set this property to rotate the displayed image. The value provided is the number of degrees from the image's initial orientation.
Property Get rotate ' Return Type int
End Property
' Set or query the font styles used to display this control's label. The string consists of zero or more characters; valid characters are b for bold and i for italics.
Property Get style ' Return Type string
End Property
' Set or query the color used for the text background (fill) of this control. This is in the format #RRGGBB (hexadecimal) or RRR,GGG,BBB (decimal).
Property Get textbg ' Return Type string
End Property
' Set or query the control's value. The meaning of this property depends on the type of the control:
Property Get value ' Return Type string or bool or int or object:DialogListItem or object:Vector
End Property
' Set or query the visible state of the control. Returns True if the control is visible and False if it's hidden. You can set this property to hide or show the control.
Property Get visible ' Return Type bool
End Property
' Set or query the left (x) position of the control, in pixels.
Property Get x ' Return Type int
End Property
' Set or query the top (y) position of the control, in pixels.
Property Get y ' Return Type int
End Property
' Adds a new group to a list view control. Items you add to the list can optionally be placed in groups. Each group must have a unique ID.
Function AddGroup(<string:name>,<int:id>,[<string:flags>]) ' Return Type int
End Function
' Adds a new item to the control (list box, combo box or list view). The first parameter is the item's name, and the optional second parameter is a data value to associate with the item.
Function AddItem (<string:name>,[<int:value>],[<int:groupid>] or <object:item>) ' Return Type int
End Function
' This method is mainly for use with multiple-selection list box and list view controls. It lets you deselect individual items in the control while leaving other items selected (or unaffected).
Function DeselectItem ' Return Type int
End Function
' You can also specify -1 to deselect all items in the list box.
Function DeselectItem ' Return Type int
End Function
' Only applies to list view controls. By default group view is off; after adding groups with the AddGroup method, use EnableGroupView to turn group view on.
Sub EnableGroupView
End Sub
' Returns a DialogListGroup object representing the group with the specified ID that you've previous added to a list view control using the AddGroup method.
Function GetGroupById ' Return Type object:DialogListGroup
End Function
' Returns a DialogListItem object representing the item contained in the control at the specified index (list box, combo box or list view). Item 0 represents the first item in the list, item 1 the second, and so on.
Function GetItemAt ' Return Type object:DialogListItem
End Function
' Returns a DialogListItem object representing the item contained in the control with the specified name (list box, combo box or list view). This method has two names (...Label and ...Name) for historical reasons, you can use either method name interchangeably).
Function GetItemByLabel ' Return Type object:DialogListItem
End Function
' Inserts a new item in the control (list box, combo box or list view). The first parameter is the position to insert the item at (0 means the beginning of the list, 1 means the second position and so on). The second parameter is the item's name, and the optional third parameter is a data value to associate with the item.
Function InsertItemAt(<int:position>,<string:name>,[<int:value>],[<int:groupid>] or <int:position>,<object:item>) ' Return Type int
End Function
' Moves an existing item to a new location (list box, combo box or list view). The first parameter is the item to move (you can pass either its index or a DialogListItem object), and the second parameter is the new position the item should be moved to.
Function MoveItem(<int:position> or <object:item>,<int:newposition>) ' Return Type int
End Function
' Removes the specified group from a list view control.
Sub RemoveGroup
End Sub
' Removes an item from the control (list box, combo box or list view). You can provide either the index of the item to remove (0 means the first item, 1 means the second and so on) or a DialogListItem object obtained from the GetItemAt or GetItemByName methods.
Sub RemoveItem(<int:position> or <object:item>)
End Sub
' Selects an item in the control. For a list box, combo box or list view, you can specify either the index of the item to select (0 means the first item, 1 means the second and so on) or a DialogListItem object obtained from the GetItemAt or GetItemByName methods.
Function SelectItem(<int:position> or <object:item> or <string:tab>) ' Return Type int
End Function
' Selects text within an edit control (or the edit field in a combo box control). The two parameters represent the start and end position of the desired selection. To select the entire contents, use 0 for the start and -1 for the end.
Function SelectRange(<int:start> or <int:end> or <object:item1>,<object:item2>) ' Return Type object:Vector
End Function
' Sets the position of this control. The x and y coordinates are specified in pixels.
Sub SetPos(<int:x>,<int:y>)
End Sub
' Sets the position and size of the control, in a single operation. All coordinates are specified in pixels.
Sub SetPosAndSize(<int:x>,<int:y>,<int:cx>,<int:cy>)
End Sub
' Sets the size of this control. The cx (width) and cy (height) values are specified in pixels.
Sub SetSize(<int:cx>,<int:cy>)
End Sub
End Class
'The CustomFieldData object is provided to a rename script via the GetNewNameData.custom property. It provides access to the value of any custom fields that your script added to the Rename dialog.
Class CustomFieldData
End Class
'This object is provided to make it easier to deal with variables representing dates. It is obtained from the DOpusFactory.Date method as well as various properties in other objects.
Class Date ' Default Return Type date
' Get or set the day value of the date.
Property Get day ' Return Type int
End Property
' Get or set the hour value of the date.
Property Get hour ' Return Type int
End Property
' Get or set the minute value of the date.
Property Get min ' Return Type int
End Property
' Get or set the month value of the date.
Property Get month ' Return Type int
End Property
' Get or set the milliseconds value of the date.
Property Get ms ' Return Type int
End Property
' Get or set the seconds value of the date.
Property Get sec ' Return Type int
End Property
' Get the day-of-the-week value of the date.
Property Get wday ' Return Type int
End Property
' Get or set the year value of the date.
Property Get year ' Return Type int
End Property
' Adds the specified value to the date. The interpretation of the specified value is controlled by the type string:
Sub Add(<int:value>,<string:type>)
End Sub
' Returns a new Date object set to the same date as this one.
Function Clone ' Return Type object:Date
End Function
' Compares this date against the other date. The return value will be 0 (equal), 1 (greater) or -1 (less).
Function Compare(<date:other>,[<string:type>],[<int:tolerance>]) ' Return Type int
End Function
' Returns a formatted date or time string. The format and flags arguments are both optional.
Function Format([<string:format>],[<string:flags>]) ' Return Type string
End Function
' Returns a new Date object with the date converted from UTC (based on the local time zone).
Function FromUTC ' Return Type object:Date
End Function
' Resets the date to the current local date/time.
Sub Reset
End Sub
' Sets the value of this Date object to the supplied date.
Sub Set
End Sub
' Subtracts the specified value from the date. The parameters are the same as for the Add method.
Sub Sub(<int:value>,<string:type>)
End Sub
' Returns a new Date object with the date converted to UTC (based on the local time zone).
Function ToUTC(none) ' Return Type object:Date
End Function
End Class
'This object is used to display dialogs or popup menus. It is obtained from the Func.Dlg, Command.Dlg or DOpus.Dlg methods.
Class Dialog
' Specifies the buttons that are displayed at the bottom of the dialog. These buttons are used to close the dialog. The Show method returns a value indicating which button was chosen (and this value is also available in the result property).
Property Get buttons ' Return Type string
End Property
' This property uses either a Vector or an array of strings to provide a list of multiple options that can be shown to the user. The list can be presented in one of three ways:
Property Get choices ' Return Type object:Vector(string) or array(string)
End Property
' In a text entry dialog (i.e. the max property has been specified) setting confirm to True will require that the user types the entered text again (in a second text field) to confirm it (e.g. for a password).
Property Get confirm ' Return Type bool
End Property
' For script dialogs marked as resizable, this property lets you override the width of the dialog defined in the resource - although note you can't resize a dialog smaller than its initial size.
Property Get cx ' Return Type int
End Property
' For script dialogs marked as resizable, this property lets you override the height of the dialog defined in the resource - although note you can't resize a dialog smaller than its initial size.
Property Get cy ' Return Type int
End Property
' In a text entry dialog (i.e. the max property has been specified) this property allows you to initialize the text field with a default value.
Property Get defvalue ' Return Type string
End Property
' Allows you to change the default button (i.e. the action that will occur if the user hits enter) in the dialog. Normally the first button is the default - this has a defid of 1. The second button would have a defid of 2, and so on. If a dialog has more than one button then by definition the very last button is the ""cancel"" button, and this has a defid of 0.
Property Get defid ' Return Type int
End Property
' Set to True if you want a script dialog to run in “detached” mode, where your script provides its message loop.
Property Get detach ' Return Type bool
End Property
' Use this to cause the dialog to automatically disable another window when it's displayed. The user will be unable to click or type in the disabled window until the dialog is closed. Normally if you use this you would set this to the same value as the window property.
Property Get disable_window ' Return Type object:Lister or object:Tab or object:Dialog or int
End Property
' Displays one of several standard icons in the top-left corner of the dialog, which can be used, for example, to indicate the severity of an error condition. The valid values for this property are warning, error, info and question.
Property Get icon ' Return Type string or object:Image
End Property
' In a text entry dialog, this property returns the text string that the user entered (i.e. once the Show method has returned).
Property Get input ' Return Type string
End Property
' Set this property to create a script dialog in a particular language (if one or more language overlays have been provided), rather than the currently selected language.
Property Get language ' Return Type string
End Property
' In conjunction with the choices property, this will cause the choices to be presented as a checkbox list. You can initialize this Vector or array with the same number of items as the choices property, and set each one to True or False to control the default state of each checkbox. Or, simply set this value to 0 to activate the checkbox list without having to initialize the state of each checkbox.
Property Get list ' Return Type object:Vector(bool) or array(bool) or int
End Property
' This property enables text entry in the dialog - a text field will be displayed allowing the user to enter a string. Set this property to the maximum length of the string you want the user to be able to enter (or 0 to have no limit).
Property Get max ' Return Type int
End Property
' In conjunction with the choices property, this will cause the choices to be presented as a popup menu rather than in a dialog. The menu will be displayed at the current mouse coordinates.
Property Get menu ' Return Type object:Vector(int) or array(int) or int
End Property
' Specifies the message text displayed in the dialog.
Property Get message ' Return Type string
End Property
' For script dialogs this property retrieves or sets the current dialog opacity level, from 0 (totally transparent) to 255 (totally opaque).
Property Get opacity ' Return Type int
End Property
' This is a collection of five options that will be displayed as checkboxes in the dialog. Unlike the choices / list scrolling checkbox list, these options are displayed as physical checkbox controls. By default the five checkboxes are uninitialized and won't be displayed, but if you assign a label to any of them they will be shown to the user.
Property Get options ' Return Type collection:DialogOption
End Property
' In a text entry dialog, set this property to True to make the text entry field a password field. In a password field the characters the user enters are not displayed.
Property Get password ' Return Type bool
End Property
' When used with a script dialog this property lets you control the dialog's position on screen. Accepted values are:
Property Get position ' Return Type string
End Property
' By default, Opus checks the size and position of your dialog just before it opens and fixing them if they would place any of the dialog off-screen. Positioning a dialog off-screen is usually an accident caused by saving window positions on one system and restoring them on another with different monitor resolutions or arrangements. In the rare cases where you want your dialog to open off-screen, where the user cannot see some of all of it, set this property to False.
Property Get position_fix ' Return Type bool
End Property
' This property returns the index of the button chosen by the user to close the dialog. The left-most button is index 1, the next button is index 2, and so on. If a dialog has more than one button then by definition the last (right-most) button is the ""cancel"" button and so this will return index 0.
Property Get result ' Return Type int
End Property
' In a text entry dialog, set this property to True to automatically select the contents of the input field (as specified by the defvalue property) when the dialog opens.
Property Get select ' Return Type bool
End Property
' In a drop-down list dialog (one with the choices property set without either list or menu), this property returns the index of the item chosen from the drop-down list after the Show method returns.
Property Get selection ' Return Type int
End Property
' Set this property to True if the list of choices given by the choices property should be sorted alphabetically.
Property Get sort ' Return Type bool
End Property
' Lets you create a script dialog. The template property can be set to the name of the script dialog to display (as defined in your script resources), or a string that contains raw XML defining the dialog.
Property Get template ' Return Type string
End Property
' Specifies the title text of the dialog.
Property Get title ' Return Type string
End Property
' Set this property to True to make the dialog ""top level"", or False to allow it to go behind other non-top level windows.
Property Get top ' Return Type bool
End Property
' Set this property to True if you want the script dialog to generate close events in your message loop when the user clicks the window close button. You'll need to close the dialog yourself using the EndDlg method.
Property Get want_close ' Return Type bool
End Property
' Set this property to True if you want the script dialog to generate resize events in your message loop when the user resizes the dialog.
Property Get want_resize ' Return Type bool
End Property
' Use this to specify the parent window of the dialog. The dialog will appear centered over the top of the specified window. You can provide either a Lister or a Tab object, or another Dialog. If you are showing this dialog in response to the OnAboutScript event, you can also pass the value of the AboutData.window property.
Property Get window ' Return Type object:Lister or object:Tab or object:Dialog or int
End Property
' Specifies the x-position of a script dialog. Use the position property to control how the position is interpreted. After the dialog has been displayed you can change this property to move the dialog around on-screen.
Property Get x ' Return Type int
End Property
' Specifies the y-position of a script dialog. Use the position property to control how the position is interpreted. After the dialog has been displayed you can change this property to move the dialog around on-screen.
Property Get y ' Return Type int
End Property
' Creates a hotkey (or keyboard accelerator) for the specified key combination. When the user presses this key combination in your dialog, a hotkey event will be triggered.
Sub AddHotkey(<string:name>,<string:key>)
End Sub
' When creating a script dialog, calling this method creates the underlying dialog but does not display it. This lets you create the dialog and then initialize its controls before it is shown to the user.
Sub Create
End Sub
' Returns a Control object corresponding to one of the controls on a script dialog. The control is identified by its name, as defined in the script dialog resource.
Function Control(<string:name>,[<string:dialog>],[<string:tab>]) ' Return Type object:Control
End Function
' Deletes a hotkey you previously created with the AddHotkey method.
Sub DelHotkey
End Sub
' Allows the user to drag and drop one or more files from your dialog (and drop them in another window or application).
Function Drag(collection:Item,<string:actions>) ' Return Type string
End Function
' Ends a script dialog running in detached mode. Normally dialogs end automatically when the user clicks the close button or another button that has its Close Dialog property set to True. This method lets you end a dialog under script control. The optional parameter specifies the result code that the Dialog.result property will return.
Sub EndDlg
End Sub
' Displays a ""Browse for Folder"" dialog letting the user select a folder. The optional parameters are:
Function Folder(<string:title>,<string:default>,<bool:expand>,<object:window>) ' Return Type object:Path
End Function
' Returns a Msg object representing the most recent input event in a script dialog (only used in detached mode).
Function GetMsg (<string:message>,<string:default> or <object:window>,<byref string:result>) ' Return Type object:Msg
End Function
' Displays a text entry dialog allowing the user to enter a string. The optional parameters are:
Function GetString(<string:message>,<string:default>,<string:max>,<string:buttons>,<string:title>,<object:window>,<byref string:result>) ' Return Type string
End Function
' Stops the specified timer. The timer must previously have been created by a call to the SetTimer method.
Sub KillTimer
End Sub
' Restores the previously saved position of a script dialog. The position must have previously been saved by a call to the SavePosition method.
Sub LoadPosition(<string:id>,<string:type>)
End Sub
' Displays a ""Browse to Open File"" dialog that lets the user select one or more files. The optional parameters are:
Function Multi(<string:title>,<string:default>,<object:window>) ' Return Type collection:Item
End Function
' Displays a ""Browse to Open File"" dialog that lets the user select a single file. The optional parameters are:
Function Open(<string:title>,<string:default>,<object:window>) ' Return Type object:Item
End Function
' Displays a dialog with one or more buttons. The optional parameters are:
Function Request(<string:message>,<string:buttons>,<string:title>,<object:window>) ' Return Type int
End Function
' Turns a previously detached dialog into a non-detached one, by taking over and running the default message loop. The RunDlg method won't return until the dialog has closed. You might use this if you created a dialog using Create, in order to initialize its controls, but don't actually want to run an interactive message loop.
Function RunDlg(none) ' Return Type int
End Function
' Saves the position (and size) of the dialog to your Opus configuration. The position can then be restored later on by a call to LoadPosition.
Sub SavePosition
End Sub
' Creates a timer that will generate a periodic timer event for your script. The period must be specified in milliseconds (e.g. 1000 would equal one second).
Function SetTimer(<int:period>,<string:name>) ' Return Type string
End Function
' Displays the dialog that has been pre-configured using the various properties of this object. See the properties section above for a full description of these.
Function Show ' Return Type int
End Function
' Displays a ""Browse to Save File"" dialog that lets the user select a single file or enter a new filename to save. The optional parameters are:
Function Save(<string:title>,<string:default>,<object:window>,<string:type>) ' Return Type object:Path
End Function
' Used to change how custom dialogs are grouped with other Opus windows on the taskbar. Specify a group name to move the window into an alternative group, or omit the group argument to reset back to the default group. If one or more windows are moved into the same group, they will be grouped together, separate from other the default group.
Function SetTaskbarGroup ' Return Type bool
End Function
' Returns a Vars object that represents the variables that are scoped to this particular dialog. This allows scripts to use variables that persist from one use of the dialog to another.
Function Vars ' Return Type object:Vars
End Function