Closed 130s closed 10 years ago
Using WshShell also works under the same condition mentioned in my earlier post.
To sum up the research result so far:
.bat
via html link on the following condition:IE11
on Win8.1 with concrete path of a file.FF
on Win7 with concrete path of a file works too..bat
files via link.Relative path
of .bat fileFirefox
, Chrome
Hereby I suggest workaround plan:
a. Only target IE
, using absolute path of .bat
.
b. Download .bat
files via html link and run manually.
https://github.com/tork-a/openrtm_tutorial/commit/863a0ae0b6f25fbc15ae9da2d0a019ebba8152e7 implements the workaround b
in the earlier comment. Actually when you're downloading a .bat
file, common browsers give you an option to run the file, which might suffice the purpose originally asked.
Tested from the data copied on USB with https://github.com/tork-a/openrtm_tutorial/commit/863a0ae0b6f25fbc15ae9da2d0a019ebba8152e7, turned out neither Firefox nor IE don't work with it:
This result adds even more complication to the options a and b mentioned in this comment and none of them would probably not work. Unless I'd tweak by like javascript to manipulate paths, there won't be a nice resoltion that work for major browsers in any way.
どうも.菅です. batファイルが実行できない件ですが,Windows + IEのみで実行できればいいです. 相対パスから実行するためのJavascriptを書きました.ActiveX使いますが・・・
<script LANGUAGE="JavaScript"> function rtm_naming() { var objFileSys = new ActiveXObject("Scripting.FileSystemObject"); var objFile = objFileSys.GetFile(location.pathname.slice(1)); var path = objFile.ParentFolder + "\\..\\demo\\rtm-naming.bat"; var obj = new ActiveXObject("WScript.Shell"); obj.Run("cmd.exe /c \"start " + path + "\""); } </script>
あとは,
<a class="reference external" href="javascript:void(0)" onclick="rtm_naming(); return false;">rtm-naming.bat</a>
のように配置すれば動作します.
@sugarsweetrobotics thank you for the idea but does this work on your machine?
I got rtm-naming.bat
running but it fails to find omniNames
. PATH
seems to be set as expected but I suspect that the cmd
opens at my desktop (C:\Users\myuser\Desktop
) while omniNames is located under F:\misc\OpenRTM-aist\1.1.\omniORB\4.1.5\bin\x86_win32\
; eg. changing the last line of the given javascript like this:
obj.Run("cmd.exe /c \"cd .. && start " + path + "\"");
would open a terminal and prompt stays at C:\Users\myuser
, backing up a folder by cd
.
Thus rtm-naming.bat
might be failing since it cannot find omniNames in relative path.
Should be fixed via https://github.com/tork-a/openrtm_tutorial/pull/9. Now I'm testing with USB device
So it can't be made to run on chrome ?
@coded9 you're right at the moment; IE is required (as noted in readme as well) to run the pre-defined scripts from the web browser. But you can always run them from commandline (it's just you can't run them by clicking the links on the web browser except for IE).
In the tutorials users often need to run many
.bat
files from a local folder, which turned out to be requiring attention to choose the right file. So the additional requirement for the project was added to enable users to run.bat
from html by just clicking links.I just verified that this works on
IE
, but does not onFirefox
. http://stackoverflow.com/a/18981127/577001Plus, relative path might not work on either browser, which can also be a non-trivial issue.