; Rewritten by Yuraj, originally by Odklizec #include-once #include #Include Global Const $WM_RUNSCRIPTCODE = 0x08C7 Global Const $RUNSCRIPTCODE_LOUD = 0 Global Const $RUNSCRIPTCODE_QUIET = 1 Local $iItem, $pMemory, $tMemMap, $pText,$pid Func SendScriptMMB($title,$script) ; get handle of MMB window $hwnd = WinGetHandle($title) if @error Then ;~ MsgBox(48,"","Can't find window with title " & $title) exit endif $slen = stringlen($script) +1 $str = "char[" & $slen & "]"; structure item must be "char" $struct= DllStructCreate($str); create a struct for the string so we can get a pointer to it if @error Then ;~ MsgBox(0,"","Error in DllStructCreate " & @error) exit endif $iItem = DllStructGetSize($struct); get structure size $pMemory = _MemInit($hwnd, $iItem, $tMemMap); init memory and return pointer to initialized memory in target app DllStructSetData($struct, 1, $script); set string to structure $pointer = DllStructGetPtr($struct,1); pointer to string in structure _MemWrite($tMemMap, $pointer, $pMemory, $iItem); write string pointer to application memory _SendMessage($hwnd,$WM_RUNSCRIPTCODE,$RUNSCRIPTCODE_LOUD,$pMemory) If @error Then ;~ MsgBox(0,"", "_SendMessage Error: " & @error) Exit EndIf _MemFree($tMemMap);release the memory EndFunc