Jump to content

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

Link to comment
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
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

×
×
  • Create New...