seminar-material-20120901

COMでログインスクリプトを作ろう

IE = CREATEOLEOBJ("InternetExplorer.Application")
IE.visible = True
IE.navigate("http://canal22.org/login/")
REPEAT
 SLEEP(0.1)
UNTIL !IE.busy AND IE.readyState = 4
IE.document.forms[0].log.value = "aaaaa"
IE.document.forms[0].pwd.value = "bbbbb"
IE.document.forms[0].submit()

COMでIEとExcelを連携させよう

Excelファイルはコチラよりダウンロード

XLS = XLOPEN("商品リスト.xls",0)
IE = CREATEOLEOBJ("InternetExplorer.Application")
IE.visible = True
IE.navigate("http://canal22.org/sample0008/")
REPEAT
 SLEEP(0.1)
UNTIL !IE.busy AND IE.readyState = 4

XLS.Cells(3,1).Select
WHILE XLS.ActiveCell.value <> ""
IE.document.product.name.value = XLS.ActiveCell.Offset(0,0).value
IE.document.product.product_id.value = XLS.ActiveCell.Offset(0,1).value
SELECT XLS.ActiveCell.Offset(0,2).value
 CASE "販売前"
  STAT = 0
 CASE "販売中"
  STAT = 1
 CASE "販売終了"
  STAT = 2
 DEFAULT
  STAT = 0
SELEND

IE.document.product.prod_status.selectedIndex = STAT
IE.document.product.overview.value = XLS.ActiveCell.Offset(0,3).value
IE.document.product.price.checked = XLS.ActiveCell.Offset(0,4).value
IE.document.product.highquality.checked = XLS.ActiveCell.Offset(0,5).value
IE.document.product.rare.checked = XLS.ActiveCell.Offset(0,6).value
IE.document.product.popular.checked = XLS.ActiveCell.Offset(0,7).value
IE.document.product.submit()
REPEAT
 SLEEP(1)
UNTIL !IE.busy AND IE.readyState = 4
XLS.ActiveCell.Offset(0,8).value = "Done"
IE.navigate("http://canal22.org/sample0008/")
REPEAT
 SLEEP(0.1)
UNTIL !IE.busy AND IE.readyState = 4
REPEAT
 SLEEP(0.1)
UNTIL !IE.busy AND IE.readyState = 4
XLS.ActiveCell.Offset(1,0).Select
REPEAT
 SLEEP(1.0)
UNTIL !IE.busy AND IE.readyState = 4
WEND

画像認識とマウス操作を組み合わせよう

bmpファイル(./prj/STAR.BMP)ファイルはコチラよりダウンロード

IE = CREATEOLEOBJ("InternetExplorer.Application")
IE.visible = True
IE.navigate("http://canal22.org/sample0010/")
ACW(GETID("Windows Internet Explorer"),0,0,1000,720)
REPEAT
 SLEEP(0.1)
UNTIL !IE.busy AND IE.readyState = 4
WHILE TRUE
 IFB CHKIMG(".\prj\STAR.BMP")//,0,0,0,G_SCREEN_W,G_SCREEN_H)//,1,IMG_MSK_BGR4)
  STEPS  = 10
  WAITMS = 8
  FOR A = 0 TO 10 STEP 2
    MMV(G_IMG_X + A ,G_IMG_Y,WAITMS)
  NEXT
  FOR A = 0 TO 10 STEP 2
    MMV(G_IMG_X +  STEPS ,G_IMG_Y + A,WAITMS)
  NEXT
  FOR A = 0 TO 10 STEP 2
    MMV(G_IMG_X +  STEPS - A ,G_IMG_Y +  STEPS ,WAITMS)
  NEXT
  FOR A =  0 TO 10 STEP 2
    MMV(G_IMG_X,G_IMG_Y +  STEPS - A ,WAITMS)
  NEXT
  SLEEP(1)
  BTN(LEFT,0)
 ENDIF
 REPEAT
   SLEEP(0.1)
 UNTIL !IE.busy AND IE.readyState = 4
WEND


2012年8月31日

このページの先頭へ