我正在尝试选择所有问题并将其粘贴到excel中,每个问题都位于不同的单元格中。我只是不确定如何格式化代码来做到这一点,现在,它会将所有问题粘贴到一个单元格中。
预先感谢您的帮助。
tell application "Safari"
set question to do JavaScript "
var outPut=[];
var arr=document.querySelectorAll('.question_body');
for (var i=0; i < arr.length; i++) {
if(arr[i].innerHTML !== ''){
outPut.push(arr[i].innerHTML.trim())
}
};
outPut;" in document 1
end tell
set saveTID to text item delimiters
set text item delimiters to "***"
set questions to question as string
set text item delimiters to saveTID
set the clipboard to questions
tell application "Microsoft Excel"
activate
--repeat 3 times
--tell application "System Events" to keystroke "u" using control down
tell application "System Events" to keystroke "v" using command down
--tell application "System Events" to keystroke "u" using control down
--tell application "System Events" to key code 125
--end repeat
end tell