Highlighted

Event Handler in "Visual Basic" not vbscript

Explorer ,
May 31, 2020

Copy link to clipboard

Copied

Can anyone tell me how to implement the following in "Visual Basic" not vbscript?

"GetRef" doesn't work in "Visual Basic"

 

== This is a code provided in the InDesign Scripting SDK ===

 

Set myDocument = myInDesign.Documents.Add
myDocument.AddEventListener "afterSelectionChanged", GetRef("myDisplaySelectionType")
 
Function myDisplaySelectionType(en)
Set myInDesign = CreateObject("InDesign.Application.2020")
If myInDesign.Documents.Count > 0 Then
if myInDesign.Documents.Item(1).Selection.Count > 0 Then
Set mySelection = myInDesign.Documents.Item(1).Selection
myString = "Selection Contents:" & vbCr
for myCounter = 1 To mySelection.Count
myString = myString & TypeName(mySelection.Item(myCounter)) & vbCr
Next
MsgBox(myString)
End If
End If
End Function
 
==========================
 
Thanks,
Tak
TOPICS
Scripting, SDK

Views

163

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Event Handler in "Visual Basic" not vbscript

Explorer ,
May 31, 2020

Copy link to clipboard

Copied

Can anyone tell me how to implement the following in "Visual Basic" not vbscript?

"GetRef" doesn't work in "Visual Basic"

 

== This is a code provided in the InDesign Scripting SDK ===

 

Set myDocument = myInDesign.Documents.Add
myDocument.AddEventListener "afterSelectionChanged", GetRef("myDisplaySelectionType")
 
Function myDisplaySelectionType(en)
Set myInDesign = CreateObject("InDesign.Application.2020")
If myInDesign.Documents.Count > 0 Then
if myInDesign.Documents.Item(1).Selection.Count > 0 Then
Set mySelection = myInDesign.Documents.Item(1).Selection
myString = "Selection Contents:" & vbCr
for myCounter = 1 To mySelection.Count
myString = myString & TypeName(mySelection.Item(myCounter)) & vbCr
Next
MsgBox(myString)
End If
End If
End Function
 
==========================
 
Thanks,
Tak
TOPICS
Scripting, SDK

Views

164

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
May 31, 2020 0

Have something to add?

Join the conversation