Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

pperiklis

macrumors newbie
Original poster
Oct 12, 2007
4
0
I need to use a webpage every time I want to translate a word from english to greek. I found out that instead of using the search command on the page I can just type http://www.in.gr/dictionary/lookup.asp?Word=unknown&x=0&y=0 in the address bar and replace the word unknown with the one I want to translate.
My question is: Can someone provide me with a script in which I can give just the word and get the results from the webpage "sherlock style"?
P.S. I know that sherlock already does translate from english to greek but the translations are quite poor.
 

harisdmac

macrumors member
Aug 16, 2006
46
0
Try using Javascript within your html code, or php (if its supported by your server).
There are plenty examples on net on how to invoke urls with parameters and parse the generated html code.
However, Keep in mind that special copyrights might apply for the usage of the in.gr dictionary.
 

xUKHCx

Administrator emeritus
Jan 15, 2006
12,583
9
The Kop
Try using Javascript within your html code, or php (if its supported by your server).
There are plenty examples on net on how to invoke urls with parameters and parse the generated html code.
However, Keep in mind that special copyrights might apply for the usage of the in.gr dictionary.

I thought the OP was asking for an applescript or something similar that they could run when they wanted to translate a word for personal use.
 

pperiklis

macrumors newbie
Original poster
Oct 12, 2007
4
0
I have no intension on violating copyrights. I just want a script that will do the exact same job as the web page while I'm connected to the internet. By sherlock style I mean that it will be like a small window divided in 2 sections which I can keep open during the time I write what I want in Pages so that I don' t go back and forth whenever I need to translate a word. I wish I could do it myself but I don' t have the skills or the time to learn how.
 

bbarnhart

macrumors 6502a
Jan 16, 2002
824
1
Regardless of laws and copyrights and other bad things, you will need an application or a HTML server or something to process the results from the translation server. Easiest thing would be a HTML server either locally on your box or on your iWeb ("I'm on ur iWEbz, tranzlatn yur Eglish")

I can't think of a way to run a JavaScript in a browser by loading the file. If this can be overcome, it would be a fairly easy task to create a page with three things

1 English text box for word
2 Button to press
3 Box to receive the resulting translation
 

toddburch

macrumors 6502a
Dec 4, 2006
748
0
Katy, Texas
Here's a bookmarklet, maybe it will speed you up.

Code:
javascript: window.location="http://www.in.gr/dictionary/lookup.asp?Word="+prompt("Enter a word");

Copy the above into the clipboard. Create a new bookmark on your Bar (I'll assume you are using Safari). Give the bookmark a name, like "Translate to Greek" and then paste the above javascript code as the address. (It will look like the data wasn't pasted, but if you CMD+left arrow, you'll see it there, and you'll also see Safari added %20 codes for all the blanks.)

Close the bookmark editor. When you click the link, you'll get a window prompt to enter the word you want translated. When you click OK, it will take you to the website with the word you want already appended to the URL. The efficiency you will get from this is the word you want will be on the webpage on the your first display. No more going to the page, entering the word, and then waiting to have the page reload.

If that web site structured their output document a little better (like if they gave the particular <table> you wanted an "id=.." attribute, parsing it to redisplay in a more succinct manner would have been fairly easy. As it is now, any parsing applied to that document would probably fail the first time they changed anything in its layout. (well, maybe not that dramatic, but it would be very prone to fail)

Perhaps this will be a good compromise between what you asked for ( a lot ) and what I'm giving you.

Todd
 

toddburch

macrumors 6502a
Dec 4, 2006
748
0
Katy, Texas
I was just reading up on (learning about) Sticky Notes. Pretty cool facility.

If Pages and Sticky Notes were scriptable (and they probably are with AppleScript), this might be a nice flow:

Highlight (select) a word in Pages. Right click on the word to send the selection to a script (visualize Windows Explorer, where it allows you to customize its right click context menu). The script would then build the url and read the page output (I'm visualizing a Ruby script with an open-uri call).

Then, the script parses the html, sucks out the table data, and then calls Sticky Notes to display the parsed data.

That would be very slick.

Todd
 

pperiklis

macrumors newbie
Original poster
Oct 12, 2007
4
0
Todd, I couldn' t thank you enough!

"Perhaps this will be a good compromise between what you asked for ( a lot ) and what I'm giving you"

You are absolutely right on that also. This made my search a lot faster.

If what you are suggesting in your second post is possible, that would be even greater!
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.