Script to generate parallel lines in Photoshop

How can I generate parallel lines so that each line is spaced evenly as it fills the entire document? In the simple script below, I used underscore to create the line. My problem seems to be that the following lines (layers) are always aligned with the first layer in the iteration. How can this be fixed? Thanks in advance.

This script creates parallel lines which can be used to design pages with lines

var defaultRulerUnits = preferences.rulerUnits;

preferences.rulerUnits = Units.PIXELS;

bgLine = new SolidColor();

bgLine.rgb.red = 255;

bgLine.rgb.green = 255;

bgLine.rgb.blue = 255;

backgroundColor = bgLine;

var newDocumentRef = documents.add (600,1000, 72.0, "generator of parallel lines");

newDocumentRef = null;

var textArray =]

"_____________________________________________________________________________________",

"_____________________________________________________________________________________",

"_____________________________________________________________________________________",

"_____________________________________________________________________________________",

"_____________________________________________________________________________________",

"_____________________________________________________________________________________",

"_____________________________________________________________________________________",

"_____________________________________________________________________________________",

"_____________________________________________________________________________________",

"_____________________________________________________________________________________",

"_____________________________________________________________________________________",

"_____________________________________________________________________________________",

"_____________________________________________________________________________________",

"_____________________________________________________________________________________",

"_____________________________________________________________________________________",

"_____________________________________________________________________________________",

"_____________________________________________________________________________________",

"_____________________________________________________________________________________",

"_____________________________________________________________________________________",

"_____________________________________________________________________________________"

] ;

If additional lines are required, it can be just added to the table

var AD = activeDocument;

for (a = 1; a < = textArray.length; a ++) {}

var TextLayer = AD.artLayers.add ();

TextLayer.kind = LayerKind.TEXT;

TextLayer.opacity = 100;

var txtRef = TextLayer.textItem;

txtRef.font = "Arial";

txtRef.contents = textArray [a-1];

txtRef.size = 12;

var textPosition = [30, 20]; the margin is 30 and 20 is the distance from the top. The following line of text should be 20 + 20 (can be any uniform increment desired)

txtRef.position = textPosition;  I can't go down the next move of the layer of a uniform increment, say 20 pixels

}

/*

Merge all the layers of text and leave the entire file not flattened

background of var = AD.layers [AD.layers.length-1];

If {(background.isBackgroundLayer)

Background.Visible = false;

AD.mergeVisibleLayers ();

Background.Visible = true;

}

At this point, I would rename the text merged with a 'Parallel Lines' layer name layer before you save it as a psd file.

*/

preferences.rulerUnits = defaultRulerUnits;

And here's another alternative...

#target Photoshop
app.bringToFront();
function main(){
if(!documents.length) return;
var win = new Window( 'dialog', 'Draw Lines' );
g = win.graphics;
var myBrush = g.newBrush(g.BrushType.SOLID_COLOR, [0.99, 0.99, 0.99, 1]);
g.backgroundColor = myBrush;
win.orientation='row';
win.p1= win.add("panel", undefined, undefined, {borderStyle:"black"});
win.g1 = win.p1.add('group');
win.g1.orientation = "row";
win.title = win.g1.add('statictext',undefined,'Draw Lines');
win.title.alignment="fill";
var g = win.title.graphics;
g.font = ScriptUI.newFont("Georgia","BOLDITALIC",22);
win.g5 =win.p1.add('group');
win.g5.orientation = "row";
win.g5.alignment='fill';
win.g5.spacing=10;
win.g5.st1 = win.g5.add('statictext',undefined,'Number of lines Vertical');
win.g5.st1.preferredSize=[150,20];
win.g5.et1 = win.g5.add('edittext',undefined,'0');
win.g5.et1.preferredSize=[50,20];
win.g5.et1.onChanging = function() {
  if (this.text.match(/[^\-\.\d]/)) {
    this.text = this.text.replace(/[^\-\.\d]/g, '');
  }
};
win.g10 =win.p1.add('group');
win.g10.orientation = "row";
win.g10.alignment='fill';
win.g10.st1 = win.g10.add('statictext',undefined,'Number of lines Horizontal');
win.g10.st1.preferredSize=[150,20];
win.g10.et1 = win.g10.add('edittext',undefined,'0');
win.g10.et1.preferredSize=[50,20];
win.g10.et1.onChanging = function() {
  if (this.text.match(/[^\-\.\d]/)) {
    this.text = this.text.replace(/[^\-\.\d]/g, '');
  }
};
win.g15 =win.p1.add('group');
win.g15.orientation = "row";
win.g15.alignment='fill';
win.g10.st1 = win.g15.add('statictext',undefined,'Line Width');
win.g10.dd1 = win.g15.add('dropdownlist');
for(var t =1;t<21;t++){
    win.g10.dd1.add('item',t);
    }
win.g10.dd1.selection=0;
win.g100 =win.p1.add('group');
win.g100.orientation = "row";
win.g100.alignment='fill';
win.g100.bu1 = win.g100.add('button',undefined,'Add Lines');
win.g100.bu1.preferredSize=[110,25];
win.g100.bu2 = win.g100.add('button',undefined,'Cancel');
win.g100.bu2.preferredSize=[110,25];
win.g100.bu1.onClick=function(){
win.close(0);
var horz = Number(win.g10.et1.text);
var vert = Number(win.g5.et1.text);
var lineWidth = win.g10.dd1.selection.index + 1;
var crossHatch = activeDocument.artLayers.add();
crossHatch.name = "Draw Lines";
var spaceH = activeDocument.height.as('px')/(horz+1);
var spaceV = activeDocument.width.as('px')/(vert+1);
var spcH = spaceH;
var spcV = spaceV;
for(var a =0;a 
         

Tags: Photoshop

Similar Questions

  • Find the nearest parallel line and ignore perpendicular line

    Hello

    We have two sets of linear facilities. We would like to find the nearest line of the other set of geometry, but preference should be given to the parallel lines as the perpendicular ones more.

    I was intending to use the suite response I see in this forum.
    extract the parallel roads

    Is another way?

    Thank you
    Frédéric

    Frederick,

    It really depends on what you're trying to determine from your data. I noticed that you included 'street' in your tags. Are you trying to link Street - axis facades, utilities or the plots?

    If you use buffering as John suggested, get an account for characteristics how target your buffer interacts with. In some cases (say the intersections of streets) where you will get multiple occurrences, you can compare the angles/slopes to identify the one who more parallel.

    Note that line buffering will produce a Cheeto (right, with well rounded rectangle). The Cheeto may interact with more than 1 target function if your buffer is too big and the characteristics of the target are tip-to-tail connected - and each of these objectives can be parallel to your line. If it's a problem, you can calculate distances to your targets and choose Next. You will probably always compare the slopes to eliminate false positives at intersections.

    In support of geocoding, I once to the streets adjacent plots and tried the above approaches and found that they do not have sufficient accuracy to dead end or corner-bulbs bulbs. Instead, I used the rotation value of the parcel labels (always placed perpendicular to the street) to generate features of research at the intersection of the adjacent streets. These search functions have variable length depending on the type of street. There were still a few false positives due to errors of data (e.g., misguidance label type, incorrect of streets, etc.), but little enough to dump a body to.

    Kind regards
    Noel

  • How can I fix, "an error has occurred in the script on this page line: 2107"?

    How can I fix "an error has occurred in the script on this page line: 2107, Char: 1? I've recently upgraded to Explorer 9

    Hello

    I'll try to uninstall IE9 as shown in the link below.

    http://www.uniquetipsonline.com/how-to-uninstall-Internet-Explorer-9-from-Windows-Vista-and-Windows-7/

    When this is complete and you have restarted the PC, see if you can now print.  If everything works well, try reinstalling IE9 with your security software temporarily disabled during installation.

    Kind regards

    DP - K

  • Assembly of parallel lines

    Hi all

    I have a series of X, Y coordinates that describe parallel lines n (3 parallel lines at the moment but can grow). Y at - it an easy way to get the best fit of these parallel lines, that is to say the slopes of the lines are the same and only the point of intersection is different. MATLAB has a routine called aoctool that can be adapted to parallel lines, is an analogue in LabVIEW? By using LabVIEW 8.2 full development version.

    Kind regards

    Leeser.

    You can use the general linear Fit.vi LS to implement this.  Take a look at the VI attached and see if it works for you.
    The first column of the matrix H is the concatenation of all the X values for all lines.  The rest of the columns are just 1 for these values of X in this line and 0 for values of X that are not part of the line.

    -Jim

  • Cannot print from Internet Explorer, I get the message ' in the script on this page' line 2107 and url://ieframe.dll/preview.js.

    Original title: cannot print in Explorer

    Hi, I have a new Packard Bell PC and everything was fine, then I ran an update and that he now refuses to print from the Internet Explore.  When I try and print it there is an error: 'in the script on this page"line 2107 and url://ieframe.dll/preview.js.  If I click Yes or no to the question application that it still does not print.  I have to lower the load and then printing that isn't always possible.

    Pins to the ie9 with 36 votes useful Forums:

    I get a script error when printing of IE9
    http://answers.Microsoft.com/en-us/IE/Forum/IE9-Windows_7/i-am-getting-a-script-error-when-printing-from-IE9/ce6e8366-8be9-4F86-92BA-cf6d172635e3

  • script for generating data

    Hello

    get DDL package, we find the script to create a table.

    Is it possible to find a script to generate the same data?

    Thank you.

    John Stegeman wrote:

    SQL Developer can create a script to "insert" with the results of a query. Just run your query, right-click in the grid of results and choose 'export' - from there you can choose the format "Insert", and you'll get a script with instructions insert containing your data.

    I just made this in SQL Developer

    Select / * Insert * / * from emp;

    or

    Select / * csv * / * from emp;

    ..

    There is much more

    And press F5. This feature is very convenient!

  • Script to generate the sys files os trail audit report

    Hello

    We have a large database, where 1000 bone trail files are generated every day.   Except sys, we get all the information lo - Gin of dba_audit_trail.

    But the listener wants the audit information sys too.

    It is very difficult to manually move all the files in the operating system. I tried to make a script to generate a report. But I do not succeed until now.

    If you have any of you have used or by using a similar script to generate a report of os audit .aud file sys. Please provide that.

    Also let me if there is another way to collect audit sys information easily.

    Thanks and greetings

    Marou

    Hi berang,.

    I wrote an article (http://www.dbarj.com.br/en/2014/10/retrieve-oracle-sysdba-audit-os-files-inside-table/) explaining exactly how to do it using the external Table with preprocessor function.

    Why don't you take a look and fit the need? I hope you enjoy.

    Kind regards

    Rodrigo

  • Why can't create the dotted lines in Photoshop as easy as you can in Illustrator?

    This has been driving me crazy for a while. Why can not create a line in dotted lines in Photoshop by simply changing the race? I know you can do all that jazz with a line dotted with a brush and the spacing settings, but it's a pretty crappy solution consider if you want to change the line width, spacing of the dowry or same length, you have to start over.

    Tell me people? He is such a feature of basic of Illustrator, why can't they just add in to Photoshop in the same feature?

    Love to you all.

    Hello

    The option is actually there.

    Simply choose the Options of race.

    Concerning

    Jitendra

  • Arrows appear when you try to draw the line in Photoshop

    Sorry for the noob question, but when I try to draw a line in Photoshop, I get only an arrow.  Can someone tell me how to solve this problem?  Thank you!

    If you use the online tool, make sure that you do not have the arrow heads selected by clicking the gear icon.

  • Need a script to a fast line to disable SIOC on all storages attached to a vCenter data

    Need a script to a fast line to disable SIOC on all storages attached to a vCenter data

    Hello, vmwaredownload-

    If you just want quick and dirty and know that all your data warehouses are able IGCS, you can use these few lines (you can join to the same line, separated by semicolons, if you really need a single line):

    $viewStorageRM = Get-View -Id "StorageResourceManager-StorageResourceManager"    ## get the Storag Resource Manager view$spec = New-Object VMware.Vim.StorageIORMConfigSpec -Property @{"Enabled" = $false}    ## create the config specGet-Datastore | %{$viewStorageRM.ConfigureDatastoreIORM_Task($_.Id, $spec)}    ## for all datastores, disable SIOC
    

    Which does not check if the data store is capable of IGCS, or if it is already off - he just goes and tries to disable SIOC on all data warehouses.

    To learn more, if you're interested, AC talked about allowing people with disabilities/IGCS in his vNugglets.com post earlier.

    How these three lines do for you?

  • I need script to remove the line with 2 points, another script to remove next lines

    I need script to remove the line with 2 points, another script to remove next lines of two scripts needed help please

    Thanks in advance

    Concerning

    Lakshmiganth

    Scroll through each pathitem and look at the length of his pathPoints group.  If the length is equal to 2 and then use the remove() method to remove it.  For example (this is rough, off the top of my head):

    var lines = new Array();

    for (i = 0;  I have< app.activedocument.pathitems.length; ="" i++)="">

    If (app.activeDocument.pathItems [i].pathPoints.length == 2) {}

    Lines.push (App.activeDocument.pathItems [i]);

    }

    }

    for (i = 0;  I have< lines.length; ="" i++)="">

    Lines [i]. Remove();

    }

  • Generate the lines duplicated when running report script

    Hello

    The following script report works very well. But it generates the double set of lines.

    * {TabDelim} {ROWREPEAT} {SUPMISSINGROWS} {SUPHEADING} *.

    * < Page (HSP_Rates, YEAR, SCRIPT, VERSION, CURRENCY) *.
    HSP_InputValue Fy11 Budget WORK Local

    * < COLUMN (PERIOD) *.
    * < DIMBOTTOM PERIOD *.

    * < ROW (ENTITY, ACCOUNT) *.
    * < DIMBOTTOM ENTITY *.
    * < DESCENDANTS "NET INCOME."
    !
    OUTPUT:
    HSP_InputValue FY11 EXERCISE WORK Local
    ENTITY1 100 GROSS INCOME
    TAX ENTITY1 10
    ENTITY1 100 GROSS INCOME
    TAX ENTITY1 10

    Help, please.

    Probably, you have several hierarchies / shared members in the dimension of your entity or account. Try to use

    Moreover, I think that you edited your post but initially mentioned trying to remove 'ROWREPEAT '. Just ROWREPEAT determines if consecutive lines with the same Member of a dimension displayed the name of the Member several times, or on the first line of the group only.

  • Do not understand why photoshop generates these lines on my files

    76-77 - 2015.jpg

    This opening with another program image is fine, but when you open in photoshop, it creates this strange lines (blue or magenta) such as the file has been corrupted, but im is not safe.
    I tried to open the document with older versions of photoshop and it's fine.
    I have a cs6 and don't understant why this is happening and how to fix...

    Please help me out... shell I have reinstall the suite together?

    Hi ritmospa,

    Open PS and in preferences - performance uncheck the option that says CPU graph use, then restart the Psalm

    Concerning

    Rohit

  • Can not find the generator of images in Photoshop CS6

    I'm working on the export of images from a model of Web site, and I found a video on Lynda.com on the use of a feature of Image Generator which is supposed to make this process easier. The video was for Photoshop CS6, which is what I have (version 13.1.2) and he said this is supposed to be under the file menu, but my version of Photoshop does not seem to have this option in the file menu, just the usual except for the Web option. There is something called Image Processor in the Scripts submenu, which is the same thing? Or am I missing something?

    Generator of na not get out until the CC.  Not sure how video is claimed to be CS6 if she understood the generator.

  • MySQL to Oracle Migration offline: scripts incorrectly generated for tables

    Hello

    I used SQL Developer 3.0.4 to migrate Mysql to Oracle databases.

    I have the following errors on the charger (oracle_ctl.sh) scripts to run:

    SQL * Loader-2026: the charge was dropped because SQL Loader cannot continue.
    SQL * Loader-500: could not open the file (data / framework_perdadepacotes_diari.txt)


    The "framework_perdadepacotes_horario.txt" dump file is generated by mysqlsdump with the original mysql table name and ".txt" sufix:
    -excerpt from unload_script.sh
    mysqldump-u $username - p $server h $ t socket=/u01/mysqlmulti/mysql2/mysqld2.sock port password data = 3312 fields terminated by = "< EOFD >" fields escaped by = ""-lines terminated by = "< EORD >" "dxdb" "framework_perdadepacotes_horario" "

    but sql loader controlfile makes reference to the file by using the new name of the oracle table (in this case, that the new name is truncated to 30 characters):
    --
    load data
    INFILE ' data / framework_perdadepacotes_diari.txt ".
    "str"< EORD >"
    in the dxdb.framework_perdadepacotes_diari table


    Another instance of the same problem, but in this case the table name starts wth "_":
    -of unload_script.sh
    mysqldump-h $server u $username - p$ password t data fields terminated by = "< EOFD >" fields escaped by = ""-lines terminated by = "< EORD >" "netdb" "_Clientes" "

    file name generated by mysqldump: "_Clientes.txt."
    CTL file:
    load data
    INFILE ' data / CLIENTES_1.txt ".
    "str"< EORD >"
    in the CLIENTES_1 table

    Is this a bug, or are we supposed to manually fix the scripts for these cases?

    Thank you

    Edited by: user12099785 11/10/2011 06:11

    Currently, you have to fix manually because there was no bug recorded for this question. I have now filed the bug and it will be if all goes well fixed in one of the next versions to come.

Maybe you are looking for

  • How can I use a Windows CD on my MacBook Air?

    Hello: I have a MacBook Air; OS X Yosemite 10.10.5 version. I don't have a reader of CD/DVD, but really need to install a special CD of library that is based on Windows. Is it possible for me to run the Windows-based CD on my Mac, if I buy an externa

  • I bought a real Apple Watch off ebay

    is it still covered by the standard 1 year warranty and if so how can I sign up for this? Thank you

  • I see a significant performance boost from a most recent iMac?

    I use Photoshop, Lightroom, Final Cut Pro X and Photo Mechanic 5 (not all at the same time), here are the specs on my current iMac, If I get the new iMac. The performance will be Ok, great, superb or OMG? Thanks for your advice, Andy

  • ink cartridges

    I HAVE a PHOTOSMART 7520 e ALL-IN-ONE SERIES. DO I HAVE TO BUY COLOR AND BLACK INK TO PRINT IN BLACK AND WHITE?

  • Error initializing HP2000

    Our old HP2000 of 8 months suddenly will not start. Drive hard test reveals short HD DST: failure ID:90DPPK - 69L6P6-MFGK1F - 60 S 803 failure I can't fix it. Any advice? Greg