Autor Thema: Mal'n kleines Gimmick...  (Gelesen 1589 mal)

Offline jo@chim

  • Aktives Mitglied
  • ***
  • Beiträge: 246
  • Geschlecht: Männlich
Mal'n kleines Gimmick...
« am: 16.10.15 - 10:44:51 »
Sollte selbsterklärend sein  :)

Code
Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long

Sub gTranslate(TextToTranslate As String, appLng As String)	
	If appLng<>"e" Then
		text1$="Bitte wählen Sie einen zu übersetzenden Text aus."
		text2$="Übersetzer"
		lng$="de"
		dom$="de"
	Else
		text1$="Please select text to translate."
		text2$="Translator"
		lng$="en"
		dom$="com"
	End If
	
	TextToTranslate=Join(Split(TextToTranslate,Chr$(34)),"''")
	TextToTranslate=Join(Split(TextToTranslate,Chr$(10)),"LBREAK")
	TextToTranslate=Join(Split(TextToTranslate,Chr$(13)),"LBREAK")
	TextToTranslate=Join(Split(TextToTranslate,"LBREAKLBREAK"),"LBREAK")
	TextToTranslate =Join(Split(urlEncode(TextToTranslate),"LBREAK"), "%0D%0A")
	
	If TextToTranslate = "" Then
		MsgBox text1$, 48, text2$
		Exit Sub
	End If
	
	ret= ShellExecute(0, "Open", "https://translate.google." & dom$ & "/?hl=" & lng$ & "#auto/" & lng$ & "/" & TextToTranslate , 0, 0, 1) 	
End Sub

Aufruf z.B. mit
Code
Call gTranslate(uidoc.GetSelectedText() ,"d")
« Letzte Änderung: 16.10.15 - 14:22:52 von jo@chim »
Gruss,
Achim
-------------------
IBM Certified Advanced Application Developer Lotus Notes and Domino 7

Driri

  • Gast
Re: Mal'n kleines Gimmick...
« Antwort #1 am: 16.10.15 - 11:44:17 »
Schicke Sache, danke fürs Teilen :-)

 

Impressum Atnotes.de  -  Powered by Syslords Solutions  -  Datenschutz