The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
|
|
Specify window size when launching Web browser?
Posted: 06 Nov 08 5:16 PM
|
Is it possible to launch a web broswser from a SLX LAN script and pass to the browser a window size & position?
The customer wants to open a website and easily move back & forth between the website and a SLX input view. The web browser should not cover the portion of the screen where the input fields are, so we want to control the size & position. |
|
|
|
Re: Specify window size when launching Web browser?
Posted: 07 Nov 08 1:58 AM
|
If you know that JavaScript is enabled, you could just code the URL as a series of JS commands, like this:
javascript:resizeTo(950,400);moveTo(5,5);document.location.href='http://www.saleslogix.com';
That should work with the WebOpen() API, but I haven't tried it in a while.
Figuring out where to put the window is another story. In the more recent versions of SLX, you can get the main SLX window's size and position from the Application object, but you might not be able to determine things like how many toolbars are being displayed, and whether or not the NavBar is sitting on the left side of the window where it usually is... but you could probably come fairly close, though. Just remember, I have complete confidence in you! |
|
|
|
Re: Specify window size when launching Web browser?
Posted: 07 Nov 08 9:44 AM
|
Originally posted by John H. Hedges
If you know that JavaScript is enabled, you could just code the URL as a series of JS commands, like this:
javascript:resizeTo(950,400);moveTo(5,5);document.location.href='http://www.saleslogix.com';
|
|
Very clever  |
|
|
|
Re: Specify window size when launching Web browser?
Posted: 07 Nov 08 9:55 AM
|
If you're OK with making this an IE only solution (and John's clever idea doesn't work), then this can definitely be done using IE automation.
Something like this (not tested code):
Dim ie Set ie = CreateObject("InternetExplorer.Application") ie.Toolbar = False ie.AddressBar = False ie.Height = 300 ie.Width = 300 ie.Navigate "http://www.slxdeveloper.com/" 'or get the doc to write to it directly via ie.Document 'etc |
|
|
|
Re: Specify window size when launching Web browser?
Posted: 07 Nov 08 11:57 AM
|
Since the input fields are on the left side of a large (legacy) custom input form, if I can make the brower appear on the right side of the screen and save the user the hassle of moving & resizing the browser, that would be sufficient
So, assuming a typical user screen is 1024 pixels wide, can I do a moveTo(512,5) or ie.Left = 512 ?
|
|
|
|
Re: Specify window size when launching Web browser?
Posted: 07 Nov 08 1:49 PM
|
Sure, that should work. If you wanted to get really fancy with it, I think the Screen object is available in both JavaScript and VBscript... so in VBScript you could do something like Int(Screen.Width/2), so you wouldn't have to assume anything about the monitor size/resolution.
Just don't make the browser window jump around the screen every few milliseconds at random - people hate that! |
|
|
| |
| |
|
Re: Specify window size when launching Web browser?
Posted: 13 Nov 08 1:04 PM
|
Originally posted by Dan Carvin
One more question: Do I need a
set ie = Nothing ?
Or are the resources released when the users close their browser?
|
|
You should set your reference to nothing so you're no longer holding it, so yes, set it to nothing. |
|
|
|
Re: Specify window size when launching Web browser?
Posted: 13 Nov 08 2:48 PM
|
Sorry, I shouldn't post things without trying them myself first... If you're doing this from a SalesLogix VBScript, you'd use this:
Application.Environment.DesktopWidth
You should see all the properties for Application.Environment via Intellisense when you type it in - you can get the SLX Client window's position/size too, and also the PixelsPerInch/ThemesEnabled properties, which are sometimes useful for precise positioning of controls. |
|
|
|
Re: Specify window size when launching Web browser?
Posted: 14 Nov 08 9:54 AM
|
One more complication with this...
This customer typically runs SLX from a Citrx server where the citrix Window runs SLX only. My dev & testing environment for this customer is through Citrix, but I have access to the whole desktop. The customization we're discussing here works in my test environment, and for a user who runs SLX on his local desktop. But for another user in an SLX-only Citrix window, we get a general error referring to the line:
Set ie = CreateObject("InternetExplorer.Application")
However, clicking a URL on the web field on the account detail, the site opens. Also if I use
Set objShell = CreateObject("Shell.Application") objShell.ShellExecute strUrl
in my customization that works also, although I don't know how to control the window size & position. The difference is that the latter two open IE in the local desktop, not inside the Citrix session. It looks like Citrix runs in the One-Ap mode, it won't allow a CreateObject for another application.
So is there a way around this? Can a SLX script in a Citrix session open IE on the local desktop AND set the window size & position? |
|
|
|