HelpMe: ; Show translation GuiControl,,cheat, % words%translationPos% Return
GuiClose: GuiEscape: ExitApp
GetChildHWND(_parentHWND, _childClassNN) ; window's Unique ID, text or ClassNN of one of its controls { ; return HWND (unique ID) of that control WinGetPos parentX, parentY,,,ahk_id %_parentHWND% IfEqual parentX,, Return ; Parent window not found (possibly due to DetectHiddenWindows). ControlGetPos childX, childY,,, %_childClassNN%, ahk_id %_parentHWND% IfEqual childX,, Return ; Child window not found, so return a blank value. ; Relativ child coordinates -> screen coordinates, 32-bit params combined to 64-bit POINT structure Return DllCall("WindowFromPoint", "Int", childX + parentX, "Int", childY + parentY) }
Hex2Bin(ByRef @bin, _hex) ; write _hex to the address of @bin { VarSetCapacity(@bin, StrLen(_hex)//2, 0) Loop Parse, _hex if (A_Index & 1) ; Odd x = %A_LoopField% ; Odd digit else DllCall("RtlFillMemory", "UInt",&@bin+A_Index//2-1, "UInt",1, "UChar","0x" x A_LoopField) }
Marsh Posté le 26-04-2012 à 14:07:12
Bonjour,
J'ai besoin d'ouvrir un fichier avec autohotkey, de convertir le contenu en ANSI et de l'afficher dans une msgbox.
Comment procéder ?
j'ai trouvé ce code mais je ne sais pas l'exploiter :
words =
(
59307030893057304430
wonderful (subarashii)
6F304430
yes (hai)
2654
no (iie)
1A590652
perhaps (?)
226F575B
kanji ()
)
StringSplit words, words, `n
translationPos = 0
Gui Font, s60 w800 c8000FF, Arial Unicode MS ; should be always installed
Gui Add, Text, w700 h150 center vword gNextWord ; click also activates
Gui Add, Picture, w32 h32 x10 y200 vhelp gHelpMe Icon3, user32.dll
Gui Font, s12 w100 c200080, Arial
Gui Add, Text, w300 h25 x50 y200 vcheat gHelpMe ; click show translation
Gui Show, w720 h250, Learn Japanese!
id := WinExist("A" )
hWnd := GetChildHWND(id, "Static1" )
NextWord:
SetTimer NextWord, 3000 ; (Re)start timer, edit delay in ms
translationPos := Mod(translationPos,words0) + 2
wordPos := translationPos - 1
Hex2Bin(japanese, words%wordPos%)
DllCall("SendMessageW", "UInt",hWnd, "UInt",0x0C, "UInt",0, "Uint",&japanese) ; WM_SETTEXT = 0x0C
GuiControl,,cheat, [Click for translation]
Return
HelpMe: ; Show translation
GuiControl,,cheat, % words%translationPos%
Return
GuiClose:
GuiEscape:
ExitApp
GetChildHWND(_parentHWND, _childClassNN) ; window's Unique ID, text or ClassNN of one of its controls
{ ; return HWND (unique ID) of that control
WinGetPos parentX, parentY,,,ahk_id %_parentHWND%
IfEqual parentX,, Return ; Parent window not found (possibly due to DetectHiddenWindows).
ControlGetPos childX, childY,,, %_childClassNN%, ahk_id %_parentHWND%
IfEqual childX,, Return ; Child window not found, so return a blank value.
; Relativ child coordinates -> screen coordinates, 32-bit params combined to 64-bit POINT structure
Return DllCall("WindowFromPoint", "Int", childX + parentX, "Int", childY + parentY)
}
Hex2Bin(ByRef @bin, _hex) ; write _hex to the address of @bin
{
VarSetCapacity(@bin, StrLen(_hex)//2, 0)
Loop Parse, _hex
if (A_Index & 1) ; Odd
x = %A_LoopField% ; Odd digit
else
DllCall("RtlFillMemory", "UInt",&@bin+A_Index//2-1, "UInt",1, "UChar","0x" x A_LoopField)
}
Quelqu'un peut-il m'aider ?
Merci d'avance !