Problems of memory on a loop on all characters in a document
Hi all
I'm trying to implement an export custom HTML of a part of the contents of a document.
I have a loop that checks whether any character has a particular style (bold, italic...) and apply the corresponding tag inline (< strong >, < i >).
This loop takes too long and makes inDesign to stop working. If I'm not mistaken, it's a memory leak problem. I searched these forums and other places and found no solution to my problem.
From what I've read here, it seems that each of these memory problems is always in need, it's a particular solution. I hope that you will be able to help me with this one.
This is my code:
main(); function main() { //Some code var txtFrames = //an array containing all TextFrame objects in the document var txtFramesLength = txtFrames.length; for (i = 0; i<txtFramesLength; i++) { var parLength = txtFrames[i].paragraphs.length; for (j = 0; j<parLength; j++) { var contentsWithCharStyle = applyCharStyle(txtFrames[i].paragraphs[j]); file.writeln('<p>' + contentsWithCharStyle + '</p>'); } } var charStyleName = ''; var charContents = ''; function applyCharStyle(paragraph) { var chars = paragraph.characters; var result = ''; for (k = 0, kLength = chars.length; k<kLength; k++) { charStyleName = chars[k].appliedCharacterStyle.name; charContents = chars[k].contents; if (charStyleName == '_03-Bold') { result += '<strong>' + charContents + '</strong>'; } else if (charStyleName == '_02-Regular-Italic') { result += '<i>' + charContents + '</i>'; } else if (charStyleName == '_04-Bold-Italic') { result += '<strong><i>' + charContents + '</i></strong>'; } else { result += charContents; } } result = result.replace(/<\/strong><strong>/g, ''); result = result.replace(/<\/i><i>/g, ''); return result; } }
If the problem is repeated calls to applyCharStyle. . AppliedCharacterStyle recovery of tanks [k] and .silence tanks [k] are special operations doing anything to slow down.
I guess that these properties are staying somewhere in memory every time.
Thanks in advance for your help and your time. .appliedCharacterStyle Appl dfdwyCharStyle applyCharStyle applyCharStyle
You can simply use a series of find/replace greps:
find: (. +), applied the character style: _03-Bold
set up: $ 1
and so on.
or at least use textStyleRange instead of the characters collection.
Tags: InDesign
Similar Questions
-
2000-2b44DX HP: problems with memory usage Ram installed
now that you see the problem, how can I solve this problem?
(I want to use all 8.00 GB memory ram installed)
It will use only 4 gigabytes, and it has 8 gigabytes installed. He recondises all 8 GB but only use half of it.
Hi @thing1989,
Welcome to the HP Forums!
It's a great place to find answers and suggestions!
You have the best experience in the HP forum, I would like to draw your attention to the Guide of the HP Forums Learn how Post and more
First of all, I ran the HP Support Assistant to facilitate updates of HP.
I see your screenshot you have 8 GB of ram installed and it is recognized but only 3.49 is usable. It might be book a piece of video memory, but it usually isn't that much.
It is possible that you have a bad RAM. If you test each individually both work?
Have you tried swapping ram slots?
You can also try this step.
Go to the admin. Tools-> System Configuration-> / Boot-> Adv. Boot Options and set memory Maximum 8192 instead of unselected.
To say thank you for the reply, please click on the thumbs upwards the button below.
If this should resolve your problem, please select solution provided to help other posters locate this information.
Good luck!
-
My calendar keeps events a month, but when I think back several months, only recurring and default events are preserved. I have a bad memory and want to keep all the events, I put on my calendar for a year. How can I do this?
Go to settings > Mail, content, timing and you should see an option for synchronization. Make sure that you put in all the events if you want to keep past events calendar
Alternatively you can also use iCloud.com to restore calendar events that may have been accidentally deleted
If you've accidentally deleted your calendars, reminders, or contacts of...
I hope this helps!
-
There seems to be a MAJOR problem (blocking/memory leak) in "subject: House", also known as start up Firefox, 26.0 Firefox Page, Windows!
seen on:
-Windows 7 x 64 machine with 12 GB of RAM and high performance CPU (core i7-920)
-Comments Machine virtual WinXP SP3 (in Oracle VirtualBox) running on the same computer
-Intel Atom D525 netbook with 4 GB of RAM, running Win7 x 64None of these machines are connected through Sync or something like that. The Firefox instance on the virtual machine is a fresh install / clean.
The problem:
-100% of cpu usage for 10 seconds, (util in XP) memory usage goes up to 1.7 GB
-If "subject: House" is actually the Firefox Start Page, it blocks the computer at startup of Firefox for 10 seconds
-If "subject: House" isn't the Firefox Start Page, startup is fine - BUT if I press the "home" on the toolbar button it loads "on: House" which causes the same question once againSounds that there is a problem with one of the code snippets that are responsible. I've seen several reports on this issue.
You can set the browser.aboutHomeSnippets.updateUrl pref an empty string on the subject: the page of config to disable loading (new) checked to see if that helps.
You can open the topic: config page through the address barYou must remove the ' storage\moz-security-about + origin "folder in the folder of Firefox to delete already profile stored clips.
You can use this button to go to the Firefox profile folder:
- Help > troubleshooting information > profile directory: see file (Linux: open the directory;) Mac: View in the Finder)
- http://KB.mozillazine.org/Profile_folder_-_Firefox
-
Hello. I'm just a beginner and I downloaded the itunes 12.3.3 update and now when I right click on a work of art albums all disappear from the track of this album. I also have problems with my get info tab. All of my info from the album crashes.
This can help (from turingtest2):
-
A problem with delays in call loops and DAQ
I'm programming a simulation for nuclear Rewetting for a reception centre to my company in Switzerland. It is a "fuel rods" heating and then fill the water Chamber. The pump starts automatically as soon as the core of the stem reached 750 C. After that, a requirement that the flow rate be checked to ensure the operation of the pump in the necessary conditions. If not, the heating must be stopped to avoid, well... meltdown. However, we must allow 10 seconds for the pump to respond, while allowing a rate of acquisition of data from 10 to 100 Hz.
The challenge is that I can not add a delay in my other main loop delay all acquisitions, but I can't understand how to trigger a device loop (with data acquisition for the single channel flow control) and the main loop when the loop device determines if the flow a initalised, answering the main loop with the agreement.
I think that a large part of my confusion is in the interaction between loops and knots of default comments labview's willy nilly. The only solution would be to have two 'core' loops that do not communicate with them, but rather to do the same thing while operating different synchronization? Tell me if you want I will post the file (even if its on a unnetworked computer and I don't think that it would also be useful).
Thank you + Curran
Here is a version 9.0.
-
problem with memory card reader
bought an Acer C720 Chromebook in July, nine. Now problems with memory card reader. Sometimes he reads, sometimes it won't. This can be corrected?
Hi PatPeoples84,
Yes it is possible, unfortunately it will probably come during the service.
I recommend you contact the provider of the guarantee. In the United States, refurbished products are managed by another institution as new products. If you have any questions, thinking to send me a private message with your serial number and I'll help you get the correct coordinates.
Thank you
Cory -
Problems of memory when running Solidworks.
Original title: access to more than 4 GB of ram
I have a computer Dell precision PWS690 under Vista Premium. It a 32-bit system. I'm having memory problems when you run Solidworks, saying: I do not have enough memory and I the hang of the program. The it guy installed an additional 8 GB, so I have now 12 GB of ram installed, but I think that it is only for access to less than 4. The Task Manager displays physical memory available to almost zero. Vista can access up to 4 GB of ram, and how to change it. It seems that I have an extra 8 GB that are not accessible. Thank you.
Hey Sonic drill,
1 are you facing this issue only when you run Solidworks?
You can try to perform a clean boot and see if it helps.
A clean boot to check if startup item or services to third-party application is causing this issue.
You can read the following article to put the computer in a clean boot:
How to troubleshoot a problem by performing a clean boot in Windows Vista or in Windows 7
After the troubleshooting steps, please refer to clean the boot link to put the computer to normal startup mode.
You can also read the following article and check.
Prevention of problems of memory
If this only happens with Solidworks, you can also get in touch with Solidworks for additional assistance.
SolidWorks is unable to get memory
Hope this information is useful.
-
Loop through all the items in a collection
I need to loop through all the elements of a collection in a VB.NET program that uses the InDesign API. For example, I want to loop through all the pasta spread masters in a document. Here is my sample code:
Dim I As Integer = 0
Var MyApp as InDesign.Application = Nothing
Var MyDoc as InDesign.Document = Nothing
Var MyPage as InDesign.Page = Nothing
MyApp = CType (Activator.CreateInstance (Type.GetTypeFromProgID ("InDesign.Application"), True), InDesign.Application)
MyDoc = CType (MyApp.Documents.Add (False), InDesign.Document)
With MyDoc
With. DocumentPreferences
. PageHeight = "8.5I".
. PageWidth = "5.5i."
Ends with
With. ViewPreferences
. HorizontalMeasurementUnits = InDesign.idMeasurementUnits.idPoints
. VerticalMeasurementUnits = InDesign.idMeasurementUnits.idPoints
Ends with
If. MasterSpreads.Count > 0 Then
For I = 0 To. MasterSpreads.Count - 1
Dim ThisMasterSpread As InDesign.MasterSpread = CType (.) MasterSpreads.Item (I), InDesign.MasterSpread)
Next I
End If
Ends with
When it runs, I get an error on the last Dim statement which defines ThisMasterSpread. It highlights. MasterSpreads.Item (I) and gives the following error:
COMException was unhandled: the Member required to the collection does not exist.
How I managed to loop over all the pasta spread masters?
Thank you!
A lot of trial and error, I discovered the answer to my own question: the Collections are 1-based, not 0-based. My statement
For I = 0 To. MasterSpreads.Count - 1
should be
For I = 1 To. MasterSpreads.Count
-
Loop through all of the xml elements
How do I loop over all xml tagged in a story? I created a reference to the xml elements of the story I want to like this:
var xmlStory = myDoc.xmlElements[0].xmlElements[0];
In this structure, I have items < v > 10 / < v >, which I want to change of < id v '10' = > 10 / < v >. I want to do in the InDesign scripting and not with XSL export because of workflow, I plan. I know I can loop on children in the structure like this:
for(var i=0;i<xmlStory.xmlElements.length;i++){ if(xmlStory.xmlElements[i].markupTag.name == "v"){ xmlStory.xmlElements[i].xmlAttributes.add("id", xmlStory.xmlElements[i].contents); } }
This works very well for the first level, but I want to find all elements with the tag '< v >. These tags can appear at any level in the structure. How can I make sure that all of them are included and not just the first elements of the child of the element of the story?
Try this,
#target inDesign;
var doc = app.activeDocument;
xmlTag var = doc.xmlElements [0];
var vTag = xmlTag.evaluateXPathExpression("//v")
for (var i = 0; i)<>
{
Try
{
vTag [i].xmlAttributes.add ("id", vTag [i].xmlContent.contents)
}
{catch (e)}
} -
problem of memory during installation of the applet
Hello everyone,
I try to install an applet on TOP javacard IM GX4 card, but I have a memory problem...
This is my code of the applet:
and when I try to install it I have this error:package codeSimpleCompteur; import javacard.framework.APDU; import javacard.framework.Applet; import javacard.framework.ISO7816; import javacard.framework.ISOException; public class Test extends Applet { final byte CLA_MONAPPLET = (byte) 0xB0; final byte INS_INCREMENTER_COMPTEUR = 0x00; final byte INS_DECREMENTER_COMPTEUR = 0x01; final byte INS_INTERROGER_COMPTEUR = 0x02; private byte compteur; byte[] tab; public Test() { compteur = 5; } public static void install(byte bArray[], short bOffset, byte bLength) throws ISOException { new Test().register(bArray, bOffset, bLength); } public void process(APDU apdu) throws ISOException { byte[] buffer = apdu.getBuffer(); if (this.selectingApplet()){ return; } if (buffer[ISO7816.OFFSET_CLA] != CLA_MONAPPLET) { ISOException.throwIt(ISO7816.SW_CLA_NOT_SUPPORTED); } switch (buffer[ISO7816.OFFSET_INS]) { case INS_INCREMENTER_COMPTEUR: compteur++; break; case INS_DECREMENTER_COMPTEUR: compteur--; break; case INS_INTERROGER_COMPTEUR: tab = new byte[5]; tab[0] = compteur; apdu.setOutgoing(); apdu.setOutgoingLength((short)tab.length); apdu.sendBytesLong(tab,(short) 0, (short) tab.length); break; default: ISOException.throwIt(ISO7816.SW_INS_NOT_SUPPORTED); } } }
get_Status return:install -file codeSimpleCompteur.cap file name codeSimpleCompteur.cap Command --> 80E602001C09A00000006203010C0108A000000018434D000006EF04C60202700000 Wrapped command --> 84E60200286364A6E5E0D338639BBC807D11E7639A6D1A163A3195C79C076B3E6818C0EE2E59066D9AEAAC01ED00 Response <-- 009000 Command --> 80E80000EFC4820265010013DECAFFED010204020109A00000006203010C0102001F0013001F000E000B0056000C00B0000A0023000000BD00000000000001010004000B01020107A000000062010103000E010AA00000006203010C0101003306000C0080030B00010701000000430700B0000210188C00111810B0880018038801180488021805880318068804181006880518078806180888071810078808180888097A04308F000B3D8C000C181D1E8B000D7A0421198B000E2D188B000F60037A1A032510B06A08116E008D00101A042573004800000002000D00180023183D840904415B88097038183D840904435B8809 Wrapped command --> 84E80000F812D71F1AFC82A2FDB501FF71CCEB5E29DE80D33AFFE71FF49288374F89CF6B56C0988032BB379C47534C47E9E3B3F4F45B86B7B564BB2489542CE853946DC877E011CFB1F802FEABB62D9CF84BD723763D3ED8D6E11AA9F7042912DD81EFA827BC88ED3D8938053A2AA38D52FACE16A4852DE7EE63FF85B4265AA002B31E6B63D3A4A3301B88F2A07C6E5C770235369CC984A490365AFD2A1F8FCA02C3E7E3D3DFB65088D66EBD2E167B7199EEE94FD8F9B8C034E27E2FF7C34685D82B5EDC04A8ED6D8B19EBFBBEA73863CFD0BC75C6CD42AC85975908E01477BA2DCB0FD0386C1E552BEFF92DCED548980B830D0A47767FB6BF51176BEB Response <-- 009000 Command --> 80E80001EF702D181029900B870AAD0A03AE0938198B00123B19AD0A928B001319AD0A03AD0A928B00147008116D008D00107A08000A0000000000000000000005005600150200000102000002020000030200000402000005020000060200000702000008020000090200000A0200000001000000060000010380030203800A0103800303068007010680030003800A0703800A0903800A0509002300140B04040404050404050440050605090203090703000B0531040607051037080A080B00BD010001000000000B00030000000000002E011000000180030210000002800303100000038003041000000480030510000005 Wrapped command --> 84E80001F80AA622FE5D6E75C8EC596F1B01771A23433D84FAA0E45CCF6FD98FC5AF63A1B6C71E8FAFE640E743D30BB5B628255AE9942A60A803599555942C44520B2D2B27F5981029F781D5544A0031518D3399C91F000C7AFE086ED091CF012676CE35A00A5676F087B9F3D3E6C42AEAF2CEE4848E9B751A2C9665AE16F98EEB5D2A160F8B12D9DD7B1A5849579ECF8006289B40454E3E8A8C12451FDA75F575448E41E6BDE1374C50717C872E06439A5F625267A757CB5B247D0C7A363AB3F8F85E40D696D277212E45EF6BE71F6CC43FE4BDD4ED7D6C5FB6C5F785A6926BCD71A30F381C7A11135314721EBD4AC80AE911AB23B8CF0323658AEC8F Response <-- 009000 Command --> 80E880028B8003061000000680030710000007800308100000088003091000000980030A0200000A8003008100010030003000000000010900330032000E0000000007010043003E006B000000000015002C002C002C002C002C002C002C002C002C002C002EFFFF00300032002E00350037003000390037003B013001B0011004B43101200241014004B441066800A100 Wrapped command --> 84E88002988B26EA862F2CEBBB9D85FAE96EEEA8CC7C9134BDFBC258587EC8A31D0721E35DEE8F8E80B24ADADE5B4871A291FC1A3396CE9F510A650EAB195D352E696F3450325FCEFE18DDF94C86BE8B8A268956AECA9C4E83DC6B91AF0BA0D03E9E78896769146B41578ED560409049D01202A027AF7EF73985FB65F4C0C47B45F400F4B9EDE2BC344EF09DD437D7429043821EC3EC5A6AC6CE99912400 Response <-- 009000 Command --> 80E60C002609A00000006203010C010AA00000006203010C01010AA00000006203010C0101010002C9000000 Wrapped command --> 84E60C0030FE5C8C290BD6BF2BEFF1C59495E884045AB4418BAFBF48D6C41A9BACD25DE3462262C0B503564CCE38087340DAB6C8DF00 Response <-- 6A84 install_for_install_and_make_selectable() returns 0x80206A84 (6A84: Not enough memory space.)
I can't uninstall this applet, and I'm not sure that the problem is memory space...OP201_get_status() returned 18 items List of applets (AID state privileges) a0000000620001 1 0 a0000000620002 1 0 a0000000620003 1 0 a0000000620101 1 0 a000000062010101 1 0 a0000000620102 1 0 a0000000620201 1 0 a00000015100 1 0 a0000001320001 1 0 a0000000030000 1 0 a000000018100101 1 0 a000000018100106 1 0 a000000018100201 1 0 a00000001830080100000000000000ff 1 0 a00000001830080100000000000000fe 1 0 a00000001830060200000000000000ff 1 0 a00000001830060100000000000000ff 1 0 a00000001830030100000000000000ff 1 0
you have an idea about this? There is an option with GPshell know the size of free memory on the card?
concerning
Alexisyour instruction register (blabla) is bad.
This function receives the INSTALL APDU buffer (to install [and maybe make selectable]).
bOffset points to the offset in the table where the length of using the instance is stored in LV format (see globalplatform).
Register() expected
-the table where the help applet is stored
-the offset in which it is stored
-the duration of the assistanceexample: you are somewhere in the apdu
..... 06 112233445566...bOffset corresponds to the shift in Baker at the "06" value
AID has length 06 and started the next byte.If you need to write
Register (Baker, (short)(bOffset+1), Baker [bOffset]);
By change, register() without parameters is done automatically.
can you guess your mistake now? Register (Baker, bOffset, bLength) indicates that the cmdlet HELP length is the length of the full buffer, starting at an offset of zero in the buffer zone. It is a bad mistake of length to HELP, combined with excess of array subscript if the french_traveller_64 trying to copy using!
concerning
-
How do I loop over all the components on a form
How do I loop over all components on a form to see if they are visible or not?
Thanks in advance for the help!
Have an ordinary day...
KomputerMan ~ | :-)Assume that c is the component that you want to see the children:
for (var j: int = 0; j< c.numchildren;="">
{
var child: UIComponent = c.getChildAt (j) as UIComponent;
No matter what
} -
To loop through all the variables on an image
Hello. I am trying to write a method to save the State of the game that I do. I am able to loop through all the clips and get their existing frameworks, but is it possible to loop through all the variables on the current frame (without knowing their names) and put them in a table?
Thanks 4 any help
trigger2160Thanks for the help. A container object is just what I wanted, even though I knew not u can do. my variables are not accessible directly so I managed to change the way they were stored easily without negative effects for the rest of the game. Now I can also save and load the State of the game which entered 4 will facilitate 4 me to test.
trigger2160
-
Downloading Firefox, all my saved PDF documents have been turned into a Google Chrome document format, WHY? WHY a person like me is not notified before that starts the download process so that they have a chance to 'place' or 'Cancel' the download process? I want that they all be changed to PDF, HOW should I do this?
Nothing happened to your files. The association for PDF files is messed up, or is the icon cache.
- Click round Windows logo in the taskbar and choose default programs.
- Click "associate any type of file or Protocol with a program.
- Select PDF from the list, then click on change program button.
- Choose the program that you want to manage PDF files. By clicking on the files PDF in Windows Explorer or the desktop then open them in this application.
To clear the cache of the icon, see the directions to
As far as I know, Firefox does not have PDF files somehow. There is a proposal to associate files PDF in Firefox when they are not already associated with an application, but has not been implemented to date (bug 787674).
-
Hello
I turned on my computer and all my files and documents disappeared from my screen and everything? can someone help me please?
The simple thing to try is first of all to choose to restart the computer, that can solve. I suspect that your PC started with the default profile instead of yours.
-steve
Maybe you are looking for
-
AirPlay can not find my Denon AVR-X1100W
After IOS10 update with Airplay music player can't find my Denon AVR-X1100W, he finds only Iphone and Apple TV Itunes on PC works with Denon.
-
Equium A100-147: I get an error during the recovery procedure
Hi again, I had trouble with my equium a100-147.I tried a restore, but the disc is scratched so I phoned in ESL and it snet me a new recovery image. I tried the new recovery disk and am now errors when I boot the disk. error is "internal error crc fi
-
Hi guys, I use the elapsed time to set an expectation and to have, at the same time, the ability to stop waiting. The problem is that if for example I put on hold for 1 minute the first time everything works fine, but when I repeat the same operation
-
Laptop quick launch mute my computer Pavilion dv6-1050us button does not work properly. He puts the speakers muted, but does not change color. It's still orange, not mater if your speakers are on or off. His other (white) State works because it is
-
Is it possible that I can get help from pictures that were recently deleted?
These pictures do not appear in the "deleted" folder, or in any recylcl bin. Any child assistance would be appreciated, please & thank you.