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
2 hours ago, AnonymousX said:

$oDiv = _IEGetObjById($IE, "closeButton")

_IEAction ($oDiv, "click")    

That's how I would have written it, except I would have use $oButton instead of $oDiv. :-P

Any meaningful output when you run the script in Scite?

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

    • 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 ?
    • By SteveStrop
      Hi 
       
      I'm trying to:
      1) Open a hidden browser session
      2) Do some stuff in the background
      3)  Make the hidden window visible
       
      This is my code:
       
      Opt("WinTitleMatchMode", 2) ;1=start, 2=subStr, 3=exact, 4=advanced, -1 to -4=Nocase $oIE = _IECreate("https://www.google.co.uk/",0,0) $oSearchBox = _IEGetObjById($oIE, "lst-ib") $oSearchBox.innertext = "AutoIT" $oForm = _IEFormGetObjByName($oIE,"f") _IEFormSubmit($oForm) WinSetState("Google","",@SW_SHOW)  
      It dosen't work
      The last line does make the window visible but it is an empty greyed out box that disappears as soon as I click on it.
      I have a sort of workaround that hides the browser window as soon as I have created it which works fine:
      $oIE = _IECreate("https://www.google.co.uk/") WinSetState("Google","",@SW_HIDE) . . . WinSetState("Google","",@SW_SHOW) But this looks a bit pants as the newly created window flashes on then off of the screen.
      Am I using the wrong method to make the browser window visible?
      Thanks
       
       
    • By ur
      I saw few UDFs related to IE and Firefox to automate tasks related to these browsers.
       
      But is it possible to automate tasks like drag and drop in the website.?
      Like in the below video.
      If not can you tell me some alternatives, as it is not possible in selenium as I heard.
      drag_and_drop.mp4
×
×
  • Create New...