본문 바로가기

일상/메모

예비용 01

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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
 
정보가져오기:
;~ FileSelectFile, path
;~ MsgBox, % path
 
엑셀명칭 := ComObjCreate("excel.application")
엑셀명칭.workbooks.open("D:\AHK\등록 리스트.xlsx")
;~ 엑셀명칭.visible := false   ;엑셀창 보이지않기, true로 하면 엑셀창 보임.
;~ 엑셀명칭.visible := true   ;엑셀창 보이지않기, true로 하면 엑셀창 보임.
;~ 엑셀명칭.DisplayAlerts := False ; 엑셀창에서 확인, 알림 창 생성 금지
 
 
 
sel=D%시작번호%
제목 := 엑셀명칭.range(sel).Value
 
sel=E%시작번호%
파일경로 := 엑셀명칭.range(sel).Value
 
;~ MsgBox, % 제목 "`r" 파일경로
return
 
 
블로그열기:
 
run, chrome.exe --new-window  "https://we2e2e.tistory.com/manage"
Sleep, 500
WinActivate, 블로그관리 | TISTORY - Chrome
Sleep, 500
WinMove, 블로그관리 | TISTORY - Chrome,, 0,0,1200,1040
 
write:="https://we2e2e.tistory.com/manage/newpost/?type=post&returnURL=%2Fmanage%2Fposts%2F"
run, chrome.exe %write%
 
Sleep, 500
send, {right}
Sleep, 500
send, {enter}
 
 
 
return
 
 
 
제목작성:
Send, ^a
Sleep, 200
SendInput, %제목%
SendInput, {tab}
return
 
카테고리선택:
WinWait, 글쓰기 - Chrome,
IfWinNotActive, 글쓰기 - Chrome, , WinActivate, 글쓰기 - Chrome,
WinWaitActive, 글쓰기 - Chrome,
MouseClick, left,  318,  246
Sleep, 300
MouseClick, left,  247,  326
Sleep, 100
return
 
 
사진첨부:
 
;~ 첩부 아이콘 선택 클릭
WinWait, 글쓰기 - Chrome,
IfWinNotActive, 글쓰기 - Chrome, , WinActivate, 글쓰기 - Chrome,
WinWaitActive, 글쓰기 - Chrome,
MouseClick, left,  174,  149
Sleep, 200
MouseClick, left,  164,  199
Sleep, 200
WinWait, 열기,
IfWinNotActive, 열기, , WinActivate, 열기,
WinWaitActive, 열기,
 
;~ 경로입력
Sleep, 500
MouseClick, left,  565,  51
Sleep, 200
SendInput, %파일경로%
Sleep, 100
SendInput, {enter}
Sleep, 100
 
 
 
;~ 이미지 선택및 적용
WinWait, 열기,
IfWinNotActive, 열기, , WinActivate, 열기,
WinWaitActive, 열기,
MouseClick, left,  583,  392
Sleep, 100
 
Send, ^a
 
loop, 3
{
SendInput, {tab}
Sleep, 100
}
 
Sleep, 100
SendInput, {enter}
Sleep, 1500
 
 
;~ 완료 공개 공개 발행
WinWait, 글쓰기 - Chrome,
IfWinNotActive, 글쓰기 - Chrome, , WinActivate, 글쓰기 - Chrome,
WinWaitActive, 글쓰기 - Chrome,
MouseClick, left,  1090,  1000
Sleep, 200
MouseClick, left,  252,  694
Sleep, 200
MouseClick, left,  647,  971
Sleep, 1000
 
;~ 창닫기
WinWait, 블로그관리 | TISTORY - Chrome,
IfWinNotActive, 블로그관리 | TISTORY - Chrome, , WinActivate, 블로그관리 | TISTORY - Chrome,
WinWaitActive, 블로그관리 | TISTORY - Chrome,
Send, ^w
Sleep, 100
Send, ^w
Sleep, 100
 
 
;~ 다음줄 선택
시작번호++
 
 
return
 
 
 
 
 
return
 
loop, 361
{
FileReadLine,linecode,codeall.txt, %a_index%
FileCreateDir, % linecode
ToolTip, %a_index% / 361
;~ MsgBox, % linecode
 
    URL := "http://admin.ngoods.kr/omarket_auto/goodsinfo.php?goods_code=" linecode
    Result := ReadURL(URL)
    ;~ MsgBox, % Result
 
    dir = %A_WorkingDir%\%linecode%\
    ;~ MsgBox, % dir
 
    pos=1
    while(pos := RegExMatch(Result, "<img src=(.*?)>", match, pos))
        {
        pos += strlen(match)
        RegExMatch(match1, "http(.*)(.jpg|.gif)", imagelink)
        RegExMatch(imagelink, "[^\/]*(\.jpg|\.gif)$", filename)
        URLDownloadToFile, %imagelink% , %dir% %filename%
        }
Sleep, 1000
}
 
return
 
 
;~ 함수영역
ReadURL(URL, encoding = "utf-8") {
    static a := "AutoHotkey/" A_AhkVersion
    if (!DllCall("LoadLibrary""str""wininet"|| !(h := DllCall("wininet\InternetOpen""str", a, "uint"1"ptr"0"ptr"0"uint"0"ptr")))
        return 0
    c := s := 0, o := ""
    if (f := DllCall("wininet\InternetOpenUrl""ptr", h, "str", url, "ptr"0"uint"0"uint"0x80003000"ptr"0"ptr"))
    {
        while (DllCall("wininet\InternetQueryDataAvailable""ptr", f, "uint*", s, "uint"0"ptr"0&& s > 0)
        {
            VarSetCapacity(b, s, 0)
            DllCall("wininet\InternetReadFile""ptr", f, "ptr"&b, "uint", s, "uint*", r)
            o .= StrGet(&b, r >> (encoding = "utf-16" || encoding = "cp1200"), encoding)
        }
        DllCall("wininet\InternetCloseHandle""ptr", f)
    }
    DllCall("wininet\InternetCloseHandle""ptr", h)
    return o
}
 
 
cs

'일상 > 메모' 카테고리의 다른 글

예비용3  (0) 2022.08.30
예비용2  (0) 2022.08.14