My sccenario is as follows:
I have an excel workbook that does a lot of stuff, like create users and such.
A part of this "create user"-procedure is to edit some info on a website.
BUT this website needs to be launched as another user which has access to it.
I have no problem controlling IE if I launch it normally with the current user. But when I launch IE as another user, I cant take control of it from Excel.
I have done a lot of googling and tried a lot of stuff.
Fx. code from the following sources:
http://www.makeuseof.com/tag/using-vba-to-automate-internet-explorer-sessions-from-an-excel-spreadsheet/
http://www.excely.com/excel-vba/ie-automation.shtml
http://www.mvps.org/emorcillo/en/code/vb6/iedom.shtml
None of which has worked in my scenario.
I found a very good workaround here: https://superuser.com/a/49462
Basically I found out that it's possible to force a loginprompt on pages using Windows Authentication, and then log in as a different user.
That means that the IE process still runs as my user, thus making it possible to take control of the window from Excel.
Related
tl;dr: How can one send a POST request in VBA by using an XMLHttpRequest within the Internet Explorer?
I'm about automating the use of page on the internet. The idea is to start from Excel to gather some data in a worksheet, then transfer these data to the internet page, click some buttons in the meantime, and thereafter work on manually.
I recorded the whole process when executed manually by the F12 Developer tools. By bringing the data into the textboxes of the internet page, some Javascript events take place which fire a POST request through XMLHttpRequest:
Now, by replicating the procedure described above in VBA (using getElementById, .click(),.value= and the like), it appears that the relevant events are not fired: no such POST request as shown above are sent to the server, and no additional masks open. This is why I wanted to omit the textbox-filling-and-clicking approach and simply replicate the POST request.
How can I do this from VBA by using the Internet Explorer?
Disclaimer: I'm aware how to send a POST request using MSXML2.serverXMLHTTP, which is described hundreds of times over the web. However, there it's always either-or: either use the Internet Explorer, or MSXML2.serverXMLHTTP. However, I need the request within the Internet Explorer.
These links looks promising |VB5| C# |
Navigate method, 4th argument |Another VB example using StrConv for byte array conversion|
It looks like you simply use the Navigate method and simply data packed into a byte array for the fourth argument. One of the above links is old but the newer link looks very similar so I think the interface has not changed much.
Do please post feedback.
I wont to pull data from a webpage on the basis of a criteria's into excel however I am unable to do so.
Website from which I wont to pull data can be logged in only via another website and not by just url.
For E.g. My site name is Elsc and to login into it I have to via another site Gatekeeper and elsc cannot be logged into in any other way.
So is there a solution to get data from such website by Macro.
Thanks in advance :)
I don't think Excel will give you this kind of control (controlling one URL from another URL). I tried to do this a long time ago; it never worked right. Can you just login to that URL and then run a simple VBA script to download the data? Also, consider using a Power Query to do this for you.
http://chandoo.org/wp/2015/08/21/import-web-data-power-query/
Every day, I have to go to an intranet website and click a series of buttons, upload an excel file to this website, and select an option from a drop down box. I am familiar with programming and am wondering what type of code or program can help us automate this daily process since it takes about 20 minutes to do this process every day.
I'm thinking that this is the same type of thing that "robots" do to create spam accounts on sites like Google, hence the need for captcha.
What do I need to know to get started on this or learn how to automate this process? We use Internet Explorer to view this intranet website service. I don't even know what this process is called or where I can find a tutorial on this.
Thanks!
EDIT: Just to clarify, the process involves loging into a system with a username and password, clicking a button, navigating to a link, uploading a file, waiting 10 minutes, then navigating to another page, entering a password, clicking another button, and then it's done.
EDIT 2: There is no captcha, but I'm trying to learn the easiest way to go through a process similar to the way a programmer would go about clicking through links, entering data into forms, etc. like a spam account creator would, only this is for legitimate internal business processes with no captcha involved.
You can automate Internet Explorer with VBScript; it's not what I would call a pleasant process, but in my experience it can be made to work quite well.
Consider the following script which automates a website login, half-inched from here:
Set IE = CreateObject("InternetExplorer.Application")
set WshShell = WScript.CreateObject("WScript.Shell")
IE.Navigate "http://mylogin.page"
IE.Visible = True
Wscript.Sleep 6000
IE.Document.All.Item("fld_userName").Value = "adley"
IE.Document.All.Item("fld_password").Value = "password"
WshShell.AppActivate "IE"
WshShell.SendKeys "{ENTER}"
The only part I can see being really tricky would be choosing the file to upload; for security reasons, it may not be possible to script an <input type="file"> control this way -- of course, this being Internet Explorer, I suspect it'll work just fine.
It's been so long since I did anything like this that I can no longer find real documentation on it, but a good place to start would be Google; most of what you're doing is just filling and POSTing forms and following links, from the look of your question, and probably won't be all that hard to do by just grabbing bits here and there and modifying them to suit your situation.
I have few simple Xpages, where i test and learn the newest features in Domino 8.5.3.
Now, after some latest changes somehow i'm not able to delete Documents. The Application asks me for the User Name and password, which i enter and which are correct. However, nothing happens (well, the system thinks few seconds over) and i'm asked for my credentials again... and again.. If i press "cancel" -> i got the expected result -> error 401.
The strange thing as well, if even i give for the "anonymous" the editor rights with the "delete documents" checked, i'm still asked for the credentials...
Well, i think I need now some ideas and tips where can i look after in order to solve the "undeletable documents" problem.
The "Delete" button is made using the Simple Action "Delete Selected Documents".
Update: After looking into the logs (thanks Simon O'Doherty for the hint below!) i found out the following message
28.02.12 19:20: Exception Thrown
com.ibm.xsp.acl.NoAccessSignal: NotesException: Notes error: Document locking is enabled. You must lock the document before deleting.
After removing the setting "Allow Document locking" everything works fine.
The next question, however, and it seems to be intresting, if i want to use this setting - how to make the standart actions (it looks like at least "Delete Selected Documents" has some problems) work properly ?
Or do i have to use SSJS only ?
In the ACL settings. Click Advanced tab. Check that "Maximum Internet name and password access" is at least a level that allows you to edit documents.
May need to restart your browser for that to be registered.
If it is still an issue at that point then the following Debug may give more hints.
Check the XPages logs in the IBM_TECHNICAL_SUPPORT folder of the server.
Check the elements on the page are not being pulled from another location that would require access.
Check for Authors/Readers fields.
The following debug on the server will allow you to see when an ACL call is made, what is asked for and what it got.
Warning This is very verbose debug, so it should only be activated for the test. Also do not paste the results anywhere externally without first sanitizing. (as it would be confidential to you).
DEBUG_THREADID=1
DEBUG_SERVER_ACL=2
I have also seen this behaviour in our application.
The issue is caused by the "Allow document locking" option.
Either you do not need this feature; then just uncheck in the application properties. If you intend to use the feature, you have to lock the document in your code prior to deleting it.
Add a execute script simple action before delete simple action and write the following code
var doc:NotesDocument = currentDocument.getDocument();
doc.lock();
or
dataSource.getDocument().lock();
It might be as easy as:
- check your ACL. Do you have delete rights? Default is off
I need to display pages in a tutorial fashion. I looked in to netsupport, beamyourscreen and other possibilities but, I do not want the viewers to download anything. I cannot use gd / send screenshots due to audio / video instructions embedded in some of the pages.
Basically, I need the ability to "refresh" a users browser window to a different page via an interface on my end. Whether via a form submission, javascript or any other type of "controller" that allows me to change the page on the viewers browser. PERL preferred but, PHP / javascript whatever works and is cross browser. I set up a simple javascript page forward timer that "works" but, page load times and conversation interruptions are a huge factor.
The entire tutorial website will be developed around this ability.
I was looking in to curl / cron / wget methods but, found little information.
I have seen forum and chat scripts that basically perform a similar task but, there must be a simple(ish) solution in leau of hacking up another script to suit my needs.
I do not want others to control the pages either. The site really, only needs to be accessable during the tutorial however, It "could" remain web accessable as long as user interaction was normal unless (being controlled).
The initial site concept is based on instructing people how to properly introduce new pets into a home. Will be operated by a veteranarian that saved my pets life. I wanted to give something back.
Possible? I really appreciate simple examples etc...
You have no other way but to keep polling the server for "instructions" using javascript. No, you can't send nothing to the end user browser, neither curl nor wget.
Mainly, you'll have to set up a simple request/response protocol between the browser and the server.
If you want to go deeper, you can use something like cometd/meteord/etc. If not, a hidden iframe that reloads himself and receives pages with javascript code for the needed actions can do the trick.
Another alternative.
With javascript dopolling and single character flatfile. Have a simple one character flatfile with a single var. Write it in perl (it is faster and uses less resources than php). The parent script calls a javascript variable in a flatfile. It hits the flatfile and goes wherever the var sets it. The flatfile is written to by the controller. Done.
I guess you could also rename an empty flatfile and use that as the controller. I am usure which is faster, open and read a specific file or hit the directory and return the file name. On the controller side, opening and writing to a file vs renaming a file. Maybe they counter each other in resources and time?
This way the site can act as a normal site. When you want to have remote users see a "presentation" (automatically being shown the site pages at the controllers pace), the controller activates polling and tells the viewers to push a start button. This allows a remote instructor to load pages for the viewers at his leisure.
It is a simple solution that works with nothing really sophisticated going on. No frames are needed either. Just need javascript enabled.
Any better suggestions are welcome!
It occurred to me that what you might want to use is HTML Push technology. Check out the wiki, they have several links. I have never used it myself