Loop through layers and determine if its a text containing layer
Hi,
I am trying to loop/iterate through all layers, determine if it's a "text-layer", if it is, set it's opacity to 0.
This is what I have so far:
var iapp = new Illustrator.Application();
var openoptions = new Illustrator.OpenOptions();
var idoc = iapp.Open("c:\\myFile.pdf", Illustrator.AiDocumentColorSpace.aiDocumentRGBColor, openoptions);
Illustrator.Layer mainlayer = idoc.Layers["Layer 1"];
foreach (Illustrator.GroupItem groupitem in idoc.GroupItems)
foreach (Illustrator.GroupItem item in groupitem.GroupItems)
/* determine here if its a textlayer */
if( ... ) // (item.TextFrames.Count > 0) perhaps?
item.Opacity = 0;
//item.Opacity = 15; //this indeed sets the layer opacity 15
Is that VB? Does your soloution need to be too?
#target illustrator
textLayersOff();
function textLayersOff() {
var doc = app.activeDocument;
for ( var i = 0; i < doc.layers.length; i++ ) {
if ( doc.layers[i].textFrames.length > 0 ) { doc.layers[i].opacity = 0; };
This would check for text frames NOT their content… if any
Similar Messages
-
Looping through folders and subfolders
Hi,
I'm about to create a script to check some tifs and jpgs for the right height and width, resolution and so on.
I could get it to work if I see the files in the content panel (looping through the files by app.document.getSelection ...
The script needs to check many files in different subfolders (all in one parent folder), so I don't like to use a collection to reveal all files of all subfolders first and then start the script.
My plan is to choose the parent folder in the folder panel and the script should loop through each file of each subfolder ...
So maybe there's someone who knows a solution for this problem, it would be great!
Thanks a lot,
Sebastian.Wow,
That was fast, I'll test it tommorow in the morning, thanks a lot so far!
Hopefully I'll be able to get our scripts together...
Thanks
Sebastian
Am 05.08.2012 um 20:13 schrieb Paul Riggott <[email protected]>:
Re: looping through folders and subfolders
created by Paul Riggott in Bridge Scripting - View the full discussion
This should get you started...
#target bridge
var folders =[];
folders = FindAllFolders(Folder(app.document.presentationPath), folders);
folders.unshift(Folder(app.document.presentationPath));
for(var a in folders){
var fileList = folders[a].getFiles(/\.(jpg|tif)$/i);
for(var p in fileList){
var thumb = new Thumbnail(fileList[p]);
var height = thumb.core.quickMetadata.height;
var width = thumb.core.quickMetadata.width;
var Resolution = thumb.core.quickMetadata.xResolution;
if(Resolution ==0) Resolution =72;
//do your processing here
//$.writeln(decodeURI(thumb.spec) + "," + height + "," + width + "," + Resolution);
function FindAllFolders( srcFolderStr, destArray) {
var fileFolderArray = Folder( srcFolderStr ).getFiles();
for ( var i = 0; i < fileFolderArray.length; i++ ) {
var fileFoldObj = fileFolderArray[i];
if ( fileFoldObj instanceof File ) {
} else {
destArray.push( Folder(fileFoldObj) );
FindAllFolders( fileFoldObj.toString(), destArray );
return destArray;
Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page: http://forums.adobe.com/message/4599891#4599891
To unsubscribe from this thread, please visit the message page at http://forums.adobe.com/message/4599891#4599891. In the Actions box on the right, click the Stop Email Notifications link.
Start a new discussion in Bridge Scripting by email or at Adobe Forums
For more information about maintaining your forum email notifications please go to http://forums.adobe.com/message/2936746#2936746. -
Looping through Collection and getting ConcurrentModificationException
I'm trying to loop through a collection to delete some objects referenced by that collection but keep coming up against a ConcurrentModificationException.
BwView view = svci.getViewsHandler().find("Lists");
Collection<BwSubscription> subarr = new TreeSet<BwSubscription>();
subarr = svci.getSubscriptionsHandler().getAll();
if (subarr == null) {
logger.info("Its not working");
for (BwSubscription sub: subarr) {
logger.info("Removing subs " + sub);
svci.beginTransaction();
svci.getSubscriptionsHandler().delete(sub);
logger.info("Deleting calendars :" + sub);
svci.endTransaction();
The loop is allowing me to delete the first entry but then fails with the exception.
I have tried with a generic loop but this doesn't initialise the sub entity so the loop fails and is ignored leading to problems later in the code.
BwView view = svci.getViewsHandler().find("Lists");
BwSubscription[] subarr = (BwSubscription[])view.getSubscriptions().toArray(new BwSubscription []{});
if (subarr == null) {
logger.info("Its not working");
for (int i=subarr.length - 1; i>=0; i--) {
sub = subarr;
logger.info("Removing subs " + sub);
svci.beginTransaction();
svci.getSubscriptionsHandler().delete(sub);
logger.info("Deleting calendars :" + sub);
svci.endTransaction();
Sub is either not initialised or gets initialised as 0 causing an ArrayIndexOutofBoundsException. I'd be grateful for some advice on getting the code to loop correctly.While iterating over a collection (using its iterator), a ConcurrentModificationException will be thrown if the collection is modified, except if it is modified using the iterator itself.. The enhanched for-loop you're using is iterating over the collection by implicitly using an Iterator. To do what you want, make the Iterator explicit (change the enhanced for-loop to a while loop) and then use iterator.remove().
-
How to Loop through App and finding popup Windows
Does anyone know how to loop through the app and find any
popup windows..I guess application by default creates a SystemManager
object... So i used
this.systemManager.popUpChildren.numChildren and it gives me
0 all the time.. even though I have instances of windows to the
app.. According to the documentation this should give you the
number of popup children but it doesn't.. Any more ideas? -
Loop through select and create cursor
Is it possible to create a cursor after looping through a select?
FOR TEST IN
SELECT *
FROM SOMETABLE
WHERE SOMEID > 100
) LOOP
IF TEST.NAME = 'AB' THEN
--CREATE CURSOR AND LOAD DATA
--LOAD TEST.ID, TEST.NAME, TEST.ADATE INTO NEW CURSOR
END IF;
END LOOP; This is just a sample not the actual scenario.SeshuGiri wrote:
Is it possible to create a cursor after looping through a select?Yes. But is also usually the wrong thing to do.
A cursor loop within another cursor loop is known as a nested loop join in SQL. The SQL language is perfectly able to do joins like that. And far better and faster. It has a very clever optimiser and has more sophisticated algorithms than just a nested loop, for joining data sets.
The sample code you've posted shows a very old 80's style Cobol approach to processing ISAM files or magnetic tape. In a row-by-row fashion.
This approach does not scale in the modern database, where the SQL language is a data set processing language - and not an I/O interface for merely reading a record/row and writing a record/row as we did in the 80's with file-based data records.
The basic approach to Oracle is: Maximise SQL. Minimise PL/SQL (Java/etc).
This means using the very flexible, incredibly powerful, SQL language first and foremost to crunch database data. And only when the processing is beyond the capability of the SQL language alone, employ PL/SQL. Else restrict PL/SQL to managing only the process flow and error handling of SQL language statements. -
Looping through elements and assigning the proper attributes
So I'm trying to loop through all my xml elements. I then
want to loop through an element and an elements child and all
attributes assigned inside. Does this make sense, I hope so? This
is for an on going Cascading menu I have been building. So
basically every element inside an element would be a submenu of a
menu. Here is what I have....Okay. Much better subject line this time. :)
You apparently know what a factorial is. You need to multiply the input by all numbers less than it (except for special case of 0! [but, then, you tell them to enter a number between 1 and 12]).
You don't want your loop to be "while (true)". You can either start at 1 and work your way up to the input number, or start at the input number and work your way down. You may want a 'for' loop instead of a 'while' loop.
In this (and most cases), think about how you would calculate factorials manually. Write it down in English. Then, translate it to code.
You've been working on factorials for a while now. You haven't found the algorithm yet? -
How to loop through dates and return a list of dates?
hi,
thank you all for your help my all my oracle endaevors so far:)
I was going through PL/SQL Programming book by Oracle Press, but overall wasnt able to find the answer for the following.
I have a list of shops, simple: shop_name (table), date_holiday (table) that lets me keep dates that certain shop is closed.
example: shopID = 10
shopID 10
date_holiday 12/31/2009
shopID 10
date_holiday 1/1/2009
now, what I am trying to achieve is I am trying to get the list of days (formatted as MM/DD/YYYY, but thats not biggy) starting today and ending up in 3 months from now that will EXCLUDE all the holidays, example
select date_open ...... where shopID = 10;
[starting today]
12/29/2009
12/30/2009
1/2/2010
1/3/2010
[ending 3 months from today]
any simple ways or ideas that may help?
thank you!somehow like this
select :the_shop shopid,the_day date_open
from (select the_day,date_holiday
from (select trunc(sysdate) + level the_day
from dual
connect by level <= add_months(trunc(sysdate),3) - trunc(sysdate)
) d,
(select date_holiday
from holday_table
where shopid = :the_shop
) h
where the_date = date_holiday(+)
(select nvl2(location_open1,'open,','mon,')||
nvl2(location_open2,'open,','tue,')||
nvl2(location_open3,'open,','wed,')||
nvl2(location_open4,'open,','thu,')||
nvl2(location_open5,'open,','fri,')||
nvl2(location_open6,'open,','sat,')||
nvl2(location_open7,'open,','sun') location_not_open
from locations
where locationid = (select shopid
from shops
where shopid = :the_shop
where instr(location_not_open,to_char(the_day,'dy')) = 0
or date_holiday is nullRegards
Etbin -
Loop through xml and update the value
I have the following xml table. I need to update the Field which name="data"
<?xml version="1.0" encoding="ISO-8859-1"?>
<Root name="xyz">
<Row id="1">
<Field name="data">456</Field>
<Field name="time">2005-02-08 10:43:51</Field>
</Row>
<Row id="2">
<Field name="data">123</Field>
<Field name="time">2005-02-08 10:43:16</Field>
</Row>
</Root>
After update, the table should look like this
<?xml version="1.0" encoding="ISO-8859-1"?>
<Root name="xyz">
<Row id="1">
<Field name="data">abc</Field>
<Field name="time">2005-02-08 10:43:51</Field>
</Row>
<Row id="2">
<Field name="data">edf</Field>
<Field name="time">2005-02-08 10:43:16</Field>
</Row>
</Root>
How do I update the value through java program? I do not want to load the data to database to update the value. The constrain is that i must have the value updated in java application before I loaded it to the database.
Please any advise?
Thank you!Use a DOM parser to parse the xml document...you will get a Document object, which you can use XPath or traverse the DOM tree and perform the updating.
-
Loop through header and item internal table
Hi,
My scenario will be like this, i have two internal tables which is populated based on certain conditions, now i have to call one bapi to update values that am going to store values in a tree structure say for eg mat01 is header and mat02 and mat03 are item values.
What is the efficient method to call that bapi one time for header creation and consequte times for item creation respectively.
shall i have to loop thro two internal tables i.e header and item?
suggestions are welcomed from the experts...
Thanks in advance...
Regards,
BabuHi Babu
you can do something like that.
loop it_header.
*Call bapi to create header
loop it_item where field_key = it_header-field_key.
* Call bapi to create item
endloop.
endloop.
The important part is the where sentence in the second loop.
Regards
David N. -
Issue in looping through drives and servers
I'm trying to write a script which scan through all the drives and find old files with specific extension on the list of servers which I pass in servers.txt. Please find below the errors and the script which I executed. Can anyone suggest 1) why it is checking
in my local desktop drive rather than server listed in servers.txt.2) How to pass a value to a variable :$diskname="\\$strComputer$\$disk$"
Error Message
starting
Cannot find an overload for "op_Subtraction" and the argument count: "2".
At C:\Documents\oldfiles_new.ps1:29 char:25
+ $time = ((Get-Date) - <<<< $file.CreationTime).Days
+ CategoryInfo : NotSpecified: (:) [], MethodException
+ FullyQualifiedErrorId : MethodCountCouldNotFindBest
\\.$\\\local_host\root\cimv2:Win32_LogicalDisk.DeviceID="D:"$
Compiling list, this could take a while.
Get-ChildItem : Illegal characters in path.
At C:\Documents\oldfiles_new.ps1:25 char:23
+ $files = get-childitem <<<< $diskname -Include *.trn,*.bak -recurse
+ CategoryInfo : InvalidArgument: (\\.$\\\ACWIN-MG....DeviceID="D:"$:String) [Get-ChildItem], ArgumentException
+ FullyQualifiedErrorId : ItemExistsArgumentError,Microsoft.PowerShell.Commands.GetChildItemCommand
Script which I executed:
function oldfiles {
Param(
[alias("f")]
$outfile,
[alias("a")]
$maxage,
[alias("d")]
[string] $strComputer)
#If a parameter was not specified, set a defualt
if (!($strComputer)) {$strComputer = "."}
if (!($outfile)) {$outfile = "C:\Documents\oldfiles.csv"}
if (!($maxage)) {$maxage = 10}
#param( [string] $strComputer)
# Get the Disks for this computer
$colDisks = get-wmiobject Win32_LogicalDisk -computername $strComputer -Filter "DriveType = 3"
foreach ($disk in $colDisks) {
$diskname="\\$strComputer$\$disk$"
$diskname
Write-host "Compiling list, this could take a while."
$files = get-childitem $diskname -Include *.trn,*.bak -recurse
"File Name `t Age in Days " | out-file $outfile
write-host "starting"
foreach ($file in $files) {
$time = ((Get-Date) - $file.CreationTime).Days
#$totalSize = {($file).Length -gt 5kb }
if ($time -gt $maxage -and $file.PSiSContainer -ne $True) {"$($file.FullName) `t $time `t" | out-file -Append $outfile}
foreach ($computer in cat C:\Documents\servers.txt) {oldfiles $strcomputer}
Any help would be appreciated
ThanksThis will get you close but it will take forever to run.
function oldfiles{
Param(
$outfile='C:\Documents\oldfiles.csv',
$maxage=10,
[string]$computer=$env:COMPUTERNAME
$date=[DateTime]::Today
$colDisks=get-wmiobject Win32_LogicalDisk -computername $computer -Filter 'DriveType = 3'
foreach ($disk in $colDisks){
$driveletter=$disk.DeviceID.Split(':')[0]
$diskname="\\$computer\$driveletter$"
Write-host 'Compiling list, this could take a while.'
$files = get-childitem $diskname -Include *.trn,*.bak -recurse
"File Name `t Age in Days " | out-file $outfile
write-host "starting"
foreach ($file in $files) {
$time = ($date- $file.CreationTime).Days
if ($time -gt $maxage){
"$($file.FullName) `t $time `t" | out-file -Append $outfile
foreach ($computer in (cat C:\Documents\servers.txt)){
oldfiles $computer
¯\_(ツ)_/¯ -
Loop through month and year till date while using a merge statement
Hello Guys,
I have 2 tables with the following datas in them:-
Company
CompanyId CompanyName
1 Company1
2 Company2
3 Company3
Employees
EmployeeId EmployeeName CompanyId StartDate
1 Employee1 1 12/21/2011
2 Employee2 1 01/20/2012
3 Employee3 2 03/23/2012
4 Employee4 2 07/15/2012
5 Employee5 2 01/20/2013
6 Employee6 3 12/17/2013
Now i want to check, How many people were recruited in the team in the specified month and year? I have the storage table as follows:-
RecruiterIndicator
CompanyId Year Month EmployeeRecruited
1 2011 12 1
1 2012 1 1
2 2012 3 1
2 2012 7 1
2 2013 1 1
3 2013 12 1
This should be a merge stored procedure that should update the data if it is present for the same month year and company and insert if that is not present?
Please help me with this
Thanks
AbhishekIt's not really clear where the merge to come into play. To get the RecruiterIndicator table from Employess, this query should do:
SELECT CompanyId, Year(StartDate), Month(StartDate), COUNT(*)
FROM Employees
GROUP BY CompanyId, Year(StartDate), Month(StartDate)
Erland Sommarskog, SQL Server MVP, [email protected] -
I need to loop through 1 table and read another until a value changes
i need to read a table and sum the quantity field until a reason code changes. how do I go about doing this?
sort itab by reasoncode.
Loop at itab.
quantiy = quanity + itab-quantity.
at end of reasoncode.
jtab-reasoncode = itab-reasoncodee.
jtab-sum = quantity.
append jtab.
clear quantity.
endat
endloop.
or
sort itab by reasoncode.
loop at itab.
at end of reasoncode.
sum.
jtab = itab.
append jtab.
endat.
endloop.
or
let us say itab and jtab are two tables and you want to loop through itab and read jtab for reasoncodes.
if jtab has only one entry for each entry in itab then use read else use loop.
loop at itab.
loop at jtab where reasoncode = itab-reasoncode.
quantiy = quantiy + jtab-quanity.
endloop.
endloop.
or
loop at itab.
read table jtab with key reasoncode = itab-reasoncode.
if sy-subrc eq 0.
endif
endloop. -
Does anyone know a way to programatically loop through the items in the document library
A lot of the funcations like deleteSymbol and updateSymbol depend on which items are "selected" in the library panel.
Is there a way to programatically access these selections?
or
Loop through the library?
or
Set selections?Yup, I've asked for an API to access the selection in those panels for years, to no avail.
Note that you can loop through layers, frames and pages, but you can't tell what the user has selected in the actual panel UI. Also, you can't find out which symbols are currently used in the document. Nor can you programmatically insert a rich symbol into the document and have it maintain its "richness". -
Need code to search through folder and subfolders
Hi.....
Am trying to write a program to search for a file through folder and all of its sub folders.
I tried my best but i was able to search through a folder but not through its sub folders.
So, anyone could help me out with the code to do this operation?
Regards
codingquestcodingquest wrote:
Thank you very much for your reply.
I tried to use the recursive call but i could not do it without any errors.
So it would be helpful to me if you post the exact coding or the key part of the recursive call here.You'd get better response when you post your code and the error message(s). I'm sure someone will be able to point you in the right direction. -
Error "Screen output are too small" when looping through internal table!
Hello All:
I have a huge internal table with some 79000 records and while looping through them and doing some other processing inside the loop, I am getting an error "Screen output are too small"! Could someone please help mw how to fix this issue? I can send the all the code if anyone wants to look at the code. Thanks in advance and rewards are assured.
MithunHi,
Check this
new-page print off.
CALL FUNCTION 'GET_PRINT_PARAMETERS'
EXPORTING
destination = v_dest
IMPORTING
out_parameters = params
valid = valid.
* params-linct = '58'.
* params-linsz = '170'.
* params-paart = 'X_58_170'.
* params-prtxt = v_spool_text.
* params-primm = 'X'.
* params-prrel = 'X'.
NEW-PAGE PRINT ON PARAMETERS params NO DIALOG.
After the call fm GET_PRINT_PARAMETERS params internal table contains all the values for generating spool.
aRs
Maybe you are looking for
-
ASA 5505 VPN can't access inside host
I have setup remote VPN access on a ASA 5505 but cannot access the host or ASA when I login using the VPN. I can connect with the Cisco VPN client and the VPN light is on on the ASA and it shows that I'm connected. I have the correct Ip address but I
-
DV7-4069wm ACPI table reset/recovery
I have been unable to reset my acpi tables to factory defaults (firmware, not software). They were modified remotely via rootkit on win7 and BIOS was flashed backwards to F23 from F28. I cannot determine if I am running on flashed bios or a shadow va
-
Proxy to JMS Scenario: switch from sync to async proxy,does it makes sense?
Hi @all, i've implemented a sync proxy to JMS scenario that works well. Backend is ECC 6.0 and Middleware is PI 7.1. Business Case: Run a request with a number and get a response back with a corresponding entry for the number. That means, there is al
-
8120 Media Sync - "Your device is not recognized by Blackberry Media Sync"
I got a new (refurbished from ebay) Pearl 8120. I just downloaded the newest Desktop Manager and Media Sync software. The Desktop Manager works fine with the Pearl. The 8GB microSDHC card was formatted and has worked fine in the phone so far. Ho
-
how can i lock my folders of images,videos ,messages etc. In nokia 5800. Please friends request our nokia to update software of nokia 5800 with all these as like hide feature for music player.