Leaderboard
Popular Content
Showing content with the highest reputation on 05/18/2013 in all areas
-
You are forgetting alignment. When you add 4096 to 17920 and then align that result on specified value (IMAGE_OPTIONAL_HEADER.SectionAlignment) you should get 24576. Try it.1 point
-
Language translation
mesale0077 reacted to UEZ for a topic
What I did so far using Bing as translator: ;coded by UEZ 2013 #include <Array.au3> $sFile = FileRead("c:\Temp\Test\English.properties") $sText = StringStripCR(StringRegExpReplace($sFile, "(.*)(<<>>.*)", "$1")) $aText = StringSplit($sText, @LF, 2) Global $sInput For $i = 0 To UBound($aText) - 1 $sInput &= $aText[$i] & "^" Next $sResult = BingTranslator($sInput, "en", "tr") $hFile = FileOpen(@ScriptDir & "\Translated.properties", 2) FileWrite($hFile, $sResult) FileClose($hFile) Exit Func BingTranslator($sText, $sLanguageFrom, $sLanguageTo, $iID = "68D088969D79A8B23AF8585CC83EBA2A05A97651", $sDelim = "<<>>") ;~ Local Const $sURL = "http://api.microsofttranslator.com/V2/ajax.svc/Translate?appId=" & $iID & "&from=" & $sLanguageFrom & "&to=" & $sLanguageTo & "&text=" & $sText & "&options=text/html" Local $iL = 3000, $iPerc Local $iLenght = Int(StringLen($sText) / $iL), $sTokens, $i, $j, $y, $sTranslated, $bTrans, $sTrans, $sResult, $sURL If $iLenght Then Local $aSplit = StringSplit($sText, "^", 2) ProgressOn("Progress", "Translating", "Translating ... 0 %") Local $iUB = UBound($aSplit) - 1, $iSleep = 1000 $y = 0 Do If StringLen($sTokens) + $aSplit[$i + 1] > $iL Then Sleep($iSleep) $sURL = "http://api.microsofttranslator.com/V2/Http.svc/Translate?appId=" & $iID & "&from=" & $sLanguageFrom & "&to=" & $sLanguageTo & "&text=" & StringRegExpReplace($sTokens, "[&%]*", "") $bTrans = InetRead($sURL) If @error Then ConsoleWrite("InetRead error " & @error & @CRLF) $sTrans = BinaryToString($bTrans, 4) $sResult = StringRegExpReplace($sTrans, ".*>(.*)<.*", "$1") $aTmp = StringSplit($sResult, "^", 2) For $j = 0 To UBound($aTmp) - 2 $sTranslated &= $aSplit[$y] & $sDelim & $aTmp[$j] & @CRLF $y += 1 Next $sTokens = "" EndIf $iPerc = Round(100 * ($i - 1) / $iUB, 0) ProgressSet($iPerc, "Translating ... " & $iPerc & " %") $sTokens &= StringStripWS($aSplit[$i], 3) & "^" $i += 1 Until $i = $iUB Sleep($iSleep) $sURL = "http://api.microsofttranslator.com/V2/Http.svc/Translate?appId=" & $iID & "&from=" & $sLanguageFrom & "&to=" & $sLanguageTo & "&text=" & StringRegExpReplace($sTokens, "[&%]*", "") $bTrans = InetRead($sURL) If @error Then ConsoleWrite("InetRead error " & @error & @CRLF) $sTrans = BinaryToString($bTrans, 4) $sResult = StringRegExpReplace($sTrans, ".*>(.*)<.*", "$1") $aTmp = StringSplit($sResult, "^", 2) If Not @error Then For $j = 0 To UBound($aTmp) - 2 $sTranslated &= $aSplit[$y] & $sDelim & $aTmp[$j] & @CRLF $y += 1 Next EndIf ProgressOff() Return $sTranslated Else $sURL = "http://api.microsofttranslator.com/V2/Http.svc/Translate?appId=" & $iID & "&from=" & $sLanguageFrom & "&to=" & $sLanguageTo & "&text=" & StringRegExpReplace($sText, "[%&]*", ""); & "&options=text/html" Local $sTranslated = InetRead($sURL) If @error Then Return SetError(1, @error, 0) $sTranslated = StringRegExpReplace(BinaryToString($sTranslated, 4), ".*>(.*)<.*", "$1") Return $sTranslated EndIf EndFunc I've not much experiences with this kind of stuff. Modify the paths appropriately. Br, UEZ1 point -
Language translation
mesale0077 reacted to Celtic88 for a topic
; by Mrbenkali Opt("GUIONEVENTMODE", 1) Global $link = "http://translate.google.com/" Global $oHTTP = ObjCreate("winhttp.winhttprequest.5.1") Global $TITEL = "AUTOIT IS SIMPL ! " Global $SCRIPTGUI = GUICreate($TITEL, 846, 550, -1, -1, 0X00040000) GUISetOnEvent(-3, "__EXIT") Global $EDIT1 = GUICtrlCreateEdit("", 0, 0, 844, 212) GUICtrlSetFont($EDIT1, 24, 400, 0, "Arial") Global $Edit2 = GUICtrlCreateEdit("", 0, 216, 844, 212) GUICtrlSetFont($Edit2, 24, 400, 0, "Arial") GUICtrlSetBkColor($Edit2, 0XFFFFFF) GUICtrlCreateGroup("TRANSLATE TO ", 8, 432, 830, 89) Global $COMBO1 = GUICtrlCreateCombo("", 36, 471, 127, 25, 2097155) GUICtrlSetOnEvent($COMBO1, "GOTRAN") GUICtrlSetResizing($COMBO1, 65) GUICtrlSetData($COMBO1, lGUI()) Global $Group1 = GUICtrlCreateGroup("SPEAK ", 364, 448, 437, 65) Global $Label1 = GUICtrlCreateLabel("", 380, 476, 100, 17) Global $BUTTON1 = GUICtrlCreateButton("SPEAK", 499, 468, 99, 33) GUICtrlSetOnEvent($BUTTON1, "GOSPEAK") GUICtrlSetResizing($BUTTON1, 65) Global $Checkbox1 = GUICtrlCreateCheckbox("TRANSLATE TEXT", 647, 475, 121, 17) GUISetState() While True Sleep(1000) WEnd Func GOSPEAK() Local $readtxt If GUICtrlRead($Checkbox1) = 1 Then $readtxt = GUICtrlRead($Edit2) Else $readtxt = GUICtrlRead($EDIT1) EndIf If $readtxt = "" Then Return WinSetTitle($SCRIPTGUI, "", "WAIT DOWNLOAD DATA...") GOOGLESPEEK($readtxt) WinSetTitle($SCRIPTGUI, "", $TITEL) EndFunc ;==>GOSPEAK Func GOTRAN() Local $readtxt = GUICtrlRead($EDIT1) If $readtxt = "" Then Return WinSetTitle($SCRIPTGUI, "", "WAIT DOWNLOAD DATA...") GOOGLETRANS($readtxt) WinSetTitle($SCRIPTGUI, "", $TITEL) EndFunc ;==>GOTRAN Func LANGOG() Return SLANG(GUICtrlRead($COMBO1), 2, 1) EndFunc ;==>LANGOG Func GOOGLETRANS($TEXTTOTRANS) Local $TXT, $STEXT1, $STEXT, $STEXT2, $STEXT3, $STEXT4, $STEXT5, $GETTT GUICtrlSetData($Label1, SLANG(DETLANG(StringLeft(StringRegExpReplace($TEXTTOTRANS, "\r\n|\r|\n", Chr(32)), 90), 1), 1)) GUICtrlSetData($Edit2, "") $STEXT = StringSplit($TEXTTOTRANS, @CRLF, 1) For $i = 1 To $STEXT[0] $STEXT1 = StringSplit($STEXT[$i], Chr(32), 1) For $O = 1 To $STEXT1[0] $TXT &= $STEXT1[$O] & Chr(32) If StringLen($TXT) > 90 Or $O = $STEXT1[0] Then $STEXT2 = StringSplit($TXT, ".") For $z = 1 To $STEXT2[0] $STEXT3 = StringSplit($STEXT2[$z], '"') For $L = 1 To $STEXT3[0] $STEXT4 = StringSplit($STEXT3[$L], '?') For $M = 1 To $STEXT4[0] $STEXT5 = StringSplit($STEXT4[$M], '!') For $S = 1 To $STEXT5[0] If StringIsSpace($STEXT5[$S]) Then ContinueLoop $GETTT = TRANTXT($STEXT5[$S]) GUICtrlSetData($Edit2, GUICtrlRead($Edit2) & $GETTT & " ") $TXT = "" If $S <> $STEXT5[0] Then GUICtrlSetData($Edit2, GUICtrlRead($Edit2) & '!') Next If $M <> $STEXT4[0] Then GUICtrlSetData($Edit2, GUICtrlRead($Edit2) & '?') Next If $L <> $STEXT3[0] Then GUICtrlSetData($Edit2, GUICtrlRead($Edit2) & '"') Next If $z <> $STEXT2[0] Then GUICtrlSetData($Edit2, GUICtrlRead($Edit2) & ".") Next EndIf Next If $i <> $STEXT[0] Then GUICtrlSetData($Edit2, GUICtrlRead($Edit2) & @CRLF) Next EndFunc ;==>GOOGLETRANS Func GOOGLESPEEK($TEXTTOSPEEK) Local $TXT, $OPEN, $STEXT1, $READ = "", $ENCODESSTRING, $RESTRING, $LANG, $MPFIL = FileGetShortName(@ScriptDir & "\" & Random(1, 99, 1) & ".MP3") $RESTRING = StringRegExpReplace($TEXTTOSPEEK, "\r\n|\r|\n", " ") $LANG = DETLANG(StringLeft($RESTRING, 90), 1) GUICtrlSetData($Label1, SLANG($LANG, 1)) $STEXT1 = StringSplit($RESTRING, " ") For $O = 1 To $STEXT1[0] $TXT &= $STEXT1[$O] & " " If StringLen($TXT) > 90 Or $O = $STEXT1[0] Then $ENCODESSTRING = URIENCODE($TXT) $READ &= StringTrimLeft(InetRead($link & "translate_tts?ie=UTF-8&tl=" & $LANG & "&q=" & $ENCODESSTRING, 1), 2) $TXT = "" EndIf Next $OPEN = FileOpen($MPFIL, 18) FileWrite($OPEN, "0X" & $READ) FileClose($OPEN) ShellExecute(@AutoItExe, '/AUTOIT3EXECUTELINE "IF SOUNDPLAY(''' & $MPFIL & ''' ,1) THEN FILEDELETE(''' & $MPFIL & ''')"') EndFunc ;==>GOOGLESPEEK Func TRANTXT($TXT) Local $ENCODESSTRING, $READ, $DATA $ENCODESSTRING = URIENCODE($TXT) $lghg = LANGOG() If StringInStr("ar fa iw ur yi", $lghg) > 0 Then GUICtrlSetStyle($Edit2, 3152064 + 2) Else GUICtrlSetStyle($Edit2, 3152064 + 0) EndIf $READ = DOWN($link & "translate_a/t?client=t&sl=auto&text=" & $ENCODESSTRING & "&tl=" & $lghg) $DATA = StringSplit($READ, '"') Return $DATA[2] EndFunc ;==>TRANTXT Func DOWN($URL) $oHTTP.Open("GET", $URL, False) $oHTTP.SetRequestHeader("User-Agent", "Mozilla/5.0 (Windows NT 6.1; rv:9.0.1) Gecko/20100101 Firefox/9.0.1") $oHTTP.Send("") $oReceived = $oHTTP.ResponseText Return $oReceived EndFunc ;==>DOWN Func URIENCODE($SDATA) Local $ADATA = StringSplit(BinaryToString(StringToBinary($SDATA, 4), 1), "") Local $NCHAR $SDATA = "" For $i = 1 To $ADATA[0] $NCHAR = Asc($ADATA[$i]) Switch $NCHAR Case 45, 46, 48 To 57, 65 To 90, 95, 97 To 122, 126 $SDATA &= $ADATA[$i] Case 32 $SDATA &= "+" Case Else $SDATA &= "%" & Hex($NCHAR, 2) EndSwitch Next Return $SDATA EndFunc ;==>URIENCODE Func DETLANG($STRI, $OPTT) Local $TST, $LANGGG $TST = DOWN($link & "translate_a/t?client=t&sl=auto&text=" & URIENCODE(StringLeft($STRI, 33))) $LANGGG = StringLeft(StringTrimLeft($TST, StringInStr($TST, '[["', 0, -1) + 2), 2) Return $LANGGG EndFunc ;==>DETLANG Func SLANG($LANGG, $OPT, $OOPT = 2) $SLIS = StringSplit(LISL(), ";") For $i = 1 To $SLIS[0] Local $GETl = StringSplit($SLIS[$i], "|") If StringInStr($GETl[$OOPT], $LANGG, 2) Then Return $GETl[$OPT] EndIf Next EndFunc ;==>SLANG Func lGUI() Local $llol, $SLIS $SLIS = StringSplit(LISL(), ";") For $i = 1 To $SLIS[0] $llol &= StringLeft($SLIS[$i], StringInStr($SLIS[$i], "|")) Next Return $llol EndFunc ;==>lGUI Func LISL() Local $langlis = "Afrikaans|af;Albanian|sq;Arabic|ar;Armenian|hy;Azerbaijani|az;Basque|eu;Belarusian|be;Bengali|bn;Bulgarian|bg;Catalan|ca;Chinese|zh-CN;Croatian|hr;Czech|cs;Danish|da;Dutch|nl;English|en;Esperanto|eo;" & _ "Estonian|et;Filipino|tl;Finnish|fi;French|fr;Galician|gl;Georgian|ka;German|de;Greek|el;Gujarati|gu;Haitian Creole|ht;Hebrew|iw;Hindi|hi;Hungarian|hu;Icelandic|is;Indonesian|id;Irish|ga;Italian|it;" & _ "Japanese|ja;Kannada|kn;Khmer|km;Korean|ko;Lao|lo;Latin|la;Latvian|lv;Lithuanian|lt;Macedonian|mk;Malay|ms;Maltese|mt;Norwegian|no;Persian|fa;Polish|pl;Portuguese|pt;Romanian|ro;Russian|ru;" & _ "Serbian|sr;Slovak|sk;Slovenian|sl;Spanish|es;Swahili|sw;Swedish|sv;Tamil|ta;Telugu|te;Thai|th;Turkish|tr;Ukrainian|uk;Urdu|ur;Vietnamese|vi;Welsh|cy;Yiddish|yi" Return $langlis EndFunc ;==>LISL Func __EXIT() Exit EndFunc ;==>__EXIT1 point -
Regdelete, my problem
AdemSezgin reacted to guinness for a topic
Search the Forum for _IsRegistryExist and then do something like this... If _IsRegistryExist('REGKEY') Then Run('notepad.exe')1 point -
1 point
-
Looks like you get the rare opportunity to revist your script, and re-write it even better! (and store backups)1 point
-
With media players if you want to skip songs or pause/play etc... then my suggestion is look at _SendMessage and sending the command APPCOMMAND_MEDIA_STOP (for example.) You can find out how by googling with those keywords I gave you. #include <SendMessage.au3> #include <WinAPI.au3> _SendMessage(VLC_HWND, $WM_APPCOMMAND, 0, _WinAPI_MakeLong(0, $APPCOMMAND_MEDIA_STOP))1 point
-
So anyway JohnOne, do you have anything concrete yet? Maybe it doesn't look like that but if I'm reading you right this is really simple task. Choose hashing algo, load (read) file, locate resources section, hash everything except that section ...and you're done.1 point
-
Thank you kindly Gentlebodes, well enough for me to be getting on with there. I did find some sort of reading but it seemed rather convoluted.1 point