Advertisement
ParkSejun

Untitled

Oct 2nd, 2018
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.67 KB | None | 0 0
  1. #SingleInstance off
  2. CoordMode, Pixel ,Screen
  3. CoordMode, Mouse, Screen
  4. CoordMode, ToolTip, Screen
  5. global isRightClickDown, HTS1_Buy_Image_, HTS1_Sell_Image_, HTS1_Liquid_Image_
  6. hotkey, RButton Up, off
  7. gui, Login:font, , 굴림체
  8.  
  9. ComObjError(False)
  10. ;Gui, Add, Text, w205 center , 로그인 해주세요.
  11. Gui, Login:Add, Text, x11 y10 section , ID :
  12. Gui, Login:Add, Edit, ys-4 xs+28 w100 h20 vusername
  13. Gui, Login:Add, Text, xs+0 section y+9, PW :
  14. Gui, Login:Add, Edit, ys-4 xs+28 w100 h20 vpassword
  15. Gui, Login:Add, Button, x145 y5 w70 h47 glogin vlogin, 로그인
  16. ;Gui, Add, Button, r1 w100 gvalidate, validate
  17. Gui, Login:Show
  18. return
  19.  
  20. MainStart:
  21. MakeGui(1)
  22. MakeGui(2)
  23. MakeGui(3)
  24. MakeGui(4)
  25. Gui, 1:show
  26. Gui, 2:show
  27. Gui, 3:show
  28. Gui, 4:show
  29. return
  30.  
  31. GuiClose(GuiHwnd) { ; Declaring this parameter is optional.
  32. MsgBox 4,, Are you sure you want to close the GUI?
  33. ifMsgBox No
  34. return true ; true = 1
  35. exitapp
  36. }
  37.  
  38. HTS1_Buy:
  39. HTS1_Sell:
  40. HTS1_Liquid:
  41. HTS1_LT:
  42. HTS1_RB:
  43. HTS2_Buy:
  44. HTS2_Sell:
  45. HTS2_Liquid:
  46. HTS2_LT:
  47. HTS2_RB:
  48. HTS3_Buy:
  49. HTS3_Sell:
  50. HTS3_Liquid:
  51. HTS3_LT:
  52. HTS3_RB:
  53. HTS4_Buy:
  54. HTS4_Sell:
  55. HTS4_Liquid:
  56. HTS4_LT:
  57. HTS4_RB:
  58. getPosition(A_ThisLabel)
  59. return
  60.  
  61. HTS1_Buy_Image:
  62. HTS1_Sell_Image:
  63. HTS1_Liquid_Image:
  64. HTS2_Buy_Image:
  65. HTS2_Sell_Image:
  66. HTS2_Liquid_Image:
  67. HTS3_Buy_Image:
  68. HTS3_Sell_Image:
  69. HTS3_Liquid_Image:
  70. HTS4_Buy_Image:
  71. HTS4_Sell_Image:
  72. HTS4_Liquid_Image:
  73. GetImage(A_ThisLabel)
  74. return
  75.  
  76. RButton Up::isRightClickDown := true
  77.  
  78. f2::exitapp
  79.  
  80. F1::
  81. Gui, 1:Submit, nohide
  82. Gui, 2:Submit, nohide
  83. Gui, 3:Submit, nohide
  84. Gui, 4:Submit, nohide
  85.  
  86. word1 := "Buy"
  87. word2 := "Sell"
  88. word3 := "Liquid"
  89. /*
  90. HTS(번호1~4)_(대상=위의 3개)_ ...
  91. Already : 이미 한번 클릭했으면 없어질때까지 다시 클릭 안하기 위해서 있는 변수. 클릭했으면 true됨
  92. BeforeLiquid : 매수매도 전환시 청산 누르고할것인지 체크박스
  93. state : Buy Sell Liquid 중 하나로 설정됨. 마지막으로 수행한 명령이 뭔지 기억하는것. 처음 초기화는 Liquid임.
  94. */
  95.  
  96. loop, 4
  97. {
  98. idx := A_Index
  99. state%idx% := "Liquid"
  100. loop, 3
  101. {
  102. word := word%A_Index%
  103. t := "HTS" idx "_" word "_Already"
  104. %t% := false
  105. }
  106. }
  107.  
  108. Loop
  109. {
  110. loop, 4
  111. {
  112. idx := A_Index
  113. if(!HTS%idx%)
  114. continue
  115. loop, 3
  116. {
  117. word := word%A_Index%
  118. tAlready := "HTS" idx "_" word "_Already"
  119. if(!%tAlready%)
  120. {
  121. tImage := "HTS" idx "_" word "_Image_"
  122. if(IS(%tImage%))
  123. {
  124. ; 청산체크이면 현재상태 <-> 매수매도 체크하고 청산 클릭
  125. if(HTS%idx%_BeforeLiquid && ((state%idx% = "Sell" && word = "Buy") || (state%idx% = "Buy" && word = "Sell")))
  126. {
  127. tx := "HTS" idx "_Liquid_X"
  128. ty := "HTS" idx "_Liquid_Y"
  129. Click(%tx%, %ty%)
  130. sleep, 1000
  131. }
  132.  
  133. tx := "HTS" idx "_" word "_X"
  134. ty := "HTS" idx "_" word "_Y"
  135. Click(%tx%, %ty%)
  136. state%idx% := word
  137. %tAlready% := true
  138. }
  139. }
  140. else if(!IS(%tImage%))
  141. %tAlready% := false
  142. }
  143. }
  144. }
  145. return
  146.  
  147. Click(x, y)
  148. {
  149. MouseGetPos, sx, sy
  150. loop
  151. {
  152. MouseGetPos, mx, my
  153. if(mx = x && my = y)
  154. break
  155. MouseMove, %x%, %y%, 0
  156. }
  157. ;Click, %x%, %y%
  158. send, {LButton Down}{LButton Up}
  159. }
  160.  
  161. IS(fileName)
  162. {
  163. global
  164. ImageSearch, , , % HTS1_LT_X, % HTS1_LT_Y, % HTS1_RB_X, % HTS1_RB_Y, % fileName
  165. if !errorLevel
  166. return 1
  167. return 0
  168. }
  169.  
  170. GetImage(label)
  171. {
  172. File_Path := ""
  173. FileSelectFile, File_Path, , %A_ScriptDir%\, 업로드할 파일 선택, 이미지 파일 (*.bmp;*.gif;*.jpg;*.jps;*.mpo;*.jpeg;*.png;*.pns;*.svg;*.tiff;*.dds;*.wdp;*.emf;*.ico;*.png;*.wmf)
  174. if(File_Path = "")
  175. return
  176. GuiControl, , %label%, % File_Path
  177. %label%_ := File_Path
  178. }
  179.  
  180. GetPosition(label)
  181. {
  182. isRightClickDown := false
  183. hotkey, RButton Up, on
  184. while(!isRightClickDown)
  185. {
  186. MouseGetPos, mx, my
  187. tooltip,% "X: " mx ", Y: " my "`n마우스 오른쪽 클릭 : 좌표 결정"
  188. GuiControl, , %Label%_X, % mx
  189. GuiControl, , %Label%_Y, % my
  190. sleep, 10
  191. }
  192. tooltip
  193. MouseGetPos, mx, my
  194. hotkey, RButton Up, off
  195. %Label%_X := mx
  196. %Label%_Y := my
  197. GuiControl, , %Label%_X, % %Label%_X
  198. GuiControl, , %Label%_Y, % %Label%_Y
  199. }
  200.  
  201. MakeGui(Label)
  202. {
  203. global
  204.  
  205. Gui, %label%:font, bold
  206.  
  207. Gui, %label%:add, GroupBox, x15 y10 section w390 h465 Center cBlack
  208. Gui, %label%:add, CheckBox, xs+155 ys+0 center w80 vHTS%Label%, HTS %label%
  209. if(label = 1)
  210. GuiControl, , HTS%Label%, 1
  211.  
  212. Gui, %label%:Add, GroupBox, xs+20 ys+25 section w350 h185 +Center cRed, 이미지 설정
  213.  
  214. Gui, %label%:Add, GroupBox, xs+15 ys+20 section w100 h150 +Center cBlack, 매수 이미지
  215. Gui, %label%:Add, Picture, xs+10 ys+25 w80 h80 border vHTS%Label%_Buy_Image
  216. Gui, %label%:Add, Button, xs+5 ys+115 w90 h30 gHTS%Label%_Buy_Image, 이미지 변경
  217.  
  218. Gui, %label%:Add, GroupBox, xs+110 ys+0 section w100 h150 +Center cBlack, 매도 이미지
  219. Gui, %label%:Add, Picture, xs+10 ys+25 w80 h80 border vHTS%Label%_Sell_Image
  220. Gui, %label%:Add, Button, xs+5 ys+115 w90 h30 gHTS%Label%_Sell_Image, 이미지 변경
  221.  
  222. Gui, %label%:Add, GroupBox, xs+110 ys+0 section w100 h150 +Center cBlack, 청산 이미지
  223. Gui, %label%:Add, Picture, xs+10 ys+25 w80 h80 border vHTS%Label%_Liquid_Image
  224. Gui, %label%:Add, Button, xs+5 ys+115 w90 h30 gHTS%Label%_Liquid_Image, 이미지 변경
  225.  
  226.  
  227. Gui, %label%:Add, GroupBox, xs-235 ys+170 section w350 h114 +Center cBlue, 좌표 설정
  228.  
  229. Gui, %label%:Add, Text, xs+15 ys+25, 매수 좌표 :
  230. gui, %label%:font, s11
  231. Gui, %label%:Add, Edit, xs+89 ys+20 w65 h22 readonly Right vHTS%Label%_Buy_X
  232. Gui, %label%:Add, Edit, xs+160 ys+20 w65 h22 readonly Right vHTS%Label%_Buy_Y
  233. gui, %label%:font, s9
  234. gui, %label%:add, button, xs+233 ys+19 w100 h24 gHTS%Label%_Buy, 좌표 변경
  235. Gui, %label%:Add, Text, xs+15 ys+55, 매도 좌표 :
  236. gui, %label%:font, s11
  237. Gui, %label%:Add, Edit, xs+89 ys+50 w65 h22 readonly Right vHTS%Label%_Sell_X
  238. Gui, %label%:Add, Edit, xs+160 ys+50 w65 h22 readonly Right vHTS%Label%_Sell_Y
  239. gui, %label%:font, s9
  240. gui, %label%:add, button, xs+233 ys+49 w100 h24 gHTS%Label%_Sell, 좌표 변경
  241. Gui, %label%:Add, Text, xs+15 ys+85, 청산 좌표 :
  242. gui, %label%:font, s11
  243. Gui, %label%:Add, Edit, xs+89 ys+80 w65 h22 readonly Right vHTS%Label%_Liquid_X
  244. Gui, %label%:Add, Edit, xs+160 ys+80 w65 h22 readonly Right vHTS%Label%_Liquid_Y
  245. gui, %label%:font, s9
  246. gui, %label%:add, button, xs+233 ys+79 w100 h24 gHTS%Label%_liquid, 좌표 변경
  247.  
  248. Gui, %label%:Add, GroupBox, xs+0 ys+120 section w350 h95 +Center c00A000, 화면 인식 범위 설정
  249.  
  250. Gui, %label%:add, Text, xs+18 ys+30, 왼쪽 위 좌표 :
  251. gui, %label%:font, s11
  252. Gui, %label%:Add, Edit, xs+106 ys+25 w65 h22 readonly Right vHTS%label%_LT_X
  253. Gui, %label%:Add, Edit, xs+177 ys+25 w65 h22 readonly Right vHTS%label%_LT_Y
  254. gui, %label%:font, s9
  255. gui, %label%:add, button, xs+250 ys+24 w83 h24 gHTS%Label%_LT, 좌표 변경
  256.  
  257. Gui, %label%:add, Text, xs+5 ys+60, 오른쪽 밑 좌표 :
  258. gui, %label%:font, s11
  259. Gui, %label%:Add, Edit, xs+106 ys+55 w65 h22 readonly Right vHTS%label%_RB_X
  260. Gui, %label%:Add, Edit, xs+177 ys+55 w65 h22 readonly Right vHTS%label%_RB_Y
  261. gui, %label%:font, s9
  262. gui, %label%:add, button, xs+250 ys+54 w83 h24 gHTS%Label%_RB, 좌표 변경
  263.  
  264. Gui, %label%:Add, Checkbox, xs+0 ys+100 h22 vHTS%Label%_BeforeLiquid, 매수/매도 간 전환할 때 청산 후 매수/매도하기 ;(미적용)
  265. ;GuiControl, %label%:disable, HTS%Label%_BeforeLiquid
  266.  
  267. ;Gui, %label%:Show, , HTS %label%
  268. Gui, %label%:+LastFound
  269. return WinExist()
  270. }
  271.  
  272.  
  273. login:
  274. islogin := true
  275. goto, MainStart
  276. return
  277. gui,Login:submit,nohide
  278. guicontrol, Login:disable, login
  279.  
  280. winhttp :=
  281. winhttp := ComObjCreate("WinHttp.WinHttpRequest.5.1")
  282. winhttp.SetTimeouts(6000,6000,6000,6000) ;Set timeouts to 6 seconds
  283. winhttp.Option(6) := False ;disable location-header rediects
  284.  
  285. ;중복로그인을 막기위한 UNIQUE CODE 생성
  286. ucode:=A_TickCount . A_Now
  287. ucode:=_sort(ucode)
  288. ucode:=_sort(ucode)
  289. ucode:=_sort(ucode)
  290. ;MD5로 인코딩
  291. winhttp.Open("GET", "http://programauto.cafe24.com/js1606/md5encode.php?ucode=" ucode)
  292. winhttp.Send("")
  293. winhttp.WaitforResponse
  294. ucodemd5 := winhttp.ResponseText
  295.  
  296. ;로그인
  297. loginurl:="http://programauto.cafe24.com/js1606/login.php?username=" username "&password=" password "&ucode=" ucodemd5
  298. winhttp.Open("GET", loginurl)
  299. winhttp.Send("")
  300. winhttp.WaitforResponse
  301. if (winhttp.ResponseText = "200")
  302. islogin:=true
  303. else
  304. islogin:=false
  305.  
  306. if isLogin
  307. {
  308. Gui, Login:Destroy
  309. msgbox, 로그인 되었습니다.
  310. SetTimer, validate, % 60 * 1000
  311. goto, MainStart
  312. }
  313. else
  314. {
  315. msgbox, 로그인 실패했습니다.`nID와 PW를 확인해주세요.
  316. guicontrol, Login:enable, login
  317. }
  318. ;GuiControl,, status, % islogin ? "LoginSuccess!" : "LoginFail"
  319. return
  320.  
  321. validate:
  322. isvalid=0
  323. winhttp := ComObjCreate("WinHttp.WinHttpRequest.5.1")
  324. winhttp.SetTimeouts(6000,6000,6000,6000) ;Set timeouts to 6 seconds
  325. winhttp.Option(6) := False ;disable location-header rediects
  326. verifyurl:="http://programauto.cafe24.com/js1606/getucode.php?username=" username
  327. winhttp.Open("GET", verifyurl)
  328. winhttp.Send("")
  329. winhttp.WaitforResponse
  330. validationcode := winhttp.ResponseText
  331.  
  332. if(!validationcode)
  333. exitapp
  334.  
  335. ;MD5로 인코딩
  336. winhttp.Open("GET", "http://programauto.cafe24.com/js1606/md5encode.php?ucode=" ucode)
  337. winhttp.Send("")
  338. winhttp.WaitforResponse
  339. ucodemd5 := winhttp.ResponseText
  340.  
  341. if(!ucodemd5)
  342. exitapp
  343.  
  344. if ( validationcode = ucodemd5 )
  345. isvalid=1
  346. else
  347. isvalid=0
  348. if !isValid
  349. {
  350. Exitapp
  351. }
  352. ;GuiControl,, status, % isvalid ? "Valid!" : "Invalid"
  353. return
  354.  
  355. LoginGuiClose:
  356. GuiClose:
  357. ExitApp
  358.  
  359. _sort(string)
  360. {
  361. loop, parse, string
  362. {
  363. out .= a_loopfield . "`n"
  364. }
  365. sort, out, Random
  366. stringreplace, out, out, `n, , 1
  367. return out
  368. }
  369.  
  370. insert::reload
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement