Forum Replies Created

Viewing 15 posts - 1,291 through 1,305 (of 1,335 total)
  • Author
    Posts
  • in reply to: GREP search to increment numbers? #54206

    Hank, I don't have the remotest idea how you think it would add 1 to any of these numbers …

    David is right, of course — GREP Is Not Magic. It cannot do calculations, nor can it search an item from a list[*] and replace it with an equivalent from another list. You cannot have a similar list in the replace field.

    [*] Well, it can, using the OR | operator, but “Replace” doesn't know which item it found.

    Also, you can enter a 'range' in the Find field in the form [a-z] — this will find anything from 'a' to 'z'. But GREP does not know maths — you cannot search for [69-82]. (Go ahead, try. You will see it treats this as '6', '9-8', and '2' — and its anybodies guess what it will do with the malformed range in the middle.)

    A script to search and change the numbers in your range could be something like this (a rough attempt but it seems to work):

    //DESCRIPTION: Change some numbers and leave some else. In a selection as well.

    // A Jongware production. No guarantees.

    var ranges = [

    [54, 103, 1],

    [104, 178, 2]

    ];

    // step 0: verify selection

    if (app.selection.length != 1)

    {

    alert (“Well, I warned you to select something!”);

    exit();

    }

    // step 1: find ALL numbers

    app.findChangeGrepOptions = null;

    app.findGrepPreferences = null;

    app.findGrepPreferences.findWhat = “\d+”;

    numberList = app.selection[0].findGrep(true);

    // alert ('found '+numberList.length);

    // step 2: change certain ranges

    for (a=0; a<numberList.length; a++)

    {

    thisVal = Number(numberList[a].contents);

    for (b=0; b<ranges.length; b++)

    {

    if (thisVal >= ranges[b][0] && thisVal <= ranges[b][1])

    {

    numberList[a].contents = String(thisVal+ranges[b][2]);

    break;

    }

    }

    }

    // step 3: … erm. That's all!

    (David, how to format code?)

    in reply to: image resizing #51170

    Eh, Fit Frame to Image?

    If you changed the scaling, select the inner area of the image with the white arrow and the control panel will show the scale percentages. Enter “100%” for both and then use Fit Frame to Image.

    in reply to: GREP search to increment numbers? #51189

    Hank, I don't have the remotest idea how you think it would add 1 to any of these numbers …

    David is right, of course — GREP Is Not Magic. It cannot do calculations, nor can it search an item from a list[*] and replace it with an equivalent from another list. You cannot have a similar list in the replace field.

    [*] Well, it can, using the OR | operator, but “Replace” doesn't know which item it found.

    Also, you can enter a 'range' in the Find field in the form [a-z] — this will find anything from 'a' to 'z'. But GREP does not know maths — you cannot search for [69-82]. (Go ahead, try. You will see it treats this as '6', '9-8', and '2' — and its anybodies guess what it will do with the malformed range in the middle.)

    A script to search and change the numbers in your range could be something like this (a rough attempt but it seems to work):

    //DESCRIPTION: Change some numbers and leave some else. In a selection as well.

    // A Jongware production. No guarantees.

    var ranges = [

    [54, 103, 1],

    [104, 178, 2]

    ];

    // step 0: verify selection

    if (app.selection.length != 1)

    {

    alert (“Well, I warned you to select something!”);

    exit();

    }

    // step 1: find ALL numbers

    app.findChangeGrepOptions = null;

    app.findGrepPreferences = null;

    app.findGrepPreferences.findWhat = “bd+b”;

    numberList = app.selection[0].findGrep(true);

    // alert ('found '+numberList.length);

    // step 2: change certain ranges

    for (a=0; a<numberList.length; a++)

    {

    thisVal = Number(numberList[a].contents);

    for (b=0; b<ranges.length; b++)

    {

    if (thisVal >= ranges[b][0] && thisVal <= ranges[b][1])

    {

    numberList[a].contents = String(thisVal+ranges[b][2]);

    break;

    }

    }

    }

    // step 3: … erm. That's all!

    (David, how to format code?)
    
    
    		
    	
    in reply to: Plug-in/Script to convert US eng to UK or CAN eng #54162

    You can make a list of the different spellings and put that into the standard FindChangeByList script — that'll take care of 'realise', 'colour', 'mailbox', and their 'ilk' ('like').

    For the 'grammar', however, it's unlikely one will ever find a computerized solution. It would boil down to translating from one language to another. If you check Google Translate, you will see their only choice is plain 'English' — no dialects available.

    in reply to: Plug-in/Script to convert US eng to UK or CAN eng #51157

    You can make a list of the different spellings and put that into the standard FindChangeByList script — that'll take care of 'realise', 'colour', 'mailbox', and their 'ilk' ('like').

    For the 'grammar', however, it's unlikely one will ever find a computerized solution. It would boil down to translating from one language to another. If you check Google Translate, you will see their only choice is plain 'English' — no dialects available.

    in reply to: What's your work field? #54142

    Ah — you must have missed https://development.creativepro.com/for&#8230;..-do-you-do

    (Perhaps I should amend my little story with “hanging out on the forum too much” :-P)

    in reply to: From InDesign tables to Excel? #54141

    Roland, this “script” (it's a single line!) will convert all tables to text, separating the columns by a comma, and the rows by a hard return. It's a javascript, so save it with a “.jsx” extension.

    app.activeDocument.stories.everyItem().tables.everyItem().convertToText (",", "r");
    in reply to: What’s your work field? #51137

    Ah — you must have missed https://development.creativepro.com/for&#8230;..-do-you-do

    (Perhaps I should amend my little story with “hanging out on the forum too much” :-P)

    in reply to: From InDesign tables to Excel? #50802

    Roland, this “script” (it's a single line!) will convert all tables to text, separating the columns by a comma, and the rows by a hard return. It's a javascript, so save it with a “.jsx” extension.

    app.activeDocument.stories.everyItem().tables.everyItem().convertToText (",", "\r");
    in reply to: Pasting copy from a PDF into Idd #54039

    @Jesserenko Yes, GREP would certainly do what I want, especially if I can figure out how to keep double returns from being replaced so I won't lose the true paragraph return.

    Try this: (?<=[^r]) *r(?=[^r]) — replace with a single space.

    In its essence, it should search for at-left-not a return, any number of regular spaces (including none at all), a single return, at-right-not a return.

    Since copy-and-paste often introduces some space before carriage returns, you need to allow for zero or more spaces before that return.

    in reply to: Pasting copy from a PDF into Idd #50995

    @Jesserenko Yes, GREP would certainly do what I want, especially if I can figure out how to keep double returns from being replaced so I won't lose the true paragraph return. 

    Try this: (?<=[^\r]) *\r(?=[^\r]) — replace with a single space.

    In its essence, it should search for at-left-not a return, any number of regular spaces (including none at all), a single return, at-right-not a return.

    Since copy-and-paste often introduces some space before carriage returns, you need to allow for zero or more spaces before that return.

    in reply to: Convert Freehand MX to InDesign #54032

    Freehand is an illustrator program, and it's quite unlikely you can 'convert' artwork to native InDesign stuff.

    However, it should not be necessary. I don't think you can import (“Place”, in Indesign's parlance) native Freehand documents in InDesign (– have you tried?), but it should be possible to save the original files as something you can place in ID: Adobe Illustrator AI, PDF, or (when all else fails) EPS.

    Adobe on Freehand: “No updates to FreeHand have been made for over four years, and Adobe has no plans to initiate development to add new features or to support Intel-based Macs and Windows Vista.”

    If you want to be able to edit the files in a more modern package, try converting it to Illustrator instead. That should not be a problem at all, since Illustrator is an artwork design package as well. You can try opening the original file immediately, or use one of the other file types as above.

    in reply to: Convert Freehand MX to InDesign #51045

    Freehand is an illustrator program, and it's quite unlikely you can 'convert' artwork to native InDesign stuff.

    However, it should not be necessary. I don't think you can import (“Place”, in Indesign's parlance) native Freehand documents in InDesign (– have you tried?), but it should be possible to save the original files as something you can place in ID: Adobe Illustrator AI, PDF, or (when all else fails) EPS.

    Adobe on Freehand: “No updates to FreeHand have been made for over four years, and Adobe has no plans to initiate development to add new features or to support Intel-based Macs and Windows Vista.”

    If you want to be able to edit the files in a more modern package, try converting it to Illustrator instead. That should not be a problem at all, since Illustrator is an artwork design package as well. You can try opening the original file immediately, or use one of the other file types as above.

    in reply to: Build a biblical reference index with GREP #54011

    Nick,

    ([,sd]+(.d+)?)?

    will match “, 12.3” but stop after the first comma (and the number after that). “?” is zero or one time.

    Change to

    ([,sd]+(.d+)?)*

    to accommodate for a verse list of any length; “*” stands for zero or more times.

    in reply to: Are you seeing math captchas on this forum? #54009

    So what the problem with the math? If someone has problems getting the right answer, well, both Mac and Windows have a calculator Laugh

    This one is “The sum of 3+3″ — perhaps you could make 'em a bit more difficult, these are no fun at all …

    (Windows XP, SP3, IE 8 )

    (It's not there when editing a post, I notice.)

Viewing 15 posts - 1,291 through 1,305 (of 1,335 total)