VBScript - Place asset from library.
Hi, we currently do something in AppleScript which takes and element from and indesign library (.indl) something like:
set placedAsset to place asset asset "ElementName" of library "FF1.indl" on myDocument
select placedAsset
move to {LocationX, LocationY}
Does anyone know how to do in vbscript?
Thanks,
Joe
Joe:
I'm glad you got it working, but your solution is not correct .
The right way to solve this problem is to place the asset and move the returned page items. What you're doing is throwing away the reference to the returned pageitems and finding them anew on the assumption that they are the top pageitem on the page. Then you are selecting them -- scripts should never touch the selection if they can at all avoid it! Then you are moving them, but your move should not be dependent on the selection at all, so the selection is entirely unnecessary! And as you've noted, this only works if the library asset is grouped. Which is not considered best-practice (though sometimes it can be helpful, sometimes not).
(Maybe you have another reason for leaving the placed asset selected after you run the script, so the user can interact with it? If so, OK, but only to that small segment.).
I'm still not a VBScript programmer, but let's run through this. Remember what I said before:
Asset.placeAsset() returns an array of placed items. So loop over the array and move each page item to its desired location.
So:
Dim jLib = myInDesign.Libraries.Item("FF1.indl")
Dim jAsset = jLib.assets.item("Daily_News")
So far so good. But next you should have an array of pageitems returned.
Dim myPlacedAssets() = jAsset.placeAsset(myDocument)
then you should loop over them and move them. Or if you like, group them, move them, and ungroup them:
Dim myGroup = myDocument.Groups.Add(myPlacedAssets)
myGroup.Move(XY)
myGroup.Ungroup()
That probably won't work as written because I'm not a VB person, but that's the correct way to handle this consistent with the InDesign Document Object Model. I suppose it's possible that it won't work in VB because of strict typing issues, but I'm sure there's a way to do it properly....
Similar Messages
-
Missing XML Element when using asset from library
This is not really a scripting question but I seem to be unable to find any regular ID forum and it has something to do with a scripting workflow I established for a customer.
A script places an asset from a library onto a document and then (amongst other things) imports some XML file.
The asset in the library consists of a number of textframes and has the structure e.g.:
article
box
box
Now the customer needs new templates (that is assets in the library) and we cannot produce them anymore. It seems that as of CS 3 5.0.4 Adobe changed the behavior of the library. Dragging e.g. two box-tagged boxes with an article parent XML into the library leads to an asset without the article element. Can someone confirm this? And more important is there a reason to it? Or is there a way to configure the behavior?
I guess I could create a parent xml element by script after placing the element but then I would need to redo all existing libraries.
Thank you,
Ralfwhile( testIterator.hasNext() ) {
Element testElement = (Element)testIterator.next();
String code = testElement.getChildTextTrim("code");
if( null == code ) {
continue;
String analysis= testElement.getChildTextTrim("analysis");
//same for description
} -
How to insert Asset from library to Document?
Hi Guys,
I am getting crashing issue, when run the below code.
I am getting GetAssetList() value is 0, how to get the value and insert asset to document
InterfacePtr<IK2ServiceRegistry> registry(GetExecutionContextSession(), IID_IK2SERVICEREGISTRY);
InterfacePtr<IK2ServiceProvider> service(registry->QueryDefaultServiceProvider(kLibraryServiceID));
InterfacePtr<ILibraryService> libraryService(service, IID_ILIBRARYSERVICE);
PMString styleLibFileName("bx02_left");
InterfacePtr<ILibrary> PtrLibrary(AssetLibUtils::QueryStyleLibByName(styleLibFileName));//libraryService->QueryNthLibrary(0));
InterfacePtr<ILibraryCmdData> libraryOpenCommandData(openlibcmd, IID_ILIBRARYCMDDATA);
AssetIDList assetList = libraryOpenCommandData->GetAssetList();
if(libSuite && GetExecutionContextSession()->GetActiveContext())
ErrorCode result = libSuite->DoPlaceLibraryItems(assetList,PtrLibrary,pageItemUIDList,GetExecutionContextSession()->GetActiveContext()->GetContextView());
Please suggest me, i am new to indesigndragondriver wrote:
Hi all,
I create a project to compile bunch of VIs as lvlib and only export some libraries as public. I wonder how can I export the public VIs into the function palette? I try [Tools] -> [Advanced] -> [Edit Palette Set], I create a new Palette but when I insert VI by selecting the lvlib, it doesn't import the exported VI. I wonder if there is any way I can import the public VI from a lvlib into the function palette. Thanks.
After trying for hours, I finally find the solutions. -
InDesign and Applescript - Another place asset question.
I am trying to place an asset on page but am having some problems. If I have an asset in my library and it has a few items in like a couple text boxes and images and they are grouped together, it places fine but then I have a problem with trying to change styles for any individual items withing that asset because seems to treat group as item 1 of that asset and can't seem to get to reference individual items of asset that has grouped items. Tried things like "item 1 of placed asset" but treats that like group which is good for move but not when wanting to reference individual items. When I create placed asset with all individual items ungrouped then it does allow me to apply styles on individual items but then can't move everything to location as a group so allignment all stays correct. Thinking that maybe I could either ungroup all items in first scenerio after moving then apply styles but not sure how to refernence that group and then the items within that group when ungrouped. Or, doing second scenerio where load asset ungrouped then apply styles then group and move but since number of items in assets can be different, not sure how to dynamically create group using repeat or something? Thanks, Joe
repeat with i from 1 to count csvEntries
set csvEntry to csvEntries's item i
set {fldElement, fldLocationX, fldLocationY} to csvEntry's text items
set placedAsset to place asset asset fldElement of library "GTElements.indl" on myDocument
move placedAsset to {fldLocationX, fldLocationY}
-- apply styles to individual items os asset
-- Then, can I create group dynamically for all items in asset if ungrouped?
-- set myGroup to make group with properties {group items:{ placedAsset}}???
-- then move group to location?
-- Or
-- can I ungroup asset if comes in already with all items grouped
- First, move to location everything as a group then ungroup
-- tell placedAsset
-- ungroup
-- end tell
-- Now apply styles to individual items.I was working on script which uses dialog window. When you run script window with listbox pop up and than you can choose asset with shortcut. This is fastes way for placeing assets from library.
Did you try this
var myplacedasset=app.libraries[libIndex].assets.item(assetName).placeAsset(app.activeDocumen t);
Do what you want to do (apply object syles etc)
app.select(myplacedasset);
In this case you don't need to group item, you just select them and move selection to desired position. -
Guys, Any idea why I am unable to download assets from Adobe Market Place. I am using Adobe CC enterprise.
Cloud Market http://terrywhite.com/adobe-creative-cloud-market/ may help
-and http://helpx.adobe.com/creative-cloud/help/market.html -
Place an element from library to document
I know the name of library and name of element. How can my script place an element from library to document at any location?
You have to go through a bit of a song and dance. First, you must make sure there's no text selection active at the time, then you must move the item from wherever it lands to where you want it.
So, something like this:
app.select(null);
var myObj = theAsset.placeAsset(myDoc)[0];
and then you can move it to the right place on the page (you might even have to move it to the right page first -- although you can probably control that by setting the activePage first:
app.activeWindow.activePage = myPage;
Dave -
How to play MP4 videos from library assets, not external source
I can play MP4 video files all day long, as long as they are from an external source. How can I target via linkage MP4 video files in the library? I'm building a Kiosk application and can't have any external assets--only assets from the library. Please only post comments or solutions based on using the video object, not the Playback component. Thanks
have been trying this too , the manual says FAT32 files, just my two cents for ya
-
Moving assets from "My Library" to another
I recently several assets from the CC Market and they went into "My Library".
I since made new library folder to better organize them but can't find how to move them to the new folder. Do I have to delete them and download them again to get them into the new library folder? It seems a waste of time to do it that way. I can't seem to find the "My Library" on my computer.The files are just loose in the "Market Downloads" folder in the local "Creative Cloud Files" folder.I had two chats with Adobe tech support about this. After a lot of back-and-forth, it seems there is no way to move assets to a different library. My solution was to delete the assets and re-download them into the library I wanted.
I put in for a feature request but it doesn't seem like there was a real understanding of just what I was trying to do. -
Applying styles to place assest from AppleScript. CS5.5
We are running a script that based on a csv file, loads various elements from a library then imports XML. An example of these elements might be designed to have 4 separate item records within it and each item record might contain a few text boxes and an image and each of these items have xml tags. To better understand, think of a supermarket circular where they might have 4 meat items in one section with a description, size, price and an image. We've broken it into different sections and based on data coming from our database we can relate to a specific element in our indesign library and know how many items will need to be loaded in that section. This all works fine so far and is pretty cool how it loads but we are looking to maybe pass a basic page theme which might be both object and paragraph styles so we'd like to apply these styles through our script because it is possible that different elements might get different styles in same load or even same elements might be re-used in same load and have different styles so really can't define elements with styles we'd like or associate specific xml tages with styles because might be different in each element.
I can in Applescript apply paragraph and object styles to by either index like applying style x to paragraph 1 but would like to do it to element that we placed on page. Here is an example of our script to maybe better understand. Look for comments where we place our assets(elements) on page. Looking to how we can apply style to say paragraph 1 or text frame 1 of placedAsset says can't get text frame 1 or paragraph 1 of group xxx.
Tried variations of:
tell application "Adobe InDesign CS5.5"
set myDocument to active document
set myPage to active page of active window
set placedAsset to place asset asset "7" of library "GT.indl" on myDocument
move placedAsset to {0.65, 0.6}
tell myDocument
set myStyle to paragraph style "Style1"
set objStyle to object style "objStyle"
--This works for just applying styles by index
tell paragraph 1 of text frame 1
apply paragraph style using myStyle
end tell
tell text frame 1
apply object style using objStyle
end tell
--This gives error described above
tell text frame 1 of placedAsset
apply object style using objStyle
end tell
end tell
end tell
Script which runs now but is not set to apply styles yet:
try
set CSVstr to "Please locate your CSV file..."
set CSV_File to (choose file with prompt CSVstr) as text
set csvData to read file CSV_File
set csvEntries to paragraphs of csvData
tell application "Adobe InDesign CS5.5"
set myDocument to active document
tell XML view preferences
set show attributes to false
set show structure to true
set show tagged frames to false
set show tag markers to false
set show text snippets to true
end tell
tell XML import preferences
set allow transform to false
set create link to XML to false
set ignore unmatched incoming to true
set ignore whitespace to true
set import CALS tables to true
set import style to merge import
set import text into tables to false
set import to selected to false
set remove unmatched existing to false
set repeat text elements to true
end tell
set myPage to active page of active window
set AppleScript's text item delimiters to ","
repeat with i from 1 to count csvEntries
set csvEntry to csvEntries's item i
set {fldElement, fldLocationX, fldLocationY} to csvEntry's text items
-- display dialog fldElement
set placedAsset to place asset asset fldElement of library "GTElements.indl" on myDocument
move placedAsset to {fldLocationX, fldLocationY}
--This is where we'd like to apply styles to placed asset contents. This placed asset will have a few text frames and at
--least one image. We would just pass extra fields in our csv file with names of styles to be applied
end repeat
set AppleScript's text item delimiters to {""}
tell myDocument
set XMLstr to "Please locate your XML file..."
set XML_File to (choose file with prompt XMLstr)
import XML from XML_File
end tell
tell application "Adobe InDesign CS5.5"
set find text preferences to nothing
set change text preferences to nothing
set find what of find text preferences to "mykzlplx"
set change to of change text preferences to ""
tell active document
change text
end tell
set find text preferences to nothing
set change text preferences to nothing
set find what of find text preferences to "Â"
set change to of change text preferences to ""
tell active document
change text
end tell
set find text preferences to nothing
set change text preferences to nothing
end tell
end tell
end tryIt would be a lot easier to help you if you were more succint. You should practice narrowing down the problem to the smallest possible case that demonstrates it. This is a good skill for two reasons: (1) It makes it easier to find the problem yourself (2) It makes it easier for others to help you.
I believe your problem is you are asking for the first textframe of the placed asset:
set placedAsset to place asset asset "7" of library "GT.indl" on myDocument
tell myDocument
--This gives error described above
tell text frame 1 of placedAsset
apply object style using objStyle
end tell
end tell
end tell
At least in JavaScript, the place command returns an array of objects, without regard to type. I suspect that's true in AS as well.
So you probably want something like "tell first item of placedAsset" rather than "text frame 1". And if you want to make sure it is a text frame, because there are other things in the placedAsset, you'll need to use a filter. ("first item of placedAsset whose constructor is textFrame" or something like that).
Again, my applescript is really rusty, but I think that's the general idea. -
Can I exclude places.sqlite from time machine backup?
Hi,
Just looking at the time machine backup and raised a question about the repeated backup of places.sqlite in "~/Library/Application Support/Firefox/Profiles/xxxxxxxx.default/", I am wondering if I can exclude this file from my backup or even exclude Profiles from my backup?
What would this affect my backup? Are these all essentials?
I have looked into this page and understand what places.sqlite does. However, what don't know is if this file is missing, does Firefox produce one automatically?
Or say, if each of my places.sqlite in the prevoius backups was like 90MB, how much size would them really take in the storage?Alvyn wrote:
Thus, I am thinking if this "places.sqlite" thing is there every hour putting around 100MB to my time capsule, quickly my time capsule will be depleted.
No, that's very small.
Is there any way to do something like trimming time points from time capsule?
Under normal circumstances, you shouldn't have to. TM automatically "thins" (deletes) backups every time it does a new backup, on the following schedule:
"Hourly" backups after 24 hours (except the first of the day, which is a "Daily" backup).
"Daily" backups after a month (except the first of each week, which is a "Weekly" backup.)
"Weekly" backups are kept until TM needs the space for new backups; then one or more of the oldest weeklies will be deleted.
So after a month, even if you do an hourly backup every day, and that 100 mb file is changed and backed-up +*every time+* (not real likely), you'd have 54 backups (1 per day plus 24). That would take a total of 5.4 GB, small potatoes on any TM drive, and really not worth worrying about.
But if you want, you could delete all the backups of it. See #12 in the Frequently Asked Questions *User Tip,* also at the top of this forum. -
Move Assets from one device to another.
I need to move all of the assets in "Library" to "Media". Is there a simple way to do this and have all of the meta data point to "Media" instead of "Library"?
You guys should consider adding. I solved my problem by canceling one subscription and starting a new one but not ideal (quite a pain actually). But what about collaboration? Would love to be able to have one person start a drawing in Draw then easily send it to a second person to finish in AI.
Sent from my iPad -
Create fixed assets from within the transaction for creating the purchase order
Hello All,
I have gone through the notes on help.sap.com related to automatic creation of asset master record at the time of creating purchase order. I am not sure how do we achieve this?
Link to the notes on help.sap.com
SAP Library - Asset Accounting (FI-AA)
Any suggesstions from the expert group is appreciated.
Thank you,
VinayHi Vinay
I know there is a feature whereby you assign asset classes per material group and then you create assets from within the PO. I never used it though
Let me tell you one thing or rather ask you. Will you as a finance consultant be willing to let a MM guy create the assets??
Or will a MM guy be willing to create it?? If you allow them, you should be ready for surprises.
Honestly, this is a feature not worth exploring unless a FI guy is willing to create the PO. I would suggest the creation of asset masters should be with FI only
Br. Ajay M -
When my old PC died I had the tech guy place my iTunes library on an external hard drive. I just set up my iMac and I cannot get my library on the external hard drive to import to iTunes. I authorized my computer and had the "purchased" songs downloaded from iTunes directly, but I have 3,000+ songs from other sources that I cannot seem to get to. Help! What's the trick?!
maggiedoodle wrote:
When my old PC died I had the tech guy place my iTunes library on an external hard drive. I just set up my iMac and I cannot get my library on the external hard drive to import to iTunes.
Don't import anythiong.
Simply copy the entire /Music/iTunes/ folder from the external to /Music/ on the internal.
Launch iTunes.
That is all you need to do. -
Iphoto loses pictures from library
Hope someone can help. I have no trouble importing pics from my camera or desktop into iPhoto. However, once I reopen iPhoto they've disappeared from the library and events. If I've put them into an album they're in there but no sign of them anywhere else!
I've re-installed iPhoto09 but the same thing's happening.John
If I've put them into an album...
If they can be in an Album then they must be in an Event. Every photo in the Library is in an Event somewhere.
Also, if you can’t see them in an Event, how do you put them in a Library?
We sometimes see this apparently happen when the camera’s date is wrong and the photos end up in unexpected places in the Library.
Regards
TD -
Accessing Swatches from library
Hi,
I am creating a rectangle with VBscript and AI cs3
Set rectPath = pathItemsRef.Rectangle(300,10 , 100, 100)
and filling its color with swatch name as
rectPath.FillColor = garmentDoc.Swatches("Offset Squares Pattern").Color
and is working fine.
Now my issue how to access a swatch from library items I have created my own swatches and save it in library name say "Animal" in this library there is a swatch name say "Cheetah" can anyone help me out in accessing this swatch from library with VBscript.
Thanks
GirishUpon investigating this further at my end, we found the issue was that I had created the rectangles in the source Muse file with custom colors - but DID NOT have those colors in the swatches panel. That caused the swatches to be not exported with the MULIB.
Once I created swatches for my custom colors in the source Muse file and then exported rectangles with those color fills via Library, I was able to see the swatches added to my target Muse installation upon importing the MULIB.
Let me know if your issue is similar. Also share the exact steps that you are following if your case is different.
Cheers,
Vikas
Maybe you are looking for
-
Why can I no longer use AirPlay with my Slingbox? New updates break complatibility?
Why can I no longer use AirPlay with my Slingbox? New updates break complatibility?
-
I can't remove "Window" menu at Forms 6i
in Forms 6i .....I made Menu Item and called it "Window" ... and in property palette I customized as follow :- http://img219.imageshack.us/img219/1858/winitemqz6.png that suppose make the bar completely empty ... (because i removed DEFAULT&SMARTBAR f
-
PDF within IE acting differently between Reader 9x and 11x
We are in the process of upgrading from Reader 9x to 11x. In testing users have found that when they try to open multiple PDF's from a single webpage within Internet Explorer, 11x opens only one at a time, closing the current one and opening a new on
-
Macbook Pro 15 hinge gap?
Hello, I purchased my macbook pro about 2 months ago. I just recently noticed that there is a 1 mm gap on the left side of the hinge. There isn't a noticable gap on the right side so I just wanted to know if this was normal or not. If it isn't should
-
Unable to import CD after installed latest version iTunes 10.1.0.54
I just updated and installed the latest iTunes 10.1.0.54, but uable to import CDs. There always an error box pop up and the iTunes closed down automatically. I read through the forum and realised many people encountered same problem, but the advises