How to shared variable between 2 or more scripts in project?

Hi all,

I have Xcode AS project and want to share variable “imageURLs” (list of dropped items) between drag’n’drop module and other script.

script DragAndDrop
	property parent: class "NSBox"
	-- property imageURLsView : missing value
	on draggingEntered_(info)
		log "Enter Dragging"
		return current application's NSDragOperationCopy
	end draggingEntered_
	on performDragOperation_(sender)
        -- Get the file path
        set pb to sender's draggingPasteboard()
        set theOptions to {NSPasteboardURLReadingFileURLsOnlyKey:1}

        set imageURLs to pb's readObjectsForClasses_options_({current application's |NSURL|}, theOptions)

        set draggedURL to item 1 of (imageURLs as list)
        set filePath to draggedURL's |path|()
        log imageURLs
		-- log filePath as string
        return true -- otherwise it doesn't happen
    end performDragOperation_

end script

For example: from app delegate script i can get value with

set currentVariable to current application's NSApp's delegate()'s currentVariable() as Integer

and how i can get value from other script?

I haven’t done this with multiple AppleScript files within a Xcode project, but to “share” a variable between my main AppleScript file (AppDelegate.applescript) and new classes I have created (.m & .h files) I pipe the variable I want the value of, such as:


property anObject : missing value -- Linked in IB to my custom class object (Referencing Outlet)

set newValue to anObject's |someValue|()

And of course, in my .h file for the custom class I would have

@property NSUInteger someValue;