SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 733 | Next

David A. Karp

"Windows Vista Annoyances: Tips, Secrets, and Hacks"


You can also place a shortcut to the script in your Send To folder, which
eliminates the .vbs filename extension that would otherwise appear in
Explorer??™s Send To menu.
In either case, when Windows executes the script, the names of the input
file(s) are accessible as command-line parameters, one for each filename.
The following example script displays the names of all the files and folders
drag-dropped on the script icon:
Report = ""
Set Arguments = WScript.Arguments
For i = 1 to Arguments.Count
Report = Report + Arguments(i - 1) + vbCrLf
Next
Msgbox Report
The script starts off by clearing the Report variable, and then borrows some
code from the CommandLine function listed earlier* to initialize the Arguments
object and determine the number of dropped files. Next, a For...Next
* It??™s actually possible to use the CommandLine function here instead, but doing so would make the
script more cumbersome. And exactly who are you going to impress with a cumbersome script?
536 | Chapter 9: Scripting and Automation
structure runs through the arguments, adding each one to the Report variable,
followed by a linefeed (using vbCrLf, a handy built-in constant containing
carriage-return and linefeed characters). Note that the Arguments array is
zero-based (the first item is Arguments(0), the second is Arguments(1), and so
on), so the (i - 1) part is needed to compensate. Lastly, a Msgbox command
is used to display the list of dropped files.


Pages:
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
hotel jelenia góra Russian bride Free English grammar and study guid powiekszenia wielkoformatowe counter strike 1.6