How to convert an integer into a NSView Ptr

I have a Ptr to an NSView derived in XOJO which is an Integer.

I want to print this NSView via an external script something like the following:

I believe the issue is with coercing tView(integer) so that the script recognises it as an NSView Ptr.

Is this the problem and how an it be overcome?


use framework "Foundation"
use framework "Cocoa"
use framework "AppKit"
use scripting additions

on run {tView}
	set tResult to printViewer(tView)
	return tResult
end run

on printViewer(tView)
	
	set tPrintOperation to current application's class "NSPrintOperation"'s printOperationWithView:tView
	
	tPrintOperation's runOperation
	
	set tResult to "ok"

	return tResult
	
end printViewer

To my knowledge AppleScript Cannot work with pointers

You may have to pass the string in your Xojo App’s view to the AppleScript, then use the NSPrintOperation class to print the string.
You can also use the NSPrintInfo class to format the page setup, e.g margins.

If your view has graphics and pictures, then things become more difficult, if not unpractical.

I used RB back in 2011, and even back then the support for AppleScript in RB was limited, and somewhat out of date.
With RB’s successor Xojo, AppleScript support is even more out of date, which is a shame, as an ex VB programmer I
really liked Xojo, but the trouble is that it’s support for external native code is poor, or your stuck with messy Declare statements which are hard to debug.

Is there not a Xojo class for printing ?

If not then I know there are plugin developers and vendors for Xojo, who might have something on offer for printing.

Regards Mark