Global Methods: Difference between revisions

From SDK
Jump to navigation Jump to search
 
(11 intermediate revisions by the same user not shown)
Line 6: Line 6:
----
----
''Returns true if the script is running inside Aspire.''
''Returns true if the script is running inside Aspire.''
''Returns false if the script is running inside VCarve Pro or Cut2D Pro.''


=== IsBetaBuild() ===
=== IsBetaBuild() ===
Line 27: Line 29:
-- require("mobdebug").start()
-- require("mobdebug").start()
require "strict"
require "strict"
 
-- =======================]]
function main()
function main()
   MessageBox("Hello World!!!")
   MessageBox("Hello World!!!")
Line 33: Line 35:
end -- Function</nowiki>
end -- Function</nowiki>
[[File:HelloWorld2.png|left|110px]]
[[File:HelloWorld2.png|left|110px]]




Line 49: Line 49:
''This code displays all of the application internal build information. See MessageBox image below''
''This code displays all of the application internal build information. See MessageBox image below''
  <nowiki>
  <nowiki>
   -- VECTRIC LUA SCRIPT
   -- VECTRIC LUA SCRIPT                 -- Required on the first line of gadget
   -- require("mobdebug").start()
   -- require("mobdebug").start()       -- Sets Debug Mode Off. Note the two dash ("--") to commit out line
   require "strict"
   require "strict"                     -- Sets strict Mode On
   --[[-------------------------------------------------------------  
   -- ---------------------------------------------------------------  
    |  ThisAppInfo() Collects information about the application and  
  -- |  ThisAppInfo() Collects information about the application and  
    |  provides the user with the following:
  -- |  provides the user with the following:
    |    Application name.  
  -- |    Application name.  
    |    Version is a Beta/Pro.
  -- |    Version is a Beta/Pro.
    |    The version number.
  -- |    The version number.
    |    The build number.
  -- |    The build number.
    -------------------------------------------------------------]]
  -- ---------------------------------------------------------------
     function ThisAppInfo()
     function ThisAppInfo()
       local ThisApp = "" -- Sets ThisApp as a string
       local ThisApp = ""                               -- Sets ThisApp as a string
       local AppVersion  = tostring(GetAppVersion())  -- Gets the App Version
       local AppVersion  = tostring(GetAppVersion())  -- Gets the application version
       local BuildVersion = tostring(GetBuildVersion()) -- Gets the Build Version
       local BuildVersion = tostring(GetBuildVersion()) -- Gets the build version


       if IsAspire() then -- Set the Re
       if IsAspire() then                               -- Set the application name
         ThisApp = "Application: Aspire"
         ThisApp = "\nApplication: Aspire"
       else
       else
         ThisApp = "Application: VCarve Pro or Cut2D Pro  "
         ThisApp = "\nApplication: VCarve Pro or Cut2D Pro  "
       end -- if end
       end -- if end


       if IsBetaBuild() then
       if IsBetaBuild() then                             -- Set the release type
         ThisApp = ThisApp .."\nRelease: Is for Beta Testing"
         ThisApp = ThisApp .."\nRelease: Is for Beta Testing"
       else
       else
Line 77: Line 77:
       end -- if end
       end -- if end


       ThisApp = ThisApp .. "\nVersion No: " .. AppVersion ..
       ThisApp = ThisApp .. "\nVersion No: " .. AppVersion .. -- Put message together
                           "\nCompile No: " .. BuildVersion
                           "\nCompile No: " .. BuildVersion


       MessageBox("Current Application Information\n" .. ThisApp)
       MessageBox([[ Current Application Information ]] .. "\n"
              .. [[---------------------------------]] .. ThisApp) -- Display MessageBox
      return true
     end -- function end
     end -- function end
   -- ===========================================================]]
   -- =============================================================]]
     function main()  
     function main()       -- Gadget start function
      ThisAppInfo()
      ThisAppInfo()       -- Calls the sub function
      return true
      return true              
     end -- function end </nowiki>
     end -- function end  
[[File:VCarve Pro5.png|left|290px]]
  -- =============================================================]]</nowiki>
[[File:VCarve Pro6.png|left|290px]]




Line 106: Line 109:


[[File:Back.jpg|right|50px|link=Vectric Lua Interface for Gadgets]]
[[File:Back.jpg|right|50px|link=Vectric Lua Interface for Gadgets]]
 
==References==
==References==
'''Please Note:''' The base material for the contents found in this WiKi was sourced from Vectric Lua Interface for Gadgets, version 10.0, published August 21 2019. by Vectric Ltd. Most current document from Vertric can be downloaded at [https://gadgets.vectric.com/developerinfo.html Vertric Developer Information]
'''Please Note:''' The base material for the contents found in this WiKi was sourced from Vectric Lua Interface for Gadgets, version 10.0, published August 21 2019. by Vectric Ltd. Most current document from Vertric can be downloaded at [https://gadgets.vectric.com/developerinfo.html Vertric Developer Information]

Latest revision as of 11:19, 2 June 2024

Back.jpg

Most of the actions you can perform from Lua are done by calling methods on objects associated with the current job. There are a few methods which operate Globally on the application and they are documented here.

IsAspire()


Returns true if the script is running inside Aspire.

Returns false if the script is running inside VCarve Pro or Cut2D Pro.

IsBetaBuild()


Returns true if this is a Beta build rather than a release build

GetAppVersion()


Returns application version number as a double (e.g 4.004 for Aspire V4.0)

GetBuildVersion()


Returns application internal build version which is the same for both Aspire and VCarve Pro. This is different to the AppVersion above as Aspire 4.004 will report e.g. 7.004 which matches VCarve Pro 7.004 as they are built off the same code base, and have the same script level support.

MessageBox( string text)


Displays a message box with passed text to user. The text can include HTML formatting. text – string – text to display in the message box.

Usage Syntax:

Example Code:
-- VECTRIC LUA SCRIPT
-- require("mobdebug").start()
require "strict"
 -- =======================]]
function main()
  MessageBox("Hello World!!!")
  return true
end -- Function
HelloWorld2.png






Example Code:

This code displays all of the application internal build information. See MessageBox image below

  -- VECTRIC LUA SCRIPT                 -- Required on the first line of gadget
  -- require("mobdebug").start()        -- Sets Debug Mode Off. Note the two dash ("--") to commit out line 
  require "strict"                      -- Sets strict Mode On
  -- --------------------------------------------------------------- 
  -- |  ThisAppInfo() Collects information about the application and 
  -- |  provides the user with the following:
  -- |    Application name. 
  -- |    Version is a Beta/Pro.
  -- |    The version number.
  -- |    The build number.
  -- ---------------------------------------------------------------
    function ThisAppInfo()
      local ThisApp = ""                               -- Sets ThisApp as a string
      local AppVersion   = tostring(GetAppVersion())   -- Gets the application version
      local BuildVersion = tostring(GetBuildVersion()) -- Gets the build version

      if IsAspire() then                               -- Set the application name
        ThisApp = "\nApplication: Aspire"
      else
        ThisApp = "\nApplication: VCarve Pro or Cut2D Pro   "
      end -- if end

      if IsBetaBuild() then                             -- Set the release type
        ThisApp = ThisApp .."\nRelease: Is for Beta Testing"
      else
        ThisApp = ThisApp .."\nRelease: Is for Production"
      end -- if end

      ThisApp = ThisApp .. "\nVersion No: " .. AppVersion .. -- Put message together
                           "\nCompile No: " .. BuildVersion

      MessageBox([[ Current Application Information ]] .. "\n"
              .. [[---------------------------------]] .. ThisApp) -- Display MessageBox 
      return true
    end -- function end
  -- =============================================================]]
    function main()       -- Gadget start function
      ThisAppInfo()       -- Calls the sub function
      return true               
    end -- function end 
  -- =============================================================]]
VCarve Pro6.png









Back.jpg

References

Please Note: The base material for the contents found in this WiKi was sourced from Vectric Lua Interface for Gadgets, version 10.0, published August 21 2019. by Vectric Ltd. Most current document from Vertric can be downloaded at Vertric Developer Information