Jump to content

RESOLVED: Ampersand (&) inconsistent with _IECreate/Navigate -- IE FAULT!!


Recommended Posts

Good evening/afternoon/morning to all you lovely people where ever you may be!

I'm writing a script for use at work, this is a small part of it which isn't functioning correctly. It is used to search a network monitoring system (Solar Winds). The user gets a gui, enters a search string, selects one of two radio buttons (to determine if its node name or ip address) then clicks ok. The results are concatenated with the rest of the url then passed to IE for the NMS web interface.

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <IE.au3>
$SolarWinds_SEARCH_Gui = GUICreate("", 148, 166, 189, 124)
$SolarWinds_SEARCH_Title = GUICtrlCreateLabel("Solarwinds Search", 24, 16, 92, 17)
$SolarWinds_SEARCH_Input = GUICtrlCreateInput("", 16, 40, 113, 21)
$SolarWinds_SEARCH_NNrad = GUICtrlCreateRadio("Node Name", 32, 72, 81, 17)
$SolarWinds_SEARCH_IPrad = GUICtrlCreateRadio("IP Address", 32, 96, 81, 17)
$SolarWinds_SEARCH_Btn_OK = GUICtrlCreateButton("OK", 16, 128, 51, 25)
$SolarWinds_SEARCH_Btn_Cancel = GUICtrlCreateButton("Cancel", 80, 128, 51, 25)
GUISetState(@SW_SHOW)

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
GUIDelete($SolarWinds_SEARCH_Gui)
Case $SolarWinds_SEARCH_Btn_Cancel
GUIDelete($SolarWinds_SEARCH_Gui)

Case $SolarWinds_SEARCH_Btn_OK

$SolarWinds_SEARCH_NodeString = "http://server:port/Orion/NetPerfMon/Resources/NodeSearchResults.aspx?Property=Caption&SearchText="
$SolarWinds_SEARCH_IPString = "http://server:port/Orion/NetPerfMon/Resources/NodeSearchResults.aspx?Property=IP_Address&SearchText="
$SolarWinds_SEARCH_UsrInpt = GUICtrlRead($SolarWinds_SEARCH_Input)
$oIE = _IECreate("www.google.com")

If GUICtrlRead($SolarWinds_SEARCH_NNrad) = $GUI_CHECKED Then
GUIDelete($SolarWinds_SEARCH_Gui)
_IENavigate($oIE, $SolarWinds_SEARCH_NodeString & $SolarWinds_SEARCH_UsrInpt, 1)
ElseIf GUICtrlRead($SolarWinds_SEARCH_IPrad) = $GUI_CHECKED Then
GUIDelete($SolarWinds_SEARCH_Gui)
_IENavigate($oIE, $SolarWinds_SEARCH_IPString & $SolarWinds_SEARCH_UsrInpt, 1)
Else
MsgBox(4096, "Error!", "Please select either Node Name or IP")
EndIf
EndSwitch
WEnd

The problem is, it only works sometimes - about 60% ;)

Every time the correct url is passed to IE (see pic1.jpg post-56242-0-22717300-1339868428_thumb.j ) however about 40% of the time part of the url is dropped (see pic2.jpg post-56242-0-76454100-1339868459_thumb.j )

I initially wrote the script using _IECreate, the above I modified to use _IENavigate - there doesn't seem to be a difference.

Given that the correct url is passed to ie I don't think this is an AutoIT issue (can anyone confirm?). What I don't understand is that IE appears to start loading the url, but then drops everything after (and including) the ampersand? It isn't even as though it is navigating to one of the variables - the ampersand is part of the first variable??

Why would this happen? Any suggestions for overcoming it?

Thanks in advance for any replies :)

Edited by 3mustgetbeers
Link to comment
Share on other sites

OK, I have tried the ShellExecute method which proves just as unreliable. Alternative browser isn't an option so I haven't even explored this avenue. I'm running XP SP3 with IE8, rolled back to 7 & it works even less frequently. Anybody any ideas at all other than opening IE and using control send to the address bar?

Cheers

Link to comment
Share on other sites

Ok, this definitely appears to be a fault with IE (or our web GUI?) – quite strange behaviour. The simplest of tests has now proved this – I opened IE & pasted into the address bar the url: "http://server:port/Orion/NetPerfMon/Resources/NodeSearchResults.aspx?Property=IP_Address&SearchText=1.2.3.4". The bottom of IE shows that it is waiting on this address. However when the page loads the url has been changed to “http://server:port/Orion/NetPerfMon/Resources/NodeSearchResults.aspx?Property=IP_Address”

I have absolutely no idea why this would be at this stage – I can see the correct URL after pasting, it doesn’t load a page then redirect; so at the minute I’m a bit stuck. However, I can say that this is nothing what so ever to do with AutoIT! I guess that at least narrows down the search! I suppose testing with another browser is now the next logical step – if it happens in Firefox then its something on our box (please no!! haha!)

Mods, I guess this can now be closed/resolved - not sure if I can do this myself??

Edited by 3mustgetbeers
Link to comment
Share on other sites

  • Moderators

3mustgetbeers,

Edit the first post and select the "Use Full Editor" option - then you can edit the title. ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...