VBS script issue loading a IE frame without address bar - vbscript

I've got a very strange issue.
I'm trying to open a URL through Citrix called through a VBS script.
Here is the code:
Set oIE = WScript.CreateObject("InternetExplorer.Application")
oIE.ToolBar=0
oIE.Navigate("https://example.com/sites/example/SitePages/Home.aspx")
oIE.Height=800
oIE.Width=1500
oIE.Left=0
oIE.Top=0
Do While (oIE.Busy)
Loop
oIE.Visible=1
This loads fine for most users but on two specific users the script fails to work and just displays the command prompt. At that point no other user can load the script until that user either closes the command prompt or waits for it to time out.
I'm calling the script using the following:
c:\windows\system32\cscript.exe \\servername\share\script.vbs
I tried copying the user accounts so they have the same permissions but it loads fine on the test account.
I'm trying to achieve a URL 'published application' which loads an IE frame with address bar. If there's a better solution than the above code please let me know.
I have seen an error once which said it failed to call InternetExplorer.application
Hope this helps.
Kind Regards,
Scott

Resolved the issue :)
Turned out that the Internet explorer browsers for each user needed resetting to defaults, this sorted the issue for both users.
Hope this information helps someoene.
Scott

Related

Google sheet script access lost after new API - error trying to use Tools -> Script editor

I have just returned to do some maintenance on Google sheet scripts I wrote last year and I can't get in to debug them from the Sheet's Tools -> Script editor command. When I try, Google opens up the standard "Access Denied" - "Request Access" error page. The same problem seems to affect every Sheet I have with an embedded script. I suspect this is a side-effect of being upgraded to the new scripting API.
I can still run the scripts normally and they operate as expected.
I can open the scripts from the new API Console and I can edit them successfully from there. However if I try to run the scripts with the debugger from the API console, I get an immediate error when the script tries to access the Sheet data it looks like the SpreadsheetApp.getActiveSpreadsheet is not returning a useful value (debugger says "select active spreadsheet first"). I would guess that the same problem that prevents the Script editor working from the Sheet is also preventing the API debugger working properly.
I am sure the code itself is fine as it works without the debugger.
Surprisingly, just after posting this question I seem to have found the answer.
It appears that the Google Sheet's Tools -> Script editor command used my default (home) Google account, even though I was logged into my work account and had successfully loaded the Sheet which I can only access from my work account.
Problem resolved by logging out of both my Google accounts and logging back in with my work account. I think this must be some sort of Google Bug.

VBA Control of IE - In explicable behavior

Bizarre problem.
I am using Excel VBA to control IE and download data from web sites. Pretty vanilla.
I experience an error that only happens when I am running Windows 8.1 and IE 10. On a second PC, which is running Windows 7 and IE 8, the code works fine.
Here is the behavior.
I call the following code to open a web page:
Set appIE = CreateObject("InternetExplorer.Application")
With appIE
.navigate sURL 'Where sURL is a valid web address
End With
This works fine, and opens a browser.
Shortly afterwards, I call the following:
With appIE
.navigate sURL'a different valid web address
End With
An error message pops up at the .navigate line. The message says:
Run-time Error '-2147024726(800700aa)'
Method 'Navigate' of object 'IEWebBrowser2' Failed
I have looked up this error message and the only thing that I can find is that it may relate to spyware. But I completely reinstalled the OS and all apps on the system and the same thing happened.
Another very strange phenomenon is that if I put a trace point in-between the above two sections and pause the code, then manually start the code again, everything works fine. But if, instead of me putting in a trace point I put in a wait loop, I get the same failure. That is, if I manually pause and then resume the code, the code works, but if I automate a pause and resume, the code does not work.
As you consider this situation, please remember that everything works fine under Windows 7 and IE 8, and everything works fine if I manually pause and restart.
Does any of this make sense?
1- Please Check sURL (if you check, please check again compiled folder)
2- Delete WebBrowser Control and Add New
Me forget copy original file App.Path + "\error.html" and see this problem.

Watir, Automation on Windows 7 with IE8

I am trying to run watir scripts on Wndows 7 on IE8 as administrator.
Here is problem description:
Problem was with below statement(popup windows)
popup = Watir::IE.attach(:url, /ContactDetails/)
and Error message was Unable to locate the url(ContactDetails)
The issue seems to be that when there already exists an instance of IE8 that was opened with administrative privs, Watir won't see any other IE8 windows that are being run as admin, including ones it opens itself.
Fix that i have been doing:
Turn off User Account Control (set to the lowest setting). Go to Control Panel->System and Security->Action Center->Change User Account Control settings, and drop the slider to the lowest setting.
But this is not a permanent fix, i have to change the windows 7 settings every day to run my automation script.
Can anyone help me finding out the permanent solution ?
As far as I know, watir-webdriver does not have IE class and attach method.
Have you tried to attach via the title of the page? for example:
browser2 = Watir::IE.attach(:title, "Google")
if the browser you wanted to attach to was Googles home page.
Look at the source code and
put whatevers inbetween the title tags on your page.
Google

Start Internet Explorer 8 in a separate process using vbscript

Due to the recently added "feature" in IE8 where new windows are automatically associated with a single session, some of our code is behaving erratically.
This is because a separate app would launch a new IE window when it was activated, and once the user was finished, close the window. This worked fine in IE7 because the session information in the windows stayed separate. However in IE8, since the session is shared among IE windows, we find that the "pop up" app would corrupt the session on the first app.
I have read about the nomerge switch, so that is a workaround, but I was wondering if there was a way of working the solution into the "CreateObject" of vbscript; i.e:
Dim ieWin As Object
Set ieWin = CreateObject("InternetExplorer.Application")
Is there a way of sending parameters when calling the CreateObject function?
No, there's no way to use COM to create an IE instance that specifies this behavior (or any of the others, e.g. InPrivate, No Add-ons, etc). The only thing you can do is create an automation instance that defaults to MediumIL using the CLSID provided for that purpose. http://blogs.msdn.com/b/ieinternals/archive/2011/08/03/internet-explorer-automation-protected-mode-lcie-default-integrity-level-medium.aspx
If you have control over the web application you are loading with your IE window you can set it's session to "cookieless" (http://msdn.microsoft.com/en-us/library/aa479314.aspx) which will avoid the issues you're having with multiple instances.
The solution we ended up going with, although it's more a work around than anything else - was assigning a new url to the popped up window.
Previously, it worked as follows:
Call centre agents would be using our internal app for other duties
e.g. "http://internalsite/somepage.faces" on a day to day basis.
When they got a phone call, a third party app would fire up
"http://internalsite/customerdetails.faces". This caused the issues mentioned above.
The solution we went with:
We assigned "http://internalsite/customerdetails.faces" it's own url e.g."http://customerdetailminisite/customer.faces".
This way the call center agent could keep their main window open for other stuff and still be able to handle calls when they came in.

Create a user in Active Directory from an Infopath form

I've been searching the web for a while now and still can't seem to find anything useful on this topic.
What I am trying to create is a button in my Infopath form that will create a user account in Active Directory. The code will need to pull through information stored in the fields of the Infopath form.
I have chosen to use Visual Basic, as I believe that is a good language scripting with AD.
I have successfully run this code:
Sub CTRL1_12_OnClick(eventObj)
MsgBox "Output: "
End Sub
which returns: 'Output: ' in a VB dialogue box when I click on my infopath button. However, when I try:
Set objOU=GetObject("LDAP://OU=People,OU=contoso,DC=contoso,DC=com")
Set objUser=objOU.Create("user","CN=Linda Mitchell")
objUser.Put "sAMAccountName","linda.mitchell"
objUser.SetInfo()
All I get is an error message in Infopath:
The following error occurred:
ActiveX component can't create object:
'GetObject' File:script.vbs Line:14
When I put the same code in to notepad, save as a vbs file and then execute is runs fine and create a user in active directory, what I don't understand is why when I run the same code it doesn't work.
I would recommend you check out Richard Mueller's web site - he has tons of VBScript code to do all sorts of AD stuff.
Here's a link to a page showing how to create users - is that of help?? I'm not much of a VBScript programmer, but I know Richard's stuff is usually very good and useful.
Here's his entire list of free VBScript code for you to go rummage about!
I have now found out what the problem was. I needed to set the form to 'full trust' Tools>form options> Security and Trust. I also had to sign the form with my certificate.
Now I am able to run the code from that button.

Resources