@echo off
title Translate EN To CN
:START
cd C:\Program Files (x86)\Google\Chrome\Application
SET /P TRANSLATE=
IF /I "%TRANSLATE%" NEQ "%TRANSLATE%" GOTO TRANSLATED
:TRANSLATED
chrome.exe https://translate.google.com/#en/zh-CN/"%TRANSLATE%"
cls
GOTO START
import os
import webbrowser
os.system('title Translate EN To CN')
gt="https://translate.google.com/#en/zh-CN/"
while True:
translate= raw_input("")
webbrowser.open_new(gt+translate)
os.system('cls')
You should learn some Python. It’s really easy to learn it. Here is how you would open your URL in Python:
url = 'http://www.python.org/'
# Open URL in a new tab, if a browser window is already open.
webbrowser.open_new_tab(url + 'doc/')
# Open URL in new window, raising the window if possible.
webbrowser.open_new(url)
what if you could take the value that the translator puts out and put that in the batch so you don’t have to go on the internet O:
probably hard to make
Nice, can’t test it right now, but it should work.
Implementing the Google API is a bit more complicated than this because you have to create a dev account etc.