2016-05-25 61 views
0

我從網站上的數據庫中提取數據的列表,的AppleScript:複製一個列表的所有項目在剪貼板

  1. 我怎麼能去設置項目的結果在我的列表中剪貼板,排除第一個結果只是錯誤的鏈接

  2. 如何在Chrome中使用此腳本代替Safari?

    集dataINeedList我getInputByClass2( 「排序dataPersonId」,1) - 獲得第十值,用這個 - >項目10 ALLDATA

    to getInputByClass2(theClass) -- this return a list of values 
        tell application "Safari" 
         set r to do JavaScript "var outPut=[]; var arr=document.getElementsByClassName('" & theClass & "');for (var i in arr) {outPut.push(arr[i].innerHTML)};outPut;" in document 1 
        end tell 
        return strings of r --- this remove all 'Missing Value' from a list of strings 
    end getInputByClass2 
    
    set listSize to count of dataINeedList ## number of dataINeed founds 
    
    set theResult to item 2 of dataINeedList 
    
    ##repeat with theItem in dataINeedList ## not working 
    ## set the clipboard to theItem ## 
    ##end repeat ## 
    
+0

對於第二個問題,您已經提出了這個問題。檢查答案:[這個問題](http://stackoverflow.com/questions/37299708/applescript-use-google-chrome-to-extract-text) – jackjr300

回答

1

基本的,是這樣的:

set x to {"a", "b", "c"} 
set the clipboard to items 2 thru -1 of x 
+0

完美,非常感謝,PS你會知道如何使用這個在Chorme? –

+0

對不起,我沒有鉻,我不知道JavaScript :(我想,如果鉻支持JavaScript,這個applescript應該以相同的方式工作。 –

+0

只是一個真正的最後一個問題,任何想法如何更換空間並返回到昏迷的昏迷狀態? –