Jump to content
Sign in to follow this  
careca

Javascript code help

Recommended Posts

careca

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

Paster - Main function is to paste text, but has more functions. (No longer mantained, switched to String Trigger)

OpenW - Open With... alternative, Open any file with any application, set it's icon, set application as default.

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

GPO Tool - Export/Import Group policy settings.

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.

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.

Firefox Profile Backup - Backup/restore previously saved profile.

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

Share this post


Link to post
Share on other sites
careca

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

Paster - Main function is to paste text, but has more functions. (No longer mantained, switched to String Trigger)

OpenW - Open With... alternative, Open any file with any application, set it's icon, set application as default.

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

GPO Tool - Export/Import Group policy settings.

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.

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.

Firefox Profile Backup - Backup/restore previously saved profile.

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

Share this post


Link to post
Share on other sites
careca

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

Paster - Main function is to paste text, but has more functions. (No longer mantained, switched to String Trigger)

OpenW - Open With... alternative, Open any file with any application, set it's icon, set application as default.

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

GPO Tool - Export/Import Group policy settings.

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.

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.

Firefox Profile Backup - Backup/restore previously saved profile.

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

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  

×