<NME> run-actions.cocoascript
<BEF> @import 'actions/action-inventory.cocoascript'
@import 'actions/view-inventory.cocoascript'
var methodStartTime = nil

var pluginPath = ""
var currentDocument = nil
var currentSelection = nil

var methodStartTime = nil
var debugFromCustomPluginPanel = false

var pluginPath = ""
var pluginVersion = ""
var currentDocument = nil
var currentSelection = nil

var runSelectProjectFolderIdentifier = 6
var runRemoveProjectFolderIdentifier = 7
var runShowBarIdentifier = 8

var runTestingEnvironmentIdentifier = -2
var isTestingEnvironment = false
	exportFramerFolder: "",
	myDevice: 0,
	myCodeStyle: 0,

	myRetinaValue: 1,
	myMobile: 1,
var isSmartAction = false

var decomposeContext = function(context) {
		log(context)
		if (showLog) { log("Current document is initialised") }
		pluginPath = context.scriptPath.substring(0, context.scriptPath.lastIndexOf("/"))
		if (showLog) { log(pluginPath) }
		currentDocument = context.document
		currentSelection = context.document.selectedLayers()
}


var statisticsPresets = {
    currentStatus: 0,
    prevStatus: 0,
    toolbar: 0,
    testing: 0,
    debug: 0,

		actionSummary: 0
}



function Status () {}

Status.waitingID = function() { return -1 }
Status.replicateID = function() { return 0 }
Status.generateID = function() { return 1 }
Status.simulateID = function() { return 2 }
Status.settingsID = function() { return 3 }
Status.removePageID = function() { return 4 }
Status.showFolderID = function() { return 5 }
Status.selectFolderID = function() { return 6 }
Status.removeFolderID = function() { return 7 }
Status.toolbarID = function() { return 8 }
Status.updateID = function() { return 9 }


Status.userDomain = function() { return "com.addleimb.framer-inventory.user-production" }
Status.statsDomain = function() { return "com.addleimb.framer-inventory.statistics-production" }
Status.datesDomain = function() { return "com.addleimb.framer-inventory.dates-production" }

var preTestingDefaults = {}
var userDefaults = initDefaults(Status.userDomain(), userPresets)
var statsDefauls = initDefaults(Status.statsDomain(), statisticsPresets)


Status.toolbarModeEmpty = function() { return 0 }
Status.toolbarModeImport = function() { return 1 }
Status.toolbarModeScene = function() { return 2 }



var showLog = true
var showTestLog = true
	chooseAction(currentDocument, currentSelection, runRemoveProjectFolderIdentifier)
}

//
// var runGenerateStatesIdentifier = 3
// var currentCommandIdentifier = runGenerateStatesIdentifier
// var showLog = true
// var showTestLog = true
// var testing = true
//
var onTestingRun = function(context) {
	if (showLog) { log("Running Testing Environment") }
	isTestingEnvironment = true

var onReplicateLayersRun = function(context) {
	if (showLog) { log("Running Replicate Layers") }
	decomposeContext(context)
	runReplicateLayers()
}

var onGenerateStatesRun = function(context) {
	if (showLog) { log("Running Generate States") }
	decomposeContext(context)
	runGenerateStates()
}

var onSimulateKeynoteRun = function(context) {
	if (showLog) { log("Running Simulate Keynote") }
	decomposeContext(context)
	runSimulateKeynote()
}

var onSettingRun = function(context) {
	if (showLog) { log("Running Settings") }
	decomposeContext(context)
	runSettings()
}

var onRemoveExportPageRun = function(context) {
	if (showLog) { log("Running Remove Export Page...") }
	decomposeContext(context)
	FramerInventory.showDoneMessage()
}

var onShowBarRun = function(context) {
	if (showLog) { log("Showing Bar") }
	decomposeContext(context)
	ToolbarInventory.createUIBar()
}


var onSelectOpenedProjectRun = function(context) {
	if (showLog) { log("Running Select Opened Project...") }
	decomposeContext(context)
	PathInventory.createPathModal()
}

var onSelectProjectFolderRun = function(context) {
	if (showLog) { log("Running Select Project Manually...") }
	decomposeContext(context)
	FramerInventory.runSelectProjectFolder()
}

var onRemoveProjectFolderRun = function(context) {
	if (showLog) { log("Running Remove Project Folder...") }
	decomposeContext(context)
	FramerInventory.runRemoveProjectFolder()
}

var onShowProjectFolderRun = function(context) {
	if (showLog) { log("Running Show Project Folder...") }
	decomposeContext(context)
	FramerInventory.runShowProjectFolder()
}

var onCheckUpdatesRun = function(context) {
	if (showLog) { log("Running Updates Checker") }
	decomposeContext(context)
	runCheckUpdates()
}

var onSaveSelectionRun = function(context) {
	if (showLog) { log("Running Save Selection") }
	decomposeContext(context)
	AbstractSelectionInventory.saveSelection(currentSelection)
}

var onAddToSelectionRun = function(context) {
	if (showLog) { log("Running Add to Selection") }
	decomposeContext(context)
	AbstractSelectionInventory.addToSelection(currentSelection)
}

var onClearSelectionRun = function(context) {
	if (showLog) { log("Running Clear Selection") }
	decomposeContext(context)
	AbstractSelectionInventory.clearSelection()
}

var onRestoreSelectionRun = function(context) {
	if (showLog) { log("Running Save Selection") }
	decomposeContext(context)
	AbstractSelectionInventory.restoreSelection()
}




var onDisconnectSymbols = function(context) {
	if (showLog) { log("Disconnect Symbols") }
	decomposeContext(context)
	UtilsInventory.disconnectSymbols()
}

var onAddLayersAsArray = function(context) {
	if (showLog) { log("Add Layer as Array") }
	decomposeContext(context)
	UtilsInventory.addSelectionArray()
}

var onCleanAndCopyLayersAsArray = function(context) {
	if (showLog) { log("Clean and Copy Layers as Array") }
	decomposeContext(context)
	UtilsInventory.cleanAndCopySelection()
}

var onCreateShownHiddenStates = function(context) {
	if (showLog) { log("Create shown/hidden states") }
	decomposeContext(context)
	UtilsInventory.createShownHiddenStates()
}



var onSetRulers = function(context) {
	if (showLog) { log("Set Rulers") }
	decomposeContext(context)
	UtilsInventory.setRulers()
}

var onResetRulers = function(context) {
	if (showLog) { log("Reset Rulers") }
	decomposeContext(context)
	UtilsInventory.resetRulers()
}



var onTestingRun = function(context) {
	if (showLog) { log("Running Testing Environment") }
	// isTestingEnvironment = true
	// sendLog = false
	decomposeContext(context)
	runTestingEnvironment()
	// chooseAction(currentDocument, currentSelection, runTestingEnvironmentIdentifier)
}

<MSG> Added update checker

– Added an action to check for updates

<DFF> @@ -3,6 +3,7 @@
 var methodStartTime = nil
 
 var pluginPath = ""
+var pluginVersion = ""
 var currentDocument = nil
 var currentSelection = nil
 
@@ -17,6 +18,7 @@ var runRemoveExportPageIdentifier = 4
 var runSelectProjectFolderIdentifier = 6
 var runRemoveProjectFolderIdentifier = 7
 var runShowBarIdentifier = 8
+var runCheckUpdatesIdentifier = 9
 
 var runTestingEnvironmentIdentifier = -2
 var isTestingEnvironment = false
@@ -29,10 +31,9 @@ var sendLog = true
 var isSmartAction = false
 
 var decomposeContext = function(context) {
-		log(context)
-		if (showLog) { log("Current document is initialised") }
+		pluginVersion = context.plugin.version()
 		pluginPath = context.scriptPath.substring(0, context.scriptPath.lastIndexOf("/"))
-		if (showLog) { log(pluginPath) }
+
 		currentDocument = context.document
 		currentSelection = context.document.selectedLayers()
 }
@@ -85,13 +86,12 @@ var onRemoveProjectFolderRun = function(context) {
 	chooseAction(currentDocument, currentSelection, runRemoveProjectFolderIdentifier)
 }
 
-//
-// var runGenerateStatesIdentifier = 3
-// var currentCommandIdentifier = runGenerateStatesIdentifier
-// var showLog = true
-// var showTestLog = true
-// var testing = true
-//
+var onCheckUpdatesRun = function(context) {
+		if (showLog) { log("Running Updates Checker") }
+		decomposeContext(context)
+		chooseAction(currentDocument, currentSelection, runCheckUpdatesIdentifier)
+}
+
 var onTestingRun = function(context) {
 	if (showLog) { log("Running Testing Environment") }
 	isTestingEnvironment = true

Added update checker