<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Creating Media entities and style definitions through scripting in ThingWorx Developers</title>
    <link>https://community.ptc.com/t5/ThingWorx-Developers/Creating-Media-entities-and-style-definitions-through-scripting/m-p/598331#M34819</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.ptc.com/t5/user/viewprofilepage/user-id/275134"&gt;@mnarang&lt;/a&gt;&amp;nbsp;, Actually i know that the snippets are there for creating media entity and style definition, but, i don't know how to assign content values in those snippets. So, kindly give some example to explain it&lt;/P&gt;</description>
    <pubDate>Thu, 14 Mar 2019 04:08:47 GMT</pubDate>
    <dc:creator>muzzammil</dc:creator>
    <dc:date>2019-03-14T04:08:47Z</dc:date>
    <item>
      <title>Creating Media entities and style definitions through scripting</title>
      <link>https://community.ptc.com/t5/ThingWorx-Developers/Creating-Media-entities-and-style-definitions-through-scripting/m-p/598104#M34796</link>
      <description>&lt;P&gt;How can i go for creating Media entities and style definitions through service scripting?&lt;/P&gt;</description>
      <pubDate>Wed, 13 Mar 2019 09:02:04 GMT</pubDate>
      <guid>https://community.ptc.com/t5/ThingWorx-Developers/Creating-Media-entities-and-style-definitions-through-scripting/m-p/598104#M34796</guid>
      <dc:creator>muzzammil</dc:creator>
      <dc:date>2019-03-13T09:02:04Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Media entities and style definitions through scripting</title>
      <link>https://community.ptc.com/t5/ThingWorx-Developers/Creating-Media-entities-and-style-definitions-through-scripting/m-p/598142#M34800</link>
      <description>&lt;P&gt;For style definitions :&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;var params = {&lt;BR /&gt;name: undefined /* STRING */,&lt;BR /&gt;description: undefined /* STRING */,&lt;BR /&gt;content: undefined /* JSON */,&lt;BR /&gt;tags: undefined /* TAGS */&lt;BR /&gt;};&lt;/P&gt;
&lt;P&gt;// no return&lt;BR /&gt;Resources["EntityServices"].CreateStyleDefinition(params);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For Media entity:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;var params = {&lt;BR /&gt;name: undefined /* STRING */,&lt;BR /&gt;description: undefined /* STRING */,&lt;BR /&gt;content: undefined /* IMAGE */,&lt;BR /&gt;tags: undefined /* TAGS */&lt;BR /&gt;};&lt;/P&gt;
&lt;P&gt;// no return&lt;BR /&gt;Resources["EntityServices"].CreateMediaEntity(params);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;Mukul Narang&lt;/P&gt;</description>
      <pubDate>Wed, 13 Mar 2019 13:00:37 GMT</pubDate>
      <guid>https://community.ptc.com/t5/ThingWorx-Developers/Creating-Media-entities-and-style-definitions-through-scripting/m-p/598142#M34800</guid>
      <dc:creator>mnarang</dc:creator>
      <dc:date>2019-03-13T13:00:37Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Media entities and style definitions through scripting</title>
      <link>https://community.ptc.com/t5/ThingWorx-Developers/Creating-Media-entities-and-style-definitions-through-scripting/m-p/598331#M34819</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.ptc.com/t5/user/viewprofilepage/user-id/275134"&gt;@mnarang&lt;/a&gt;&amp;nbsp;, Actually i know that the snippets are there for creating media entity and style definition, but, i don't know how to assign content values in those snippets. So, kindly give some example to explain it&lt;/P&gt;</description>
      <pubDate>Thu, 14 Mar 2019 04:08:47 GMT</pubDate>
      <guid>https://community.ptc.com/t5/ThingWorx-Developers/Creating-Media-entities-and-style-definitions-through-scripting/m-p/598331#M34819</guid>
      <dc:creator>muzzammil</dc:creator>
      <dc:date>2019-03-14T04:08:47Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Media entities and style definitions through scripting</title>
      <link>https://community.ptc.com/t5/ThingWorx-Developers/Creating-Media-entities-and-style-definitions-through-scripting/m-p/598340#M34822</link>
      <description>&lt;P&gt;&lt;a href="https://community.ptc.com/t5/user/viewprofilepage/user-id/297154"&gt;@muzzammil&lt;/a&gt;&amp;nbsp;: entities attached .that will help in creating media &amp;amp; style def entities through services.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Mar 2019 07:06:52 GMT</pubDate>
      <guid>https://community.ptc.com/t5/ThingWorx-Developers/Creating-Media-entities-and-style-definitions-through-scripting/m-p/598340#M34822</guid>
      <dc:creator>rosharma</dc:creator>
      <dc:date>2019-03-14T07:06:52Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Media entities and style definitions through scripting</title>
      <link>https://community.ptc.com/t5/ThingWorx-Developers/Creating-Media-entities-and-style-definitions-through-scripting/m-p/598352#M34825</link>
      <description>&lt;P&gt;For style:&lt;/P&gt;
&lt;P&gt;var params = {&lt;BR /&gt;name: "MyStyle12" /* STRING */,&lt;BR /&gt;description: undefined /* STRING */,&lt;BR /&gt;content: { "content": &lt;BR /&gt;{ "params" : "",&lt;BR /&gt;backgroundColor: "",&lt;BR /&gt;displayString: "",&lt;BR /&gt;fontEmphasisBold: false,&lt;BR /&gt;fontEmphasisItalic: false,&lt;BR /&gt;fontEmphasisUnderline: false,&lt;BR /&gt;foregroundColor: "",&lt;BR /&gt;image: "",&lt;BR /&gt;lineColor: "",&lt;BR /&gt;lineStyle: "solid",&lt;BR /&gt;lineThickness: 1,&lt;BR /&gt;secondaryBackgroundColor: "",&lt;BR /&gt;textSize: "normal",&lt;BR /&gt;description: ""&lt;BR /&gt;//name: "TestScriptStyle"&lt;BR /&gt;//tags: [] /* JSON */,&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;//tags: undefined /* TAGS */}&lt;BR /&gt;};&lt;/P&gt;
&lt;P&gt;// no return&lt;BR /&gt;Resources["EntityServices"].CreateStyleDefinition(params);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For media ,the content type requires is image ,so get the content type from LoadImage and then use it there liek this :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;var params1 = {&lt;BR /&gt;proxyScheme: undefined /* STRING */,&lt;BR /&gt;headers: undefined /* JSON */,&lt;BR /&gt;ignoreSSLErrors: undefined /* BOOLEAN */,&lt;BR /&gt;useNTLM: undefined /* BOOLEAN */,&lt;BR /&gt;workstation: undefined /* STRING */,&lt;BR /&gt;useProxy: undefined /* BOOLEAN */,&lt;BR /&gt;proxyHost: undefined /* STRING */,&lt;BR /&gt;url: undefined /* STRING */,&lt;BR /&gt;timeout: undefined /* NUMBER */,&lt;BR /&gt;proxyPort: undefined /* INTEGER */,&lt;BR /&gt;password: undefined /* STRING */,&lt;BR /&gt;domain: undefined /* STRING */,&lt;BR /&gt;username: undefined /* STRING */&lt;BR /&gt;};&lt;/P&gt;
&lt;P&gt;// result: IMAGE&lt;BR /&gt;var result = Resources["ContentLoaderFunctions"].LoadImage(params);&lt;/P&gt;
&lt;P&gt;var params = {&lt;BR /&gt;name: undefined /* STRING */,&lt;BR /&gt;description: undefined /* STRING */,&lt;BR /&gt;content: result /* IMAGE */,&lt;BR /&gt;tags: undefined /* TAGS */&lt;BR /&gt;};&lt;/P&gt;
&lt;P&gt;// no return&lt;BR /&gt;Resources["EntityServices"].CreateMediaEntity(params);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks ,&lt;/P&gt;
&lt;P&gt;Mukul Narang&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Mar 2019 08:41:01 GMT</pubDate>
      <guid>https://community.ptc.com/t5/ThingWorx-Developers/Creating-Media-entities-and-style-definitions-through-scripting/m-p/598352#M34825</guid>
      <dc:creator>mnarang</dc:creator>
      <dc:date>2019-03-14T08:41:01Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Media entities and style definitions through scripting</title>
      <link>https://community.ptc.com/t5/ThingWorx-Developers/Creating-Media-entities-and-style-definitions-through-scripting/m-p/598619#M34940</link>
      <description>&lt;P&gt;Actually, i have the set of images in my PC (in D drive). I need to use those images to create media entities. So, how can i go for doing that??&lt;/P&gt;</description>
      <pubDate>Fri, 15 Mar 2019 05:45:41 GMT</pubDate>
      <guid>https://community.ptc.com/t5/ThingWorx-Developers/Creating-Media-entities-and-style-definitions-through-scripting/m-p/598619#M34940</guid>
      <dc:creator>muzzammil</dc:creator>
      <dc:date>2019-03-15T05:45:41Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Media entities and style definitions through scripting</title>
      <link>https://community.ptc.com/t5/ThingWorx-Developers/Creating-Media-entities-and-style-definitions-through-scripting/m-p/598639#M34946</link>
      <description>&lt;P&gt;&lt;a href="https://community.ptc.com/t5/user/viewprofilepage/user-id/297154"&gt;@muzzammil&lt;/a&gt;&amp;nbsp;: rather you can place your image file in ThingworxStorage repository&lt;/P&gt;
&lt;P&gt;i have created a thing(imageLoadTest) using thingtemplate as FileRepository.&lt;/P&gt;
&lt;P&gt;in ThingworxStorage repository folder created a repository named as&amp;nbsp;imageLoadTest-- created a folder image inside it and placed the png file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;below is the script to load &amp;amp; create media entity&lt;/P&gt;
&lt;P&gt;///////////////////////////////////////////////////////////////////////////////&lt;/P&gt;
&lt;P&gt;var params = {&lt;BR /&gt;path: "/image/TCS_style&amp;amp;Media.PNG" /* STRING */&lt;BR /&gt;};&lt;/P&gt;
&lt;P&gt;// result: IMAGE&lt;BR /&gt;var Content = Things["imageLoadTest"].LoadImage(params);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;var params = {&lt;BR /&gt;name: "newMediaEntity" /* STRING */,&lt;BR /&gt;description: "newMediaEntity" /* STRING */,&lt;BR /&gt;content: Content /* IMAGE */,&lt;BR /&gt;tags: undefined /* TAGS */&lt;BR /&gt;};&lt;/P&gt;
&lt;P&gt;// no return&lt;BR /&gt;Resources["EntityServices"].CreateMediaEntity(params);&lt;/P&gt;</description>
      <pubDate>Fri, 15 Mar 2019 08:23:14 GMT</pubDate>
      <guid>https://community.ptc.com/t5/ThingWorx-Developers/Creating-Media-entities-and-style-definitions-through-scripting/m-p/598639#M34946</guid>
      <dc:creator>rosharma</dc:creator>
      <dc:date>2019-03-15T08:23:14Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Media entities and style definitions through scripting</title>
      <link>https://community.ptc.com/t5/ThingWorx-Developers/Creating-Media-entities-and-style-definitions-through-scripting/m-p/601684#M34999</link>
      <description>&lt;P&gt;Is there any way i could duplicate the default style definitions through scripting?&lt;/P&gt;</description>
      <pubDate>Mon, 18 Mar 2019 08:34:33 GMT</pubDate>
      <guid>https://community.ptc.com/t5/ThingWorx-Developers/Creating-Media-entities-and-style-definitions-through-scripting/m-p/601684#M34999</guid>
      <dc:creator>muzzammil</dc:creator>
      <dc:date>2019-03-18T08:34:33Z</dc:date>
    </item>
  </channel>
</rss>

