Hi,
on Windows 11 (Xojo 2023r2) i’m trying to send a little InDesign Test-JavaScript from Xojo to InDesign with OLE Automation using the DoScript command. InDesign should then show an Alert-Info with “Hello” in it.
I know this worked before, but now it doesn’t. The following code produces an OLEException.
Dim obj As OLEObject
Dim result As Variant
Dim params(2) As Variant
obj = New OLEObject("InDesign.Application.2023", true)
result=obj.Value("version").StringValue
params(1)="alert(""Hello"");"
params(2)= 1246973031 //constant meaning the code is in InDesign-Javascript language
result = obj.invoke("DoScript", params)
The error:
Exception code 30477: Ungültiger Wert für Parameter “Language” der Methode “DoScript”. idScriptLanguage enumerator erwartet, aber nothing erhalten., (failed on “DoScript”)
I checked via VBA from Word with this code and it worked without issue. So i think there should be no issue in the DoScript-function-call and no system related issues. The function is called in the way described in the Xojo-documentation.
Private Sub CommandButton1_Click()
Dim script As String
Dim idVersion As String
Dim result As Variant
Set myInDesign = CreateObject("InDesign.Application.2023")
idVersion = myInDesign.Version
script = "alert(""Hello"");"
result = myInDesign.DoScript(script, 1246973031)
End Sub
Is there something i’m missing in Windows 11 or Xojo? Thanks for any help and ideas.
best, Thomas