How would you automate logging into a website and downloading a page using vbscript?
Using the MSXML.XMLHTTP-object to first do a POST to login and then add the cookie-headers to a GET request.
As a quick and dirty solution, you could use a Shell object with SendKeys and Run as demonstrated here. These functions are quite powerful for those situations where you just can't the right object or library to use...
Well the script (given on link )works fine if you open the notepad and don't change the focus to other window.
If you change the focus above script doesn't work.
Related
I am very much glad if anyone help me. am fairly new to Unix scripting side. I am trying to get into one url, but before that am getting one popup window(asking for customer details). So, i need to block/disable/ auto close the popup window. Please help me with the command
In Unix environment shell command plays differently. It can launch your browser but it can not set utility inside a browser application. You need to fix it inside your browser window by using tool option. Just search in google like how to block popup in yourbrowserName.
I want to write an app that displays the default Windows Properties sheet, I can't find much info on doing it the normal programmatic way, so I'm thinking maybe shell out to a command-line call; does anyone know the Windows command-line to call up a file's property/details window? Not having any luck searching for it.
This window here:
In a general sense, there are two methods for going about this. How you specifically accomplish it (i.e. PowerShell, C#, etc) is up to you.
Call the ShellExecute function on the file with the PROPERTIES verb.
Call the SHObjectProperties function on the file.
Examples of both can be found here in AutoIt: http://www.autoitscript.com/forum/topic/118673-open-a-files-properties-window/
It appears that there IS no direct command-line call that can do this, so I whipped up a quick little VBScript to do it, since it appeared to be the quickest and easiest way to achieve the end result (at least for my specific need).
The VBScript simply sends the Windows Shortcut Alt + Enter; so, when a file is highlighted it'll automatically use that file as the one to send the shortcut to.
For anyone else who may want to do the same, just paste the following into a new text file and save it as a .vbs file:
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.SendKeys "%{ENTER}"
For anyone interested in an even better solution, I ended up writing a small command-line app in VB.NET to do this, here's a link to it's full info + the source code: https://geekdrop.com/x/props
Lets say in Internet Explorer you're calling the script, which resides on a network share via
file://///server/path/to/script.vbs
But that script has arguments. How to pass it those arguments? If this is not possible is there another Windows scripting language that supports this? Thanks
I know you ask to do this from Internet Explorer, but have you consider HTML Application (see Wikipedia) by renaming your web page from filename.html to filename.hta? That way your HTML page will run with full privileges and any SCRIPT you wish to embed in it will have full privileges.
The only thing that looks a bit like what I'm trying to achieve is this, but this works only for IE... for firefox I found that information, so is it not possible to open tabs, just new windows?
And the attach method is accessing only already OPEN tabs/windows... Is there a way to decide to open a specific link in a new window/tab? I searched in the documentation, but I didn't find such a function...
Ok thats not a solution but a work-around:
I switch to ruby mechanize, is quite different to use, but allows to do multithreading and everything without a visible browser window...
How can I use multiple keys in WSH Script like (ALT,CTRL,DELETE)?
How can i take a screenshot of an application and paste it in MSWord using WSH SCript?
Using SendKeys, you can't. I told you so.
Regarding sending multiple keys - please read the documentation on SendKeys() on MSDN. It's not hard to find out.
Maybe there is an ActiveX component somewhere that can take screen shots for you, but using vanilla Windows scripting, this cannot be done.
Yeah I think like Tomalak said, what you're trying to do will most likely involve invoking an ActiveX component using the CreateObject command.
I'd advise against it though, usually when you hit the point where your script is trying to invoke applications (Word) and take screenshots... it's time to invest in some development software (Visual Studio or something) and write an actual application.
If you're totally set on it though, DevGuru has a decent reference page for the CreateObject command.
https://social.technet.microsoft.com/wiki/contents/articles/5169.vbscript-sendkeys-method.aspx
It says that to do something like "Alt F5", to do "% {F5}"
To do Ctrl Alt Delete, you have to do "^ % {DEL}"