Asset Functions
Asset functions include:
IsAssetExist
The IsAssetExist function checks if the asset exists. Returns true if it exists, otherwise returns false.
Syntax:
IsAssetExist(AssetIdAsString, mediaTypeNumber)
The mediaTypeNumber parameter is optional. The default value is 8.
Asset (media) types include:
-
3 - for web graphics (graphics valid for web, such as .jpg)
-
6 - for web text
-
7 - for print text
-
8 - for print graphics, such as .pdf (default value)
Example:
IsAssetExist("Pic1", 3) = True
GetAssetPath
The GetAssetPath function returns the file path of the asset. If none is found, returns null.
Syntax:
GetAssetPath(AssetIdAsString, mediaTypeNumber)
Asset (media) types include:
-
3 - for web graphics (graphics valid for web, such as .jpg)
-
6 - for web text
-
7 - for print text
-
8 - for print graphics (such as .pdf)
Example:
GetAssetPath("Pic1", 3) = C:\\Pic1.png
GetAssetPath("Pic1", 8) = C:\\Pic1.pdf
GetAssetWebURL
The GetAssetWebURL function returns the asset's web URL. If none is found, returns null.
Syntax:
GetAssetWebURL(AssetIdAsString, mediaTypeNumber)
Asset (media) types include:
-
3 - for web graphics (graphics valid for web, such as .jpg)
-
6 - for web text
-
7 - for print text
-
8 - for print graphics (such as .pdf)
Example:
GetAssetWebURL("Pic1", 3) = https://www.xmpie.com/wp-content/Pic1.png
GetAssetWebURL("Pic1", 8) = https://www.xmpie.com/wp-content/Pic1.pdf
GetPDFAssetPageCount
The GetPDFAssetPageCount function returns the PDF's number of pages. If a PDF is not found, returns 0.
Syntax:
GetPDFAssetPageCount(assetIdAsString)
Example:
GetPDFAssetPageCount("Doc1") = 6
Rectangle
This function can be used to fill any shape created within InDesign (for example a circle, a polygon, etc.).
The Rectangle function generates on-the-fly a dynamic rectangle (graphic image) in the required color (CMYK).
Using this function you can set dynamic object colors using variables and campaign dials that can be used in uStore products.
Click here to learn how to create a dynamic color picker in uStore using the Rectangle function.
Syntax
Rectangle(cyanPercentage, magentaPercentage, yellowPercentage, blackPercentage)
Example
Rectangle(12, 87, 71, 3) = Flame Scarlet
Rectangle(88, 67, 20, 5) = Classic Blue
Web.URLContentAsFile
TheWeb.URLContentAsFilefunction gets an image from the internet via its URL.
See video training
Syntax
CallWeb.URLContentAsFile(URL, timeout, defaultAssetName, contentType)
-
URL: Required. The URL to an image, e.g. http://imagesdomain/imagesfolder/imagename.jpg
-
timeout - (Optional) The default is 30 seconds, after which the request is timed out.
-
defaultAssetName - (Optional) Default asset in case of error (including time out). If no asset is defined, the error will be handled as a missing asset.
-
contentType - (Optional) By default it is automatically detected. You can explicitly define a IANA mime type.
Example
Web.URLContentAsFile("http://imagesdomain/imagesfolder/imagename.jpg")