需先在/sdcard/下放入一份UrlList.txt。

檔案裡面儲存你要自動瀏覽的網址,注意最後一行還要再斷行才可以

例如:

urlListShot

 

程式開啟Browser後瀏覽網址,接著往下滑動並截圖,最後退出Browser回到Home Screen。

   1: #!/bin/bash
   2: #================================================
   3: #               Initial Setup
   4: #================================================
   5: ScreencapPath="/sdcard/AutoSwipe/"
   6: filename="/sdcard/UrlList.txt"
   7:  
   8: mkdir $ScreencapPath
   9: #================================================
  10: i=1
  11: count=1
  12: while [ 1 ]
  13: do
  14:     cat $filename | while read line
  15:     do
  16:         am start -n com.android.browser/.BrowserActivity
  17:         sleep 3
  18:         
  19:         #Search Key
  20:         input keyevent 84
  21:         sleep 1
  22:         
  23:         #Input URL        
  24:         line=${line:0:(${#line}-1)}
  25:         echo "$i-->$line"    
  26:         input text $line
  27:         
  28:         #Enter Key
  29:         input keyevent 66
  30:         sleep 10
  31:         
  32:         #Swipe down
  33:         input swipe 100 600 100 100
  34:         sleep 1
  35:         
  36:         #Take a shot
  37:         dateTime=$(date +"%F_%H-%M-%S")
  38:         screencap -p "$ScreencapPath${i}_$dateTime.png"
  39:         
  40:         #Back to home screen
  41:         input keyevent 3
  42:         sleep 1
  43:         
  44:         i=$((${i}+1))        
  45:     done
  46:     count=$((${count}+1))
  47:     echo "count:$count"
  48: done
arrow
arrow
    全站熱搜
    創作者介紹
    創作者 toyangel 的頭像
    toyangel

    好同學的部落格

    toyangel 發表在 痞客邦 留言(0) 人氣()