• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Extendscript / Token

Guest
Jun 01, 2015 Jun 01, 2015

Copy link to clipboard

Copied

When I delete a token how can I find out later in the code, that I already deleted it - before I save!

There exists a Token.delete() function but e.g. no Token.isDeleted().

Views

261

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 02, 2015 Jun 02, 2015

Copy link to clipboard

Copied

I suspect your question is not related to Adobe's RoboHelp product and that you have asked in the wrong forum.


See www.grainge.org for RoboHelp and Authoring tips

@petergrainge

Help others by clicking Correct Answer if the question is answered. Found the answer elsewhere? Share it here. "Upvote" is for useful posts.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jun 02, 2015 Jun 02, 2015

Copy link to clipboard

Copied

No. Again I am in the right forum. The question is targetting ExtendScript in RoboHelp.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 02, 2015 Jun 02, 2015

Copy link to clipboard

Copied

Apologies. I read the content and not the title.


See www.grainge.org for RoboHelp and Authoring tips

@petergrainge

Help others by clicking Correct Answer if the question is answered. Found the answer elsewhere? Share it here. "Upvote" is for useful posts.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 03, 2015 Jun 03, 2015

Copy link to clipboard

Copied

What is your workflow? Do you have a piece of code that is giving you problems?

I always assumed that if you delete a token, it will not be available anymore in the TokenManager. The following works fine in my project:

while(typeof(token)!="undefined")

  {

  if(token.isTag(startTag) && token.getText() == Content) {//We're in a H3 so let's get all content

  var warningtext = "";

  var tokensToDelete = [];

  var done = false;

  var tmpToken = token;

  while(done === false)

  {

  if(tmpToken.isTag("p")) {

  warningtext = tmpToken.getText(true);

  tokensToDelete.push(tmpToken);

  }

  else if(tmpToken.isTag("/p"))//Done!

  {

  tokensToDelete.push(tmpToken);

  done = true;

  }

  else

  {

  tokensToDelete.push(tmpToken);

  }

  tmpToken = tmpToken.next;

  }

  token.insertText('<p class="letopkop">'+Content+'</p><p class="letopteskt">'+warningtext+'</p>', true);

  for(var i=0; i<tokensToDelete.length;i++) {

  tokensToDelete.delete();

  }

  saveme = true;

  }

  //Next token

  token = token.next;

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jun 03, 2015 Jun 03, 2015

Copy link to clipboard

Copied

I want to cover following situation:

  token.delete();

  token = token.previous.next;

The 2nd line should not return the already deleted item or there should exist an "isDeleted()" function which tells me that I already deleted it.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 03, 2015 Jun 03, 2015

Copy link to clipboard

Copied

LATEST

Just tried and indeed, if you delete a token it is still there. There is no property or method available to check whether the token is deleted. Please consider leaving a feature request for this to be added: Adobe - Feature Request/Bug Report Form

I have tried if there is an easy workaround, but there is no simple workaround for writing your own deletetion option either. If you store the token, you can't simply check other tokens against it. So this is an oversight. Perhaps you can work around this by changing the behaviour of your script to not pass the same token twice. (Or save the file and load it up in the tokenmanager again for a second pass. Far from ideal, but it may help.)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
RoboHelp Documentation
Download Adobe RoboHelp