function str=CopyPasteIE(url);
ha = actxserver('internetexplorer.application');
ha.Visible = 1;
Navigate(ha, url);
pause(3); % Pause to let the page load
ha.document.execCommand('selectall','','');
ha.document.execCommand('copy','','');
str=clipboard('paste');
end
When I use the function I get this Error:
No appropriate method, property, or field execCommand for class Interface.JScriptTypeInfo_JScript_Type_Info.
Error in CopyPasteIE (line 6)
ha.document.execCommand('selectall','','');
What needs to change so that this function will work? I still use MatLab R2014a if it makes any difference.

 채택된 답변

Guillaume
Guillaume 2018년 3월 16일
편집: Guillaume 2018년 3월 16일

1 개 추천

According to the MSDN documenation of the document property, what it returns depends on the type of the page that is loaded.
The example you linked assumes the page loaded is a html page, in which case document returns a IHTMLDocument2 compatible interface, which has a method ExecCommand.
In your case, I would guess that the page loaded is a javascript file, hence document returns a JScriptTypeInfo interface which is something completely different (for which I can't find much documentation).
Note that automating internet explorer is not particularly well documented and now that internet explorer has been deprecated, it's going to get harder and harder to find documentation.

추가 답변 (0개)

질문:

2018년 3월 16일

편집:

2018년 3월 16일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by