While we appreciate comments from our users, please follow our posting guidelines. Have you tried the Cyotek Forums for support from Cyotek and the community?
Styling with Markdown is supported
10 January 2018 Reply
I love your code above - but i need the code to be in VBScript. Not sure how i can save the above as .vb and then convert it to .vbs (Vbscript code)? Any help?
Thanks for the question. Unfortunately however, this isn't easily achieved. Although there are many C# to VB.NET conversion utilities out the (the oldest one I know of is http://www.developerfusion.com/tools/convert/csharp-to-vb/) and the above code can be used in VB.NET, it isn't possible to do this from VB Script via pure code. VB Script is from the VB6 era so objects like Screen don't exist. The main sticking point is that VB Script doesn't support p/invoke, so you wouldn't be able to make API calls.
It has been many years since I've used VB Script so I might be wrong in the particulars, but as far as I'm aware the only way to make this would would be to make a COM DLL (you could create one using C#, VB.NET, VB6 or probably several other languages) which can handle the actual capturing of screenshots using p/invoke (or whatever features the language itself offers) and calling that from VB6.
Personally I would probably just write a command line tool and call that from VB Script or a batch file rather than deal with COM again.
Hope this helps!