Jump to content
Sign in to follow this  
AnonymousX

Pulling data from website that locks content for other users

Recommended Posts

Hello,

I need to pull data from company intranet website. I created a script that I can give a list of project numbers and it will open up the the related webpage for each project, save the html comments for that project, then move on to the next. 

However my problem comes in that each time I open up a project it locks it for other users, and if you just exit the page it keeps it locked, you have to actually press the "close" button on the page. So I'm not sure how to deal with this as I end up just locking every project in my name when I run my program as I don't understand the nature of how the website is built. I don't understand how to close with just using my automation code without manually having to press the stupid button. 

My Function:

Func Getscript($ProjectAddress) ;getting the page source code and storing it into text file for easy reading it

    $file = FileOpen(@ScriptDir & "\source.txt", 10)

    $IE = _IECreate($ProjectAddress & ".html", 0, 0)

    $source = _IEDocReadHTML($IE)

    FileWrite($file, $source)

    $target_source = _StringBetween($source, "<BODY>", "</BODY>") ; only take content between the specified tags

    _IEQuit($IE)

    FileClose($file)

    return $target_source[0]

EndFunc   ;==>Getscript

 

Source Code I got from website that I think is relevant:

function closeForm(){
  if(topButtonEnabled("closeButton")){
        parent.mainFrame.closeForm();
    }
}

<button id="closeButton" class="saveCloseButton" style="LEFT: 77px;" onclick=closeForm()>&nbsp;Close&nbsp;</button>

 

Any Ideas of how to tell website to either activate the closeform function or just give it the command to close?

 

Thanks

Share this post


Link to post
Share on other sites

@Danp2 thanks, how would I implement that? 

Func Getscript($ProjectAddress) ;getting the page source code and storing it into text file for easy reading it

    $file = FileOpen(@ScriptDir & "\source.txt", 10)

    $IE = _IECreate($ProjectAddress & ".html", 0, 0)

    $source = _IEDocReadHTML($IE)

    FileWrite($file, $source)

    $target_source = _StringBetween($source, "<BODY>", "</BODY>") ; only take content between the specified tags

;=======New=================

$oDiv = _IEGetObjById($IE, "closeButton")
_IEAction ($oDiv, "click")
    
    
    
;=========================
    _IEQuit($IE)

    FileClose($file)

    return $target_source[0]

EndFunc   ;==>Getscript

 

my 2 extra lines don't do anything when put into a test file...

Is there no way to skip clicking the button and telling the webpage to run it's "closeForm()" function?

 

 

Edited by AnonymousX

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By singh54
      Hello All,

      I am new to auto It  and coding. Have only tried few automated logging for different websites.  The login pages of the websites which I have worked on were having form name with input type as text and it seems straight forward to automate their login using "_IEFormElementSetValue".
      I have got a url, it does not have any form in the source page. On further analyzing I found that It does call some login page separately as below.
      function showLogin(arg) {
        Global.pollingDialogDoc = null;
        var fresh = jQuery.isValidString(arg) && "fresh" == arg ? !0 : !1, appFrame = $("#appFrame");
        if ($("#modalFrame").show(), $("iframe").hide(), fresh || !appFrame.attr('src').match("html/login.html")) appFrame.attr('src', baseURL + 'html/login.html'), 
        appFrame.on('load', function() {
          setTimeout(function() {
            $("#modalFrame").hide(), appFrame.show();
          }, 1);
        }); else try {
          window.frames.appFrame.updatePageFromIndex();
        } catch (e) {}
      }
      I can simply use "send" and "mouse click" Method to automate the login but that doesn't seems very reliable. Is there any separate way to fill the user ID and password to the respective fields by having reference by frames or something. 
      Appreciate if any one can point me to correct document or help in any way...!
    • By HariKara
      I have a script that seems to launch perfectly fine with IECreate, however, I want to launch the Browser and a specific URL with the RunAs command. I fairly new to AutoIT and wanted to know if someone can point me in the right direction.
      Local $surl = "http://somewebsite.com/DODA/admin/job.aspx"
      Local $oIE = _IECreate($sURL)
      The above launches the website correctly with the correct URL, however, I have tried the below and this fails to load and browser?
      #include <AutoItConstants.au3>
      ;========================
      $oSleep = "200"
      Local $surl = "http://somewebsite.com/DODA/admin/job.aspx"
      Local $oIE = RunAs($args("username"), $args("domain"), $args("logonpassword"), "", "C:\Program Files (x86)\Internet Explorer\iexplore.exe http://somewebsite.com/DODA/admin/job.aspx")
      _IELoadWait($oIE)
       
      I get the following error back?
      --> IE.au3 T3.0-2 Error from function _IELoadWait, $_IESTATUS_InvalidDataType
      --> IE.au3 T3.0-2 Error from function _IEGetObjById, $_IESTATUS_InvalidDataType
      --> IE.au3 T3.0-2 Error from function _IEGetObjById, $_IESTATUS_InvalidDataType
    • By WoodGrain
      Hi All,
      I've tried to create a script to browse to a web page in IE, but it only works for some sites, I've tried to simplify the script as much as possible, hoping you can point me in the right direction - thanks.
      This one going to Google does work:
      #include <IE.au3> $oIE = _IECreate("https://www.google.com.au/", 0, 1, 1) _IELoadWait($oIE) _IEQuit($oIE) But this one going to OneDrive opens the IE page, but fails immediately returning the errors, and the IE window is not closed:
      --> IE.au3 T3.0-2 Error from function _IELoadWait, $_IESTATUS_ClientDisconnected (-2147023174, Browser has been deleted prior to operation.)
      --> IE.au3 T3.0-2 Error from function _IELoadWait, $_IESTATUS_InvalidObjectType ()
      --> IE.au3 T3.0-2 Error from function _IEQuit, $_IESTATUS_InvalidObjectType
      #include <IE.au3> $oIE = _IECreate("https://abccorp-my.sharepoint.com/", 0, 1, 1) _IELoadWait($oIE) _IEQuit($oIE) Even if I put a sleep timer in for 10 seconds after the _IECreate it still doesn't work
      Thanks all!
    • By kingjacob90
      Hay guys
      Just had an idea and wanted to know where to start. I want to download a screenshot of a website automatically into a .png .jpg ect format so I can then set it as my desktop background.
      This might be for for news: When the latest news is added to a website a screenshot of that website is saved and added to my desktop background.
      I have tried using website that already do the screenshot but you have to open the website and click the button for it to generate one and thus InetGet does not help.
      Any Ideas?
    • By naru
      Its Possible To auto Login with autoit script ?
×
×
  • Create New...