Jump to content

Recommended Posts

Posted

So.. here at work almost everything is locked up, can't install progs, add-ons, only have IE9.. so i was thinking of a way to automate some stuff i got to do, and being a newbie to javascript, started to read some stuff, and ended up with this thing that is set to open with IE on double click, it's supposed to open youtube and write 123 into the search input, but it only opens the window, and stops.(At work, because at home, for some reason it tries to download it..)

<!DOCTYPE html> 

<html> 

<body> 

<script language="javascript"> 

window.open("https://www.youtube.com","_self", fullscreen=1); 

location.assign("https://www.youtube.com");

document.getElementsByName("search_query").value="123"; 

document.getElementById("masthead-search-terms").value="456";

</script> 

</body> 

</html>

In other words, what would be the way to proceed and do this kind of stuff, having only IE9, no add-ons or any third party applications?

i did a different code that i paste under "script" within "developer tools", and it works, but it's not practical.

  Reveal hidden contents

IUIAutomation - Topic with framework and examples

Au3Record.exe

Posted

Moved along a bit and ended up with this:

<!-- saved from url=(0016)http://localhost -->
<script language=JavaScript>
winRef = new Object();
winRef.closed = true;
</script>

<form name=f1 id=f1>
<input type=button name=b1 id=b1 value="New window" 
onClick="winRef=window.open('http://www.google.com/','myNewWindow','left=0,top=0,width=800,height=600,toolbar=1,menubar=1,resizable=1,status=1');">

<input type=button name=b2 id=b2 value="Close window" 
onClick="if(!winRef.closed)winRef.close();">

<input type=button name=b3 id=b3 value="Check" 
onClick=winRef.document.getElementById("lst-ib").value="##search##";>
</form>

Now i open new window, and click check, was supposed to write into the search field, but says "permission denied".

So, in general, i need to write into a child window, but it seems that whatever i do, it tries to write to parent everytime, because sometimes i get the error that the element does not exist and stuff like that.

  Reveal hidden contents

IUIAutomation - Topic with framework and examples

Au3Record.exe

Posted

Re-done, gives permission error.

<!-- saved from url=(0016)http://localhost -->
<script language=JavaScript>
winRef = new Object();
winRef.closed = true;
</script>

<form name=f1 id=f1>
<input type=button name=b1 id=b1 value="New window" 
onClick="winRef=window.open('http://www.google.com','myNewWindow',
  'left=15,top=15,width=1280,height=960,toolbar=1,menubar=1,resizable=1,status=1');
  winRef.focus()">

<input type=button name=b2 id=b2 value="Close the window"
onClick="if(!winRef.closed)winRef.close();">

<input type=button name=b3 id=b3 value="Check: is it closed?" 
onClick="alert(winRef.closed ? 'It\'s CLOSED!':'It\'s still OPEN!');">

<input type=button name=b4 id=b4 value="Write Hello in the search field"
onClick=EditNow();>
</form>

<script>
function EditNow()
{ 
winRef.focus(); 
winRef.document.getElementById("gbqfq").value="HELLO";
alert("Done!");
}
</script>
  Reveal hidden contents

IUIAutomation - Topic with framework and examples

Au3Record.exe

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...