반응형
Recent Posts
Recent Comments
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
Tags
- 식의 설명
- SetControlDelay
- IfWinExist
- EnvDiv
- 함수
- EnvSub
- ControlGetText
- Var:=식
- StringGetPos
- IF (식)
- SetMouseDelay
- autohotkey
- SetKeyDelay
- MouseClick
- DetectHiddenWindows
- SetEnv
- EnvAdd
- 식
- SetTitleMatchMode
- API
- if(식)
- if
- ControlSend
- IfInString
- EnvSet
- Threads
- Menu
- 배열
- EnvMult
- Blocks
Archives
- Today
- Total
ㄴrㅎnㅂrㄹrㄱi
이미지파일을 HEX 변환 생성하는 프로그램 본문
반응형
http://www.autohotkey.com/board/index.php?app=core&module=search&do=search&fromMainBar=1
StringCaseSense On Chars = ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ gui, add, button, w100 gOpen,Open File gui, add, text, x+10,var name: gui, add, edit, x+10 w100 vName,File gui, add, text, x+10,extract to: gui, add, edit, x+10 w100 vwriteto,file.ext gui, add, edit, r40 w510 vOutput xm gui, show return Open: gui, submit, nohide fileselectFile,file BinRead(file,data) Bin2Hex(h,data,0) output = count = 0 loop, { if not h break stringleft, peice%A_index%,h,16000 stringtrimright,h, h,16000 output := output "`n" name "_peice" A_index " = " peice%A_index% count ++ } output := output "`n`nWriteFile(""" writeto """,""" loop, %count% output := output name "_peice" A_index "|" stringtrimright,output,output,1 output := output """) `n`n" function = (join`n WriteFile(file,peices) { global local Handle,data,hex Handle := DllCall("CreateFile","str",file,"Uint",0x40000000 ,"Uint",0,"UInt",0,"UInt",4,"Uint",0,"UInt",0) Loop,parse,peices,| { peice := `%A_loopfield`% data := data peice } Loop, { if strlen(data) = 0 break StringLeft, Hex, data, 2 StringTrimLeft, data, data, 2 Hex = 0x`%hex`% DllCall("WriteFile","UInt", Handle,"UChar *", Hex ,"UInt",1,"UInt *",UnusedVariable,"UInt",0) } DllCall("CloseHandle", "Uint", Handle) return } ) output := output function guicontrol,,output,%output% return Bin2Hex(ByRef h, ByRef b, n=0) ; n bytes binary data -> stream of 2-digit hex { ; n = 0: all (SetCapacity can be larger than used!) format = %A_FormatInteger% ; save original integer format SetFormat Integer, Hex ; for converting bytes to hex m := VarSetCapacity(b) If (n < 1 or n > m) n := m Address := &b h = Loop %n% { x := *Address ; get byte in hex StringTrimLeft x, x, 2 ; remove 0x x = 0%x% ; pad left StringRight x, x, 2 ; 2 hex digits h = %h%%x% Address++ } SetFormat Integer, %format% ; restore original format } BinRead(file, ByRef data, n=0, offset=0) { h := DllCall("CreateFile","Str",file,"Uint",0x80000000,"Uint",3,"UInt",0,"UInt",3,"Uint",0,"UInt",0) IfEqual h,-1, SetEnv, ErrorLevel, -1 IfNotEqual ErrorLevel,0,Return,0 ; couldn't open the file m = 0 ; seek to offset IfLess offset,0, SetEnv,m,2 r := DllCall("SetFilePointerEx","Uint",h,"Int64",offset,"UInt *",p,"Int",m) IfEqual r,0, SetEnv, ErrorLevel, -3 IfNotEqual ErrorLevel,0, { t = %ErrorLevel% ; save ErrorLevel to be returned DllCall("CloseHandle", "Uint", h) ErrorLevel = %t% ; return seek error Return 0 } m := DllCall("GetFileSize","UInt",h,"Int64 *",r) If (n < 1 or n > m) n := m Granted := VarSetCapacity(data, n, 0) IfLess Granted,%n%, { ErrorLevel = Mem=%Granted% Return 0 } result := DllCall("ReadFile","UInt",h,"Str",data,"UInt",n,"UInt *",Read,"UInt",0) if (!result or Read < n) t = -3 IfNotEqual ErrorLevel,0, SetEnv,t,%ErrorLevel% h := DllCall("CloseHandle", "Uint", h) IfEqual h,-1, SetEnv, ErrorLevel, -2 IfNotEqual t,,SetEnv, ErrorLevel, %t%-%ErrorLevel% Return Read }http://www.autohotkey.com/board/topic/9974-include-a-bitmap-in-your-uncompiled-script/?hl=the+image+above+was+created+by+the+script.
#singleinstance force #noenv gosub, definepicture WriteFile("logo.bmp",picture) gui, add, pic,x100,logo.bmp gui, add, text,xm,The Image above was created by the script. gui, show,, by Veovis return WriteFile(file,data) { Handle := DllCall("CreateFile","str",file,"Uint",0x40000000 ,"Uint",0,"UInt",0,"UInt",4,"Uint",0,"UInt",0) Loop { if strlen(data) = 0 break StringLeft, Hex, data, 2 StringTrimLeft, data, data, 2 Hex = 0x%Hex% DllCall("WriteFile","UInt", Handle,"UChar *", Hex ,"UInt",1,"UInt *",UnusedVariable,"UInt",0) } DllCall("CloseHandle", "Uint", Handle) return } definepicture: picture = ( join 0000010006003030000001000800a80e0000660000002020000001000800a ) return guiclose: exitapp
반응형
'AUTOHOTKEY > 스크립트' 카테고리의 다른 글
#INCLUDE SQLite.ahk - Functions to access SQLite3 DB's (0) | 2007.11.04 |
---|---|
DllCall: Basic FTP Functions (0) | 2007.10.29 |
암호 인코드 디코드 (0) | 2007.10.23 |
숫자에 콤마 찍기 (0) | 2007.10.23 |
SplashText Sizer - WYSIWYG (0) | 2007.10.23 |
Comments