Copy link to clipboard
Copied
I may be in need of a way to quit an external application during the execution of a .jsx script in illustrator. Specifically acrobat. I've written some code that saves the current document as a PDF, but I'm finding that on windows, an error presents itself when attempting to save a pdf that is already open in Acrobat.
Anybody with VBS experience have any advice to share? I've never written VBS and don't have a windows machine to test on.. so the more complete the advice the better. ![]()
Thanks in advance.
I looked here for some examples
Close an application using VBScript - Stack Overflow
this one worked for me to close Reader on Windows 10
...'attempt to quit Reader,
'Option Explicit 'all variables must be declared
Err.Clear
On Error Resume Next
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colProcessList = objWMIService.ExecQuery _
("Select * from Win32_Process Where Name = 'AcroRd32.exe'")
For Each objProcess i
Copy link to clipboard
Copied
I looked here for some examples
Close an application using VBScript - Stack Overflow
this one worked for me to close Reader on Windows 10
'attempt to quit Reader,
'Option Explicit 'all variables must be declared
Err.Clear
On Error Resume Next
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colProcessList = objWMIService.ExecQuery _
("Select * from Win32_Process Where Name = 'AcroRd32.exe'")
For Each objProcess in colProcessList
objProcess.Terminate()
If (Err.number <> 0) Then
Err.Clear
End If
Next
as with js, copy the script and paste it into a text editor and give it a vbs extension. Double click to execute or use file.execute() in your jsx
Copy link to clipboard
Copied
awesome, thanks carlos!
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more