0
Engaged
,
/t5/indesign-discussions/how-to-pass-variable-content-to-vbscript-from-indesign-javascript/td-p/13503384
Jan 19, 2023
Jan 19, 2023
Copy link to clipboard
Copied
Actually i want to pass folderpath variable from Javascript to vbscript: getFolder () , how to pass it
var folderPath = "D:/ excelfolder/Exportfiles"; //need to pass this folderpath into below vbscript
//vb script starts here:
var vbscript = '';
vbscript += 'Set objFSO = CreateObject("Scripting.FileSystemObject")\r';
vbscript += 'Set objFolder = objFSO.GetFolder(folderpath)\r'; // here need to pass the folderpath content into vbscript
vbscript += 'Set objExcel = CreateObject("Excel.Application")\r';
vbscript += 'For Each objFile In objFolder.Files\r';
vbscript += ' If objFSO.GetExtensionName(objFile.Name) = "html" Then\r';
vbscript += ' Set objWorkbook = objExcel.Workbooks.Open(objFile.Path)\r';
vbscript += 'newFilename = Replace(objFile.Path, ".html", "")\r';
vbscript += 'objWorkbook.SaveAs newFilename & "_converted.xlsx", 51 \r';
vbscript += ' End If\r';
vbscript += 'Next\r';
vbscript += 'objExcel.Quit\r';
app.doScript(vbscript, ScriptLanguage.visualBasic);
// vb script ends here.
alert("Process completed");
exit();
TOPICS
How to
,
Scripting
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
1 Correct answer
Valorous Hero
,
Jan 19, 2023
Jan 19, 2023
Valorous Hero
,
/t5/indesign-discussions/how-to-pass-variable-content-to-vbscript-from-indesign-javascript/m-p/13503589#M511884
Jan 19, 2023
Jan 19, 2023
Copy link to clipboard
Copied
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Karthik SG
AUTHOR
Engaged
,
LATEST
/t5/indesign-discussions/how-to-pass-variable-content-to-vbscript-from-indesign-javascript/m-p/13506311#M512031
Jan 20, 2023
Jan 20, 2023
Copy link to clipboard
Copied
var folderPath = "D:/excelfolder/Exportfiles"; //need to pass this folderpath into below vbscript
//vb script starts here:
var vbscript = '';
vbscript += 'Set objFSO = CreateObject("Scripting.FileSystemObject")\r';
vbscript += 'Set objFolder = objFSO.GetFolder('"folderpath"')\r'; // here need to pass the folderpath content into vbscript
vbscript += 'Set objExcel = CreateObject("Excel.Application")\r';
vbscript += 'For Each objFile In objFolder.Files\r';
vbscript += ' If objFSO.GetExtensionName(objFile.Name) = "html" Then\r';
vbscript += ' Set objWorkbook = objExcel.Workbooks.Open(objFile.Path)\r';
vbscript += 'newFilename = Replace(objFile.Path, ".html", "")\r';
vbscript += 'objWorkbook.SaveAs newFilename & "_converted.xlsx", 51 \r';
vbscript += ' End If\r';
vbscript += 'Next\r';
vbscript += 'objExcel.Quit\r';
app.doScript(vbscript, ScriptLanguage.visualBasic);
// vb script ends here.
alert("Process completed");
exit();
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Engaged
,
/t5/indesign-discussions/how-to-pass-variable-content-to-vbscript-from-indesign-javascript/m-p/13505298#M511995
Jan 19, 2023
Jan 19, 2023
Copy link to clipboard
Copied
Sending parameters to DoScript in Using the DoScript Method in Scripting Features in the VBScript Guide of the InDesign Scripting SDK
And Returning values from DoScript are listed, so please read them.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

