Jump to content
Sign in to follow this  
kalel69

unable to log into my company's Internet Explorer based application.

Recommended Posts

kalel69

Hi Folks.  Looking for a little assistance to help login to one of my company's application's web pages.  These are Intranet based pages, and not open to the general public, and I will try to provide the code and screen shots where I can.  I have been attempting to get this login script to work for quite some time.  Any help would be appreciated. 

I have 3 types of issues here.

1.  using the basic _IEFormElementSetValue, instead of replacing the grayed out verbiage (user name) with an un-grayed out text (actual user name in black type font), it does enter the user name, but it is entered still as grayed out text in the input box.

2.  to get the above to work, i've replaced using _IEFormElementSetValue and instead use an "_IEAction" (2 actually - focus / select all) then a "send" to manually put in the username.  This works upon initial launch of the page, but when logged out, and logging back in, the IEactiion and send fail to enter the fields.

3.  My company has an .hta application that launches a reporting app, but the page is designed exactly the same as the web page, (except the app contains the code - the .hta app), but it is still the exact same fields defined.  Theoretically knowing the input boxes names as I do and that they're the same, I should be able to log into this app the same way.  However, I can not.  I once contacted dale through email to question why the .hta app would not respond, and he gave me some ideas, and stated if I still have issues, to post a topic here.  so this is what I'm doing, because I still have issues with the .hta app.  And I've also tried to attach to the .hta application as an embedded application, but still could not get the fields to populate (log in screen).

I have attached screen shots of the intial view of the sign on page, and the view of an attempted signon using _IEFormElementSetValue.

Here is my code to attempt to attach / launch-create the web page.

Func _LaunchAdminApp  ()
    If      $CurServNam= "" Then Return
    If      WinExists("PCDS :: Management") Then Return
    Local   $FTMAddress= "https://"&$CurServNam&"/admin"
    If      NOT WinExists("Fluency for Imaging Log On") Then
            Local $oIE = _IECreate($FTMAddress)
        Else
            Local $oIEWhnd = WinGetHandle("Fluency for Imaging Log On")
            Local $oIE = _IEAttach($oIEWhnd)
    EndIf
    Local   $Count     = 0
    If $AdmAutoLogin   = 1 Then
        If $LoginIDAA = "" Then Return
        Do
            $Count+=1
            Sleep(100)
            If $Count > 30 Then
                MsgBox(0,"Sorry","Can't sign in to Admin App!")
                Return
            EndIf
        Until IsObj($oIE)
        Local   $oForm     = _IEFormGetCollection($oIE,0)
                $Count     = 0
        Do
            $Count+=1
            Sleep(100)
            If $Count > 30 Then
                MsgBox(0,"Sorry","Can't sign in to Admin App!")5
                Return
            EndIf
        Until IsObj($oForm)
        WinActivate($oIE)
        Local   $oQueryUser= _IEFormElementGetObjByName ($oForm,     "UserName"       )
        Local   $oQueryPW  = _IEFormElementGetObjByName ($oForm,     "PasswordDisplay")
        Local   $CompID    = _IEFormElementGetObjByName ($oForm,     "Domain"         )
        Local   $oSubmit   = _IEFormElementGetObjByName ($oForm,     "loginBtn"       )
        Sleep(500)
                            ;_IEAction                  ($oQueryUser,"focus"          )
                            ;_IEAction                  ($oQueryUser,"selectall"      )
                            ; Send                      ($LoginIDAA                   );this will work only for initial login, not for subsequent log in's after logoff.
                             _IEFormElementSetValue     ($oQueryUser, $LoginIDAA      );this does not work.  enters name in gray text, app does not think its there, but can see it.
                            ;_IEAction                  ($oQueryPW,  "focus"          )
                            ;_IEAction                  ($oQueryPW,  "selectall"      )
                            ; Send                      ($PasswordAA                  );this will work only for initial login, not for subsequent log in's after logoff.
                            _IEFormElementSetValue      ($oQueryPW,  $PasswordAA      );this does not work.  enters password in gray text, app does not think its there, but can see it.
                            _IEFormElementOptionSelect  ($CompID,0,1,"byIndex"        )
        Sleep(5000)
        If IsObj($oSubmit) Then $oSubmit.click()
    EndIf
    If $CloseAfSelAA   = 1 Then Exit
EndFunc

Basically, i'm checking to see if the pages exists first, then either creating a page or attaching to a page depending upon the results of the check.

I've also attached the source for the signon page for the web app.  Note that the code delivered via the .hta for sign on is exactly the same.

any and all suggestions are most welcome.  I'm at my witts end here! 

Thanks in advance!  (I love AutoIT! and this site!)

view of signon screens.zip

Company Application Signon Page.html

Share this post


Link to post
Share on other sites
Shane0000

I dont know if it will help but firstly your do loop for sleep has a max time out of 3 seconds.

When I automate a page I focus on the form and when I submit all values are recognized. I think I had a problem too until I put in the IEAction Focus (which I see is commented out in yours)

_IENavigate($oIE, "Somepage.com")
    _IEAction($oIE, "stop")
    Local $oForm = _IEFormGetObjByName($oIE, "searchform")
    _IEAction($oForm, "focus")
    If @error Then ConsoleWrite ( @CRLF & "Error Parameter: " & @extended & " / Error: " & @error & @CRLF)
    _IEFormElementRadioSelect($oForm, 0, "dec", 1, "byIndex")
    $oText = _IEFormElementGetObjByName($oForm, "latt")
    _IEFormElementSetValue($oText, $strLat )
    $oText = _IEFormElementGetObjByName($oForm, "longt")
    _IEFormElementSetValue($oText, $strLon )
    _IEFormSubmit($oForm)

Share this post


Link to post
Share on other sites
kalel69

I do appreciate the reply.  just so you know, it is commented because I have tried both methods.  when I use IEFormElementSetValue, it grays the text.  when I REM out IEFormElementSetValue, and only use send (with focus), it works, but only for the iecreate.  not with ieattach.  I can't get ieattach to work either way.  I may try, as you mentioned, a combination of both when I get home.  I will post back later.   thanks again for the response!

<got home>

Tried the fix from Shane0000 (thanks). and it fixed item number 1, although I also added an additional line of text, because I now noticed for some reason, there are 2 input's for the password ("PasswordDisplay" and "Password").  So I went ahead and sent the password to both using the fix from Shane0000, and it works for item number 1 now, without having to use the "send" command.  I'm excited about that! 

Func _LaunchAdminApp  ()
    If      $CurServNam= "" Then Return
    If      WinExists("PCDS :: Management") Then Return
    Local   $FTMAddress= "https://"&$CurServNam&"/admin"
    If      NOT WinExists("Fluency for Imaging Log On") Then
            Local $oIE = _IECreate($FTMAddress)
        Else
            Local $oIEWhnd = WinGetHandle("Fluency for Imaging Log On")
            Local $oIE = _IEAttach($oIEWhnd)
    EndIf
    Local   $Count     = 0
    If $AdmAutoLogin   = 1 Then
        If $LoginIDAA = "" Then Return
        Do
            $Count+=1
            Sleep(200)
            If $Count > 30 Then
                MsgBox(0,"Sorry","Can't sign in to Admin App!")
                Return
            EndIf
        Until IsObj($oIE)
        Local   $oForm     = _IEFormGetCollection($oIE,0)
                $Count     = 0
        Do
            $Count+=1
            Sleep(200)
            If $Count > 30 Then
                MsgBox(0,"Sorry","Can't sign in to Admin App!")5
                Return
            EndIf
        Until IsObj($oForm)
        WinActivate($oIE)
        Local   $oQueryUser= _IEFormElementGetObjByName ($oForm,     "UserName"        )
        Local   $oQueryPW1 = _IEFormElementGetObjByName ($oForm,     "PasswordDisplay" );where did this come?  -  <input  id="PasswordDisplay"
        Local   $oQueryPW2 = _IEFormElementGetObjByName ($oForm,     "Password"        );                      -  <input  id="Password"
        Local   $CompID    = _IEFormElementGetObjByName ($oForm,     "Domain"          )
        Local   $oSubmit   = _IEFormElementGetObjByName ($oForm,     "loginBtn"        )
        Sleep(500)
                            _IEAction                   ($oQueryUser,"focus"           )
                            _IEAction                   ($oQueryUser,"selectall"       )
                             Sleep(500)
                            ;Send                       ($LoginIDAA                    );this will work only for initial login, not for subsequent log in's after logoff.
                            _IEFormElementSetValue      ($oQueryUser, $LoginIDAA       );this does not work.  enters name in gray text, app does not think its there, but can see it.
                            _IEAction                   ($oQueryPW1,  "focus"          )
                            _IEAction                   ($oQueryPW1,  "selectall"      )
                             Sleep(500)
                            ;Send                       ($PasswordAA                   );this will work only for initial login, not for subsequent log in's after logoff.
                            _IEFormElementSetValue      ($oQueryPW1,  $PasswordAA      );this does not work.  enters password in gray text, app does not think its there, but can see it.
                            _IEAction                   ($oQueryPW2,  "focus"          )
                            _IEAction                   ($oQueryPW2,  "selectall"      )
                             Sleep(500)
                            _IEFormElementSetValue      ($oQueryPW2,  $PasswordAA      )


                            _IEAction                   ($CompID,    "focus"           )
                             Sleep(500)
                            _IEFormElementOptionSelect  ($CompID,0,1,"byIndex"         )
        Sleep(500)
        If IsObj($oSubmit) Then $oSubmit.click()
    EndIf
    If $CloseAfSelAA   = 1 Then Exit
EndFunc

Thanks.  1 down.  2 to go!

Still won't re-login after logging out.  (item 2 above).  and still nothing from the .hta app (that uses the same code as the web page).

Any further assistance would be greatly appreciated.  Please don't forget I've attached screenshots in a zip, and the .html code page for the login page.

Thanks again!

Edited by kalel69

Share this post


Link to post
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
Sign in to follow this  

  • Similar Content

    • soft4pedia
      By soft4pedia
      Hi,
      Google changed the style of translation page therefore _IEFormElementSetValue stopped working to set values in the google translator page automatically, I tried my best to fix it but it's not happening. It was working perfect a month ago almost before launching of new google translation interface. Any help would be highly appreciated...
      I'm using a kind of function that help to set values in the form to google translator page and let it translate and then retrieve it back to save in a text file.
      Here is my code:
      #RequireAdmin #include <IE.au3> #include <String.au3> #include <Array.au3> #include <Excel.au3> #include <File.au3> ;*****************************Splitting Source Code Ended***************************** Local $oExcel = _Excel_Open() Local $oWorkbook1 = _Excel_BookOpen($oExcel, @ScriptDir & "\example.xlsx", False) ;*****************************Saving Software Links Started*************************** ;*****************************Splitting Source Code Started***************************** ;***************************************** Saving Title + .rar link + Description text file No. 1***************************** ProcessClose ( "iexplore.exe") $file = fileopen(@ScriptDir & "\source.txt", 10) $splitting = _Excel_RangeRead ($oWorkbook1, Default, "A1") $IE = _IECreate($splitting, 0, 0) $source = _IEDocReadHTML($IE) FileWrite($file, $source) $target_source5 = _StringBetween($source, '</h1>', '<i>Скачать</i>') If Not @error Then FileWrite (@ScriptDir & "\kat01.txt", $target_source5[0]) Sleep (50) ; removing of HTML codes to convert data into simple text $File1 = @ScriptDir & "\kat01.txt" $txt = FileRead($File1) $txt = StringReplace($txt, "<br>", @crlf) $txt = StringRegExpReplace($txt, '(?s)<a.*?</a>|<.*?>', "") $txt = StringStripWS ( $txt, $STR_STRIPSPACES) $txt = StringReplace($txt, "<br><", "") $txt = StringReplace($txt, "--", "") $txt = StringReplace($txt, "---", "") $txt = StringReplace($txt, "&nbsp;", " ") $txt = StringReplace($txt, "_", "") $txt = StringReplace($txt, " ", "") FileWrite (@scriptdir & '\kat_saved.txt', $txt) Local $sFilePath = @ScriptDir & "\kat_saved.txt" ProcessClose ( "iexplore.exe") Example1() EndIf ;********************Example1 Function Written Started***************************** Func Example1() $Text = FileRead ($sFilePath) Local $aArray = StringSplit($Text, @CR) For $i = 1 To $aArray[0] Local $tag="* *" Local $oIE=_IECreate("https://translate.google.com/#ru/en", 1, 1) $HWND = _IEPropertyGet($oIE, "hwnd") WinSetState($HWND, "", @SW_MAXIMIZE) Sleep (500) Local $oForm=_IEFormGetCollection($oIE,0) Local $oQuery=_IEGetObjByName($oForm,"text") _IEFormElementSetValue($oQuery, $tag & @CR & $aArray[$i] & @CR & $tag) MouseMove ( 930, 275, 10) MouseClick ( "Main", 930, 275, 5, 10) Sleep(1000) MouseMove ( 930, 200, 10) MouseClick ( "Main", 930, 200, 5, 10) Sleep (10000) _IELoadWait($oIE) Local $oText=_IEGetObjById($oIE,"gt-res-data") $lines=StringSplit(_IEPropertyGet($oText,"innerText"),@CRLF,1) _IEQuit($oIE) ProcessClose ( "iexplore.exe") Sleep (1000) _ArrayDelete($lines,_ArraySearch($lines,$tag,1,0,0,1,0) & "-" & $lines[0]) _ArrayDelete($lines,"1-" & _ArraySearch($lines,$tag,1,0,0,1,1)) $lines[0]=UBound($lines)-1 $FilePath = @ScriptDir & "\Translated.txt" $arraytostring = _ArrayToString ($lines) $txt = StringReplace($arraytostring, "1|", "") $txt = StringReplace($txt, "|", "") FileWrite ($FilePath, $txt & @CRLF) Next EndFunc ;MsgBox ('', 'Done Bro', 'Done Bro')  
    • MMedina
      By MMedina
      Hello all, 
      Been looking for and playing around with a script that would prompt me for a UserName and Password then Map a network drive.
      I have included the code: 
      #AutoIt3Wrapper_icon=your_icon.ico #AutoIt3Wrapper_Run_Obfuscator=y #obfuscator_parameters=/striponly #NoTrayIcon #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> $Form1 = GUICreate("Connect To Your Drive", 265, 135) $username_id = GUICtrlCreateInput("", 88, 16, 153, 21) $password_id = GUICtrlCreateInput("", 87, 44, 153, 21, $ES_PASSWORD) GUICtrlCreateLabel("&Username", 24, 16, 52, 17) GUICtrlCreateLabel("&Password", 26, 46, 50, 17) $connect = GUICtrlCreateButton("&Connect", 24, 80, 217, 33, BitOr($GUI_SS_DEFAULT_BUTTON, $BS_DEFPUSHBUTTON)) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $connect $username = GUICtrlRead($username_id) $password = GUICtrlRead($password_id) If $username = '' Or $password = '' Then MsgBox(16, 'Error', 'Empty username or password') ContinueLoop EndIf If DriveMapGet("X:") <> '' Then ; very fast MsgBox(16, 'Error', 'The device is already assigned') ContinueLoop EndIf GUISetCursor(15,1) DriveMapAdd("X:", "\\Server\share\filestore\" & $username, 0, $username, $password) ; slow If @error Then Switch @error Case 1 $err_message = 'Undefined / Other error. Windows API return code: ' & @extended Case 2 $err_message = 'Access to the remote share was denied' Case 3 $err_message = 'The device is already assigned' Case 4 $err_message = 'Invalid device name' Case 5 $err_message = 'Invalid remote share' Case 6 $err_message = 'Invalid password' EndSwitch GUISetCursor(2) MsgBox(16, 'Error', $err_message) Else ; everything OK Exit EndIf EndSwitch WEnd  
      When I attempt the build I get the following:
       Obfuscator support has been discontinued and is replaced by Au3Stripper using "#Au3Stripper_" directives.
      ! The directive to run Au3Stripper is: #AutoIt3Wrapper_Run_Au3Stripper=y  ; Default is n
      ! #Au3Stripper_Parameters options are: 
      /pe  : Replace and reference to a Global Const variable with its actual value.
      /tl  : Create Au3Stripper.Log with a trace of all actions.
      /debug: add Debug information to Au3Stripper.Log.
      /so : This is the default when no parameters are provided. same as /sf + /sv
      /sf : Strip all unused Func's
      /sv : Strip all unused Global var records.
      /mo : Just merges the Include files into the source and strips the Comments.
            This is similar to aut2exe and helps finding the errorline.
      /mi : Sets the maximum Iterations Au3Stripper will perform. Default is 5.
      /rm : Rename Variables and Functions to a shorter name.
      /rsln: Replace @ScriptLineNumber with the actual line number.
      /Beta: Use Beta Includes.
      - Icon not found:  your_icon.ico ==> Changing to default ICON.
      >Running AU3Check (3.3.14.5)  from:C:\Program Files (x86)\AutoIt3  input:C:\Users\Migue\Documents\Sync\Batches and Scripts\WDW-Scripts\SMS.au3
      +>18:28:11 AU3Check ended.rc:0
      >Running Au3Stripper (18.708.1148.0)  from:C:\Program Files (x86)\AutoIt3\SciTE\Au3Stripper cmdline:
      - 0.22 Iteration 1 Strip Functions result: Output  1050 lines, stripped 0 Func lines and 234 Commentlines
      - 0.61 Iteration 2 Strip Variables result: Output  88 lines and stripped 962 lines
      - 0.63 Iteration 3 Strip Variables result: Output  58 lines and stripped 30 lines
      - 0.64 Iteration 4 Strip Variables result: Output  52 lines and stripped 6 lines
      - 0.66 Iteration 5 Strip Variables result: Output  51 lines and stripped 1 lines
      +> Source    1285 lines 48435 Characters.
      +> Stripped  999 Func/Var lines and  234 comment lines, Total 46893 Characters.
      +> Saved     95% lines 96% Characters.
      +> Au3Stripper v18.708.1148.0 finished created:C:\Users\Migue\Documents\Sync\Batches and Scripts\WDW-Scripts\SMS_stripped.au3
      +>18:28:12 Au3Stripper ended.rc:0
      >Running AU3Check (3.3.14.5)  from:C:\Program Files (x86)\AutoIt3  input:C:\Users\Migue\Documents\Sync\Batches and Scripts\WDW-Scripts\SMS_stripped.au3
      +>18:28:12 AU3Check ended.rc:0
      >Running:(3.3.14.5):C:\Program Files (x86)\AutoIt3\aut2exe\aut2exe.exe  /in "C:\Users\Migue\Documents\Sync\Batches and Scripts\WDW-Scripts\SMS_stripped.au3" /out "C:\Users\Migue\AppData\Local\AutoIt v3\Aut2exe\~AU495C.tmp.exe" /nopack /comp 2
      +>18:28:13 Aut2exe.exe ended.C:\Users\Migue\AppData\Local\AutoIt v3\Aut2exe\~AU495C.tmp.exe. rc:0
      !>18:28:13 Problem copying file from: C:\Users\Migue\AppData\Local\AutoIt v3\Aut2exe\~AU495C.tmp.exe To :C:\Users\Migue\Documents\Sync\Batches and Scripts\WDW-Scripts\SMS.exe
      +>18:28:14 AutoIt3Wrapper Finished.
      >Exit code: 0    Time: 3.046
       
      When I attempt to run the executable I get the following:

      Many thanks in advance
    • ammaul
      By ammaul
      Hi folks, I'm having problems with a screenshot capture script.
      Let me explain.
      Everyday I (and my colleagues at work) need to take some screenshots from a web-page. These screenshots are used to compile a report. Normally, I (and others) used to log in into the website and took screenshots of desired graphics and tables. This is tediuos and time consuming. To easy this task I made a script using autoit that basically logs into the website (user and password) and using some clicks, stroke send, coordinates, it is able to generate the graphics and save them to some folders into our network (this script saves arouund 50 pics. It works like a sharm.
      In order to make things easier, I tried to schedule this script (compiled to a Screnpics.exe file) using task scheduler from windows. We already use this (task scheduler) to run some vbs scripts, some vba excel scripts and so on. The computer used for this tasks is a windows 7 desktop computer. Due to security policies, the computer locks after some time. All this tasks run in the locked computer.
      My script screenpics.exe runs also from this locked computer. When the computer is unlocked, it does everything as expected. But, when it is locked, all the "pics" are BLACK. As I understand, it runs ok, but, as the "windows" are innactive, it prints what it "sees": a black rectangular.
      Some details: The web-page with hold the information I need, it only works in Firefox and, because of this it couldn`t be managed by vba or some "getobject" like commands. In fact, it has some flash things that make it impossible to control programatically. So my script is based on mouse move to coordinates, mouse click, screen capture and so one.
       
      So, I read many posts trying to figure out a way to overcome this, but... nothing came to mind. My first idea was try to unlock windows. Theses lead me to some posts with no solution. This is worse because I'm not a computer admin, so procedures that need to replace/change the register are not an option.
       
      If someone has any idea, I'll be gratefull.
    • therks
      By therks
      Has anybody else noticed that Windows 7 reacts ignorantly when you use the Windows key + arrow key shortcuts on a GUI with GUIEventMode set to 1? I discovered this recently when I was working on an app where I wanted complete control over the maximize/minimize buttons.
      Just give it a spin:
      #include <GUIConstants.au3> Opt('GUIEventOptions', 1) $hGUI = GUICreate('', 300, 200, Default, Default, BitOR($GUI_SS_DEFAULT_GUI, $WS_MAXIMIZEBOX)) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_MAXIMIZE ToolTip('Maximized') Case $GUI_EVENT_MINIMIZE ToolTip('Minimized') Case $GUI_EVENT_RESTORE ToolTip('Restored') Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Run that, then hit Win+Up or Win+Down. None of those events get triggered, and it still maximizes/minimizes. Although I can't get it to restore down from a maximize unless the window is also resizable ($WS_THICKFRAME in the style).
      Is there a way to stop Windows from doing what it wants or is the only option to check with WinGetState() and then change it back?
       
      Windows 10 seems to respect my settings, and I don't have any other versions to test on.
    • msd1994
      By msd1994
      I have a script that just adds some keyboard shortcuts for things like displaying the current song and artist, moving the window to the side so it won't pop up in my way, and play/pause, next song, previous song (these are the only 3 to still work since they don't need the window handle.)
      In some update recently, Spotify's window class swapped from "[CLASS:SpotifyMainWindow]" to "[CLASS:Chrome_WidgetWin_0]". Using the new class in my controls doesn't seem to work, I've tried getting the window handle from the process handle (_GetHwndFromPID($PID)) but that seems to fail as well.
      Does anybody have some idea of a way I could get this script working again?
       
      edit: seems like discord has the same window class name, so could be some issue with this? Still not sure of a way to solve the issue though, I added a function to get the handle of the active window and can just use that now, but it was able to find it on its own before on spotify startup or script startup which would be preferred.
       
      Thanks!
×