我試圖儘可能將代碼從JavaScript更改爲VBScript ...你能幫助我,如果有任何改變,而錯誤..轉換Java腳本來VB腳本
<script language='vbscript' type='text/vbscript'>
Dim myVar = "";
function auto(data)
Dim path = '<%=session.getAttribute("PATH")%>' ;
Dim DocId = '<%=session.getAttribute("REQDOCUMENTID")%>' ;
Dim extension = '<%=session.getAttribute("FILEEXTN")%>' ;
Dim userId = '<%=session.getAttribute("REQUSERID")%>' ;
Dim apolloenv = '<%=session.getAttribute("REQAPOLLOENV")%>' ;
if(extension != '') Then
Dim ext = LCase(extension);
Dim fso = CreateObject("Scripting.FileSystemObject");
if (fso.FolderExists(path)) Then
path = path & DocId & "." & ext;
document.ViewONE.save(path);
myVar=window.setInterval(Call checkFile(path,ext),1000);
End If
if(DocId <> 'null' AND apolloenv <> 'null' AND userId <> 'null') Then
getNote(DocId,apolloenv,userId,"autolaunch executed");
End If
End If
End Function
function checkFile(path,ext)
set fso = CreateObject("Scripting.FileSystemObject");
if(fso.FileExists(path)) Then
Call openfile(ext, path);
window.clearInterval(myVar);
End If
End Function
function openfile(ext, path)
if(ext == 'docx' || ext == 'doc'|| ext == 'docm') Then
Dim oApplication = CreateObject("Word.Application");
oApplication.Visible = true;
oApplication.Documents.Open(path, false, 0);
ElseIf (ext == 'xls'||ext == 'xlsx' ||ext == 'xlsm' ||ext == 'xlsb' ||ext == 'xltx' ||ext == 'xltm') Then
Dim objExcel = CreateObject("Excel.Application");
objExcel.Visible = true;
objExcel.Workbooks.Open(path, false, 0);
ElseIf (ext == 'pptx'|| ext == 'ppt' || ext == 'pptm') Then
Dim objPPT = CreateObject("PowerPoint.Application");
objPPT.Visible = true;
objPPT.Presentations.Open(path, false, 0);
ElseIf (ext == 'msg' || ext == 'eml') Then
WSH = CreateObject("WScript.Shell");
WSH.run("file://"+path, 1);
ElseIf (ext == 'jpg' || ext == 'tif' || ext == 'png' || ext == 'bmp' || ext == 'mdi' || ext == 'gif') Then
imageWSH = CreateObject("WScript.Shell");
imageWSH.run("file://"+path, 1);
ElseIf (ext == 'txt') Then
txtwshShell = CreateObject("WScript.Shell");
txtwshShell.run("file://"+path, 1);
ElseIf (ext == 'pdf') Then
wshShell = CreateObject("WScript.Shell");
wshShell.run("file://"+path, 1);
Else
msgbox "Please use the right click AutoLaunch option available in Apollo as this document type will not be supported by daejaviewer's AutoLaunch."
End If
End Function
我不是肯定getNote,文檔,session.attribute功能,有在javascript來改變它的VBScript
你爲什麼要寫「java script」而不是「vbscript」(沒有空格)。此外,您用java.Java標記了這個問題,並沒有使用javascript。只有前4個字母是相同的,如汽車和地毯。 – Ben 2014-08-31 09:27:44