Jump to content

3mustgetbeers

Active Members
  • Posts

    74
  • Joined

  • Last visited

Everything posted by 3mustgetbeers

  1. Danyfirex Mate, that works a treat! Thank you very much :o) 3MGB
  2. Ok, Rebooted, no different. Upgraded to IE11; my original script msgbox now both return null values; previously it returned "Email or Customer ID" for username (the place holder) and null for password. BUT, the script moves on and the 2 fields are now populated. If I try your version, the msgbox are as expected (i.e. Some_Username & Some_Password".) So editing the field means it reads both. But... when I change the script so that the U & P variables have the correct values, it tries to log me in but says a username & password are required. They show in the field, I can click into each field, type a single character at the end of what the script inputs and then backspace out that single character and click "Log in" and it works fine! So the credentials in the script are right, but the page seems to think the field is empty!? So a step further (all 3 inputs work) but not sure why the page won't accept the values the script inputs
  3. Danyfirex - thanks for the reply & trying it out! And really!? I am not sure if this is good news or bad news haha! Do you mind me asking your OS & IE version? I am Win7SP1, IE9 More importantly, any idea why it wouldn't work for me
  4. Good evening. I am frustratingly being foiled by a simple web login script. The username and button click work fine, but obtaining the password field is for some reason not working (probably because I have the incorrect value!). I have tries substituting the _IEGetObjById with _IEGetObjByName, however both fail. I know it is not getting the field name as opposed to not writing to it due to the MsgBox contents. Can anyone advise what I a doing wrong - i.e. if both usrnm & psswd were not being written to it would be obvious, but the fact that it finds one and not the other is baffling me. Here is my code: #include<IE.au3> $IE =_IECreate("https://my.ovoenergy.com/login") $Username = "Some_Username" $Password = "Some_Password" $Username_Field = _IEGetObjById($IE,"username") $Password_Field = _IEGetObjById($IE,"password") $Login_Button = _IEGetObjById($IE, "enter") ;Open Browser and wait until Browser loaded _IELoadWait($IE) msgbox(0,"By ID Username:",$IE.document.getElementById('username').value) msgbox(0,"By ID Password:",$IE.document.getElementById('password').value) ;Set Inputs sleep(2500) _IEFormElementSetValue($Username_Field,$Username) sleep(2500) _IEFormElementSetValue($Password_Field,$Password) sleep(2500) _IEAction ($Login_Button, "click") I will be looking to ditch the sleep commands as well as the MsgBox when working, these are just me testing/debugging my work. In terms of the element; here is the Username: <input class="form-control ng-pristine ng-scope ng-invalid ng-invalid-required ng-touched" id="username" name="username" placeholder="Email Address or Customer ID" ng-model="data.username" required=""> And here is the password: <input class="form-control ng-pristine ng-scope ng-invalid ng-invalid-required ng-touched" id="password" name="password" placeholder="Password" ng-model="data.password" required="" type="password"> Any help is much appreciated :S Thanks in advance for any replies & help - and merry Christmas! 3MGB
  5. Thanks both, further reading for me
  6. Hi Karlkar, Thanks for that, you're quite right, amending the form name to "gbqf" makes this work. Out of interest, is it possible to do a partial match on the form name - in this case, for example "gbq*" ?? Thanks again
  7. Hi all, Just trying to get to grips with the IE UDF but struggling a little All I want to do is populate an input box, for example google. I am looking at the examples and came across "_IEFormSubmit" in the help file; and specifically the example "_IEFormElementGetObjByName". When I run this example script Google opens but nothing is searched for. The code is: #include <IE.au3> Local $oIE = _IECreate("http://www.google.com") Local $oForm = _IEFormGetObjByName($oIE, "f") Local $oQuery = _IEFormElementGetObjByName($oForm, "q") _IEFormElementSetValue($oQuery, "AutoIt IE.au3") _IEFormSubmit($oForm) And the console errors are: --> Press Ctrl+Alt+F5 to Restart or Ctrl+Break to Stop --> IE.au3 V2.4-0 Warning from function _IEFormGetObjByName, $_IEStatus_NoMatch --> IE.au3 V2.4-0 Error from function _IEFormElementGetObjByName, $_IEStatus_InvalidDataType --> IE.au3 V2.4-0 Error from function _IEFormElementSetValue, $_IEStatus_InvalidDataType --> IE.au3 V2.4-0 Error from function _IEFormSubmit, $_IEStatus_InvalidDataType As I say, I am just really getting started with the IE UDF so I'm at a bit of a loss to this, can anyone advise why the example isn't working for me - I haven't changed anything. And also, does anybody have a simple script that will perform a Google search just to get me started? Thanks! 3mgb
  8. 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??
  9. 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
  10. 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 ) however about 40% of the time part of the url is dropped (see pic2.jpg ) 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
  11. Ah! ControlGetText Thanks alot to both of you!
  12. Hi guys, I'm writing a script in which I want to read something from a GUI (??). Its not one I create - so GUICtrlRead doesn't work; I'm trying to read the connection code on GoToAssistHelpAlert gui. I just don't know how to read the input box I'm sure I have done it before, but can't remember how!? I can't even think of what to search for! The only thing I know they are called is gui's - but search "autoit read gui" and you get steps for reading a GUI you create? Please can someone tell me what to search for - or the function I need to use The item I am trying to read is in ("Code Management - GoToAssist", "[CLASS:Edit; INSTANCE:2]") - btw... Thanks!
  13. water That works fantastic, thanks very much! 3mgb
  14. I may be being a bit supid, but I keep getting a syntax error line "For $iLine = 1" Am I missing something?
  15. Thanks water! An email needs to be sent, via Outlook, to every line manager in the spreadsheet; so if there are 7 leavers this month; all 7 line managers will receive an email containing their direct report & leave date
  16. Hi all, I have an excel spreadsheet consisting of 3 columns with the headers being "Employee Name" "Line manager name" & "Leave Date". These are in A1, B1 & C1 respectively. I am trying to email each line manager to say something along the lines of; “$Employee has left the company on $Leave_Date. In order to delete there is account we require a delete user form. This can be found here. Please complete the form and return it to the IS Service Desk and we will remove the account. “ Would it be possible (and a good approach) to read each column to its own array, then call them in separate emails – i.e. 1 email per line manager? If so, how do I go about telling _ExcelReadArray() to stop at the last blank cell in the column? And more importantly, how do I split this array down into single cells to use in seperate emails?? Thanks in advance for replies, 3mgb
  17. M23 Ahh! Never heard of accelerator key before but yes, worked a treat! Cheers!
  18. Thanks for the replies! Water; I've replaced with WinActive; however it does the exact same thing Admiral; I was under the assumption that I needed the _IsPressed so the gui knows when enter is pressed - or is there another way to do this?? Cheers!
  19. Hi, In the script I have, when you left click on the tray icon a gui is shown. The user enters a postcode into the gui & presses enter; an ini file is read for a corresponding value, copied to the clipboard and then hides. This all works great. The problem I have is that after pressing enter to complete the function as highlighted above; whenever the user presses the enter key, the function still runs. This is no good as it pretty much renders the clipboard unusable. Anyway, here is the code I have: #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Include <Misc.au3> #include "constants.au3" #Include <GuiToolBar.au3> #include <Array.au3> Global Const $INI_Path = "" Opt("TrayOnEventMode", 1) Opt("TrayMenuMode", 3) TraySetState() TraySetClick(8) TraySetOnEvent($TRAY_EVENT_PRIMARYUP, "Search") TraySetOnEvent($TRAY_EVENT_SECONDARYUP, "On_Exit") $sToolTipText = "Tech Support Region Finder" TraySetToolTip($sToolTipText) Global $iIcon_X, $iIcon_Y _Locate_Icon() Local $GUI_Width = 65 Local $GUI_Height = 21 $Gui = GUICreate("TSRF", $GUI_Width+2, $GUI_Height+2, @DesktopWidth, @DesktopHeight, BitOR($WS_POPUP, $WS_THICKFRAME, $WS_SIZEBOX)) GUISetBkColor(0xFFFFFF) $Input1 = GUICtrlCreateInput("Post Code", 0, 0, 65, 21) GUIRegisterMsg(0x0084, "WM_NCHITTEST") $aTaskbar = WinGetPos("[CLASS:Shell_TrayWnd]", "") $aWin = WinGetPos($GUI) WinMove($GUI, "", @DesktopWidth - $aWin[2], @DesktopHeight - $aWin[3] - $aTaskbar[3]) GUISetState(@SW_HIDE) While 1 if _IsPressed("0D") AND WinExists($Gui) Then $Input = GuiCtrlRead($Input1) $TechRegion = IniRead($INI_Path & "data.ini",$Input,"Tech","NOT FOUND") ClipPut($TechRegion) GUISetState(@SW_HIDE) EndIf WEnd Func WM_NCHITTEST($hWnd, $iMsg, $iwParam, $ilParam) #forceref $hWnd, $iMsg, $iwParam, $ilParam Return $HTCAPTION EndFunc Func _Locate_Icon () Local $aPos = WinGetPos("[Class:Shell_TrayWnd]", "") $iIcon_X = $aPos[0] $iIcon_Y = $aPos[1] Local $hSysTray_Handle = ControlGetHandle("[Class:Shell_TrayWnd]", "", "[Class:ToolbarWindow32;Instance:1]") $aPos = ControlGetPos("[Class:Shell_TrayWnd]", "", "[Class:ToolbarWindow32;Instance:1]") If @error Then Return $iIcon_X += $aPos[0] $iIcon_Y += $aPos[1] Local $iSysTray_ButCount = _GUICtrlToolbar_ButtonCount($hSysTray_Handle) If $iSysTray_ButCount = 0 Then Return For $iSysTray_ButtonNumber = 0 To $iSysTray_ButCount - 1 Local $sText = _GUICtrlToolbar_GetButtonText($hSysTray_Handle, $iSysTray_ButtonNumber) If StringInStr($sText, $sToolTipText) > 0 Then $aPos = _GUICtrlToolbar_GetButtonRect($hSysTray_Handle, $iSysTray_ButtonNumber) $iIcon_X += $aPos[0] $iIcon_Y += $aPos[1] ExitLoop EndIf If $iSysTray_ButtonNumber = $iSysTray_ButCount - 1 Then Return 1 Next Return 0 EndFunc Func Search() GUISetState(@SW_SHOW) EndFunc Func On_Exit() Exit EndFunc I assume it is something to do with the while loop here: While 1 if _IsPressed("0D") AND WinExists($Gui) Then $Input = GuiCtrlRead($Input1) $TechRegion = IniRead($INI_Path & "data.ini",$Input,"Tech","NOT FOUND") ClipPut($TechRegion) GUISetState(@SW_HIDE) EndIf WEnd Though as far as I can see I am telling it to wait for the user to press enter and when the GUI is active. I'm guessing that its something to do with the handle I am using for the gui?? Cheers
  20. M23: Thanks for that. I now have it working to show the GUI on a left click and exit on the right click. -RC: I did toy with that idea but thought it would turn into a nightmare logistically - calculating how far into the taskbar from the right the existing system tray icons come in; then and from the left open programs that show there, what if there are so many open programs they are hidden under the gui etc. Unfortuantely I think these are insurmountable problems which is why it would need to be embedded Cheers!
  21. hello I want to create a 'search bar' that is embedded into the taskbar. When a user enters something into the taskbar then presses enter, an ini file is searched. Does anybody know if this is possible? If not, is it possible to run a gui (with input box) from a single left click of the tray icon? I already the have the script funcioning - however it is by clicking on the tray icon and then selecting a tray icon menu, there is no need for multiple button clicks. If either of these are possible, does anybody know how!? Cheers!
  22. Cheer JohnOne, I assumed that the ControlID was that the "Advanced (Class):" from the Window Info program. Works a treat now, thanks
  23. Hi all, I am trying to get to grips with this function, so as a test I am trying to read a field of an outlook contact. So, I have this: WinActivate("Test - Contact") Sleep(50) $x = GUICtrlRead("[CLASS:RichEdit20WPT; INSTANCE:4]") sleep(50) ShellExecute("notepad.exe") WinWaitActive("Untitled - Notepad") Sleep(50) Send($x) I expected it to send the "Full Name" field from Outlook into Notepad. But all I get is a 0? Any pointers on this probably really basic error Thanks!
  24. OK, so now I have another problem, passing the input into the second gui. When clicking one of the control pannel .cpl's, I need the "Run As" gui I created to appear, the user enter their credentials and click ok, then run the cmd runas line using the given details and the relevant cpl. monoscout999; in the script you have provided I have the following: Case $AccessCPL RunAsAdmin() $Username = GUICtrlRead($INPUT_usrnm) $Password = GUICtrlRead($INPUT_psswd) GUIDelete($RunAs_GUI) MsgBox(4096,"",$Username & " - " & $Password) Problem is, it does exactly what I tell it, not what I want haha! It runs the GUI, deletes it and shows nothing in the message box; which is what I have. Head scratcher is, how do I pause the script until the OK button ($OK) is pressed? This way it gives the use chance to enter their details? Alternatively, a much smoother approach would be to emulate the Windows XP right-click & 'run as'; is this possible?? This would be much better - not a kop out but because it would have the capability of questioning the DC on entered credentials...
×
×
  • Create New...