Jump to content

Javascript code help


careca
 Share

Recommended Posts

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.

Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Link to comment
Share on other sites

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.

Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Link to comment
Share on other sites

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>
Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

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

  • Recently Browsing   0 members

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