How to make a script to stop his execution?

I am brand new to scripting in Photoshop and coding in Java, and I need help. I want to ask the user and if they say 'yes' I want the script to stop completely. If 'no', I want to keep it.

Is there a way to do this? I've seen examples that look like the one below using 'return', and they all say that it will work. But what is the function, not the whole script stop.

=============

function EndScript() {}

return;

Alert ("this line will never run '");

}

var PromptUser = confirm ("do you want to stop?");

If (PromptUser) {}

EndScript();

}

Alert ("If the user clicks Yes, I don't want this line to be executed.");

=============

Is there a kind of statement that stops just everything?

Thanks for your help.

By definition, return leaves only the function you are currently, so you cannot leave a part of the script that is not inside a function. What you want to do is put the script inside a function and then just call back in the case. Such as:

function Script() { 

    var PromptUser = confirm("Do you want to stop?");

    if(PromptUser ){
        return;
        alert('this line will never execute');
     }
    alert("If the user clicks yes, I don't want this line to execute.");
}

Script();

Tags: Photoshop

Similar Questions

  • How to make a script to expand the column width

    Hi experts,

    Is it possible to make a script to expand the purpose of column width to let the poster any overset text columns?

    Respect of

    John

    Hi John,.

    Sorry about that, try this, it will count through all tables in your document.

    myTables = app.documents[0].stories.everyItem().tables.everyItem().getElements();
    
    for (var t = 0; t < myTables.length; t++) {
        BE_resizeColumnsToFitContents(myTables[t]);
        }
    
    function BE_resizeColumnsToFitContents(tableToEdit) {
        for (var i = 0; i < tableToEdit.columns.length; i++) {
            while (tableToEdit.columns[i].overflows === true) {
                tableToEdit.columns[i].width += 1;
                tableToEdit.columns[i].recompose();
                }
            }
        }
    

    Brett

  • How to make a script to resize the image to fit the exact framework?

    Good afternoon

    My friend works on a task to do several images to adapt to the size of the image 500 x 700 px.

    We are working on this script, if she sometimes makes the height above 700 px.

    Can anyone help to change?

    ___

    doc = app.activeDocument;

    doc.changeMode (ChangeMode.RGB);

    var fWidth = 500;

    var fHeight = 700;

    If (doc.width > fWidth, 'px') {}

    doc.resizeImage (UnitValue(fWidth,"px"), null, null, null, ResampleMethod.BICUBIC);

    }

    else {}

    doc.resizeImage (null, UnitValue(fHeight,"px"), null, null, ResampleMethod.BICUBIC);

    }

    ___

    The thing is the need of the image to have a ratio of 5:7 to fit 500px 700px area.  An image can have a width and height of any number of pixels. All a camera will have a width and a height greater than the 700px. If your script above would create a very distorted portraits bouquet close

    Download the package of my action craft he has a script that I wrote for use in actions that make it very easy to do what you want.

    Scripts can be used in actions and actions can be used in scripts.  Photoshop scripts can also be programmed as a Photoshop plug-in.  When a plug-in is saved in action the plug-in saves the setting you used in its dialog box in the action stage. When the Action is played.  The plug-in does not display the dialog instead, it will use the setting saved in step of the action.  No user interaction is required action may be batched.

    Most Photoshop users cannot write scripts, but it have no problem using scripts to write than others.  As Adobe Photomerge, Image Processor, image Fit etc...

    I wrote a plugin script using Adobe adapt design Image that will make the selection of image format while maintaining the orientation of the document.  So if you have a 4:3 camera and a collection of pictures of her you landscape of 4:3 and 3:4 Portraits.  If you use my plugin aspectratioselection script in action and a followed centered 3:2 aspect ration of a culture of image and batch as the action on your images you would be left with landscapes of 3:2 and 2:3 Portraits.  The three step action, that's all you need registration.

    menu stage 1 file > automation > AspectRatioSelection...  In his dialogue game 5 7 central rectangle replace feather selection 0

    menu step 2 Image > Crop

    menu step 3 file > Automate > Fit Image in its width and height 700 px value dialog box

    You wind upward with 700x500px landscapes and portraits of 500x700px.

    I have created at least six of the lately. I use to do slideshows for my various devices.   I put the images I want to use in a folder of image source on my desk and play action creates six slide shows is a slide in a slide show on my desktop folder. In six of the subfolders. The Action is all two steps. The first step is running a script that deletes the folder slide shows.  The second step is a step in Image Processor Pro plugin.  This process, the image source in the slide shows folder file, save six series of jpeg images, it's six subfolders. Galaxy tab display 16:10 sideshow 2560 x 1600 and also as a 3:2 slideshow 2400 x 1600.  Surface Pro 3 sideshow 3.2 2160 x 1440, iPo4 4: slide show of 3:2 960 x 640, HDTV 1920 x 1080 and 4kTV 3840 x 2160. I take a coffee break... While the action runs.

    Package of shares of crafts UPDATE August 10, 2014 added conditional measures Action Palette tips.
    Contains

    Example of
    Download

  • How to make Intellipoint 8.2 stop intercepting my natural laser 7000 mouse4

    I'm on Win7 64-bit.

    I don't see no choice among all the choices to map the buttons of my mouse, which goes around and does nothing.

    Games and other applications that themselves have developed key and mapping mouse built into them, don't need or want this interception. In this case, it is World of Warcraft and I want to just get through normal mouse4 and mouse5 keycodes (or anything that normally is sent to the app when no interception takes place).

    I can hardly believe that there is no other choice "circumvent interception" on each mapable button assignments. Also, I can't believe no one else is asked about this, but I couldn't find any information on how after searching everywhere where I could think.

    So, short stop Intellipoint to run, how can I work around these interceptions button when it runs?

    I think that defining the buttons on the default settings would not interfere with the game. I did not WoW, but I never met a problem with all the other games I play using mouse control (Natural Wireless Laser Mouse 6000 with Intellipoint v8.2). As long as the mappings are defined in the settings of the game, it shouldn't be a problem.

    SC Tom

  • How to make a script that runs only if another field's value

    I have a field in the sales tax in my form

    I do not charge the sales tax in TX, so when they choose the TX State on this field. I want to implement the sales tax.


    I am looking for how exactly that and am not having any luck.

    If it's for a calculated field, you can use a JavaScript custom script to do this, something along the lines of:

    // Calculate script for text field
    (function () {
    
        // Get the value of the State field
        var state = getField("State").value;
    
        // Get the subtotal
        vat total = getField("SubTotal").value;
    
        // Set the tax rate
        var taxRateTX = 0.0825  // 8.25%
    
        // Calculate the tax if Texas
        if (state === "TX") {
            event.value = util.printf("%.2f", total * taxRateTX);
        } else {
            event.value = "";
        }
    
    })();
    

    Change the field names in the code to match your form. I'm assuming that the State is selected in a combo box (dropdown) and it gives a value of "TX" when Texas is selected. Copy the following code rounds up to the nearest cent (assuming that subtotal is in dollars) which maybe aren't correct.

  • How to make the script a buttons previous and next to navigate between fields using the navigation sequence?

    I want to put in "next" as well as "Previous section" buttons on the top of my page, aside from the arrows in the table of contents. I put a browse sequence. But I am unalbe to describe the buttons. Can anyone help please.

    Thank you.

    Hello

    You're definitely on the right track. The problem is that you cannot use a path "hard" for images. It may work for the subjects to the root, the directory images can exist. It may not work for the subjects, because the correct path would be something like '... /... / Images /'.

    In addition, you must add the images as baggage files to your project. If you only use the images in a script, RoboHelp does not recognize them as resources.

    I've updated you above the article. He now understands how to use images like browse buttons in the sequence.

    Take a bow

    Willam

  • How to make a website to stop coming!

    http://clothogancho.canalblog.com/archives/2009/07/26/14518174.html

    It won't go away! He keeps coming back when I close the x on my other sites. I deleted cookies and history, but he comes back!

    So far, it is only on Firefox. Don't use IE much more, but I've not yet seen here.

    Thank you very much! Your question has helped me find the answer!

    He was pinned! He had a small icon in the left corner of the tabs. I think I've hovered over him and he's come up with without waiting. I clicked to do this, and it seems to have disappeared!

    Don't know how he pinned, but if all goes well he ain't!

    Thank you once again!

    Sandi

  • How to make a routine traffic stop and start again without restarting labview?

    I am under Labview 6i and kinda a noob.  I have a Subvi designed to take information and write it to a file, but whenever I stop this Subvi it will not start again until I restart the entire VI.  I wish I could start it and stop it, and take multiple readings, because I have to leave the main VI running.  The Subvi is attached.

    The while loop is not passing information because it's still a loop (you wired the ongoing Terminal to a True constant).  No loops on all data transmit until they have finished.

    If you attach your main VI as well so we can help you fix all of them so that they work together.

    Jeremy

  • How to make a script VBS of CMD?

    Original title: execute Vbs script with Cmd?

    I have a VBS script job to remove profiles but I want to auto run from a cd, but the syntax of script needs to run as starting from a command line prompt.  This is my example of the batch file that I want to run with the file vbs from a cd.

    C:\Users\f05>cscript.exe C:\Users\f0. CEG\Desktop\DeleteProfiles.vbs /.
    F05, c09 E * _admin, f0 *.

    The example you cite will run without any problem from the command prompt:

    cscript.exe //NoLogo NameOfScript.vbs param1 param2 param3
  • How to make a game to replenish his life over time?

    I tried to write codes in my game it reconstructs the life of the player over time.  But I had no success. For example, in Candy Crush, it's called 'life '. You have 5 lives to the fullest. And once you start a level, he removes 1 5 life point. And then the timer next to the label of life begins to count down from 20 minutes to 0. Once it reaches 0, it gives you 1 point of life back so that you can restart a level. I tried to do it like this: stop Frame EventListener countdown from 20 minutes to 0 whenever the number of life is less than 5 years, and once it reaches 5, numbers count. It sounds simple, and it's simple. But what happens if the player leaves the game so that the countdown timer? Let's say the player to the left of the game at 15:10 with 3 lives and reconstruct the 10 min for a life left. And the player starts the game again at 15:30. The player would then 4 lives and rebuild 10 min for a life left. I tried to do by using the date class. But the remaining time is wasted when I left the game and restart the game.

    Instead of an absolute time countdown, count until you reach a maximum and dispatches an event when the maximum is reached. Have a separate object that stores the number and can be initialized at any point. When the user leaves the program, store the former total. When they start again, initialize a new instance of the object of the County with the old County. Display the countdown, if necessary, by subtracting the present value of the maximum value.

    If your object might look like this:

    Counter/public class extends EventDispatcher {}

    protected var _count:int;

    protected var _max:int;

    protected var timer: Timer = new Timer (1000);

    public void Counter(count:int=0,_max:int=20):void {}

    _Count = count;

    _max = max;

    }

    public void start (): void {}

    timer.addEventListener (TimerEvent.TIMER, incrementTime);

    Timer.Start ();

    }

    public function stop() {}

    timer.removeEventListener (TimerEvent.TIMER, incrementTime);

    Timer.Stop ();

    }

    public void incrementTime(e:Event=Null):void {}

    _Count ++;

    dispatchEvent (new Event ('countChanged'));

    If (_count == _max) {}

    dispatchEvent (new Event ('countIsMax'));

    possibly could reset _count here

    }

    }

    public function get count (): int {}

    return _count;

    }

    public function get max (): int {}

    return _max;

    }

    public function get count (): int {}

    return _max - _count;

    }

    }

    Its use might look like:

    SerializableAttribute public class votrejeu extends Sprite {}

    protected var counter: counter;

    protected var life: int;

    public var countText:TextField;

    public var livesText:TextField;

    public void YourGame() {}

    Super();
    logic to retrieve stored here number

    counter = new Counter (storedCountThatYouRetrieved);

    counter.addEventListener ('countChanged', updateCountText);

    counter.addEventListener ('countIsMax', updateLives);

    }

    protected function updateCountText(e:Event):void {}

    countText.text = String (counter.countDown);

    }

    protected function updateLives(e:Event):void {}

    life ++;

    livesText.text = String (lives);

    }

    }

  • How to make a script for a table

    Hai
    I need sql query to create the script table for already existing table.

    any body can help me.

    Published by: 800324 on February 24, 2011 12:07 AM

    SELECT dbms_metadata.get_ddl ('TABLE', 'TABLE_NAME')
    DOUBLE;

  • I have "upgraded" to FF5 and now have no refresh or stop icons in the menu bar, are not available in the menu "personalize." How to make a comeback?

    Question
    I have "upgraded" to FF5 and now have no refresh or stop icons in the menu bar, are not available in the menu "personalize." How to make a comeback?

    I'm happy to have helped.

    It was something that many users asked when he changed first, and I initially did not know myself that the order of the buttons would make a difference as to if a button or a pair of buttons would be displayed.

    If you mark the post as solved while he is recorded in the answer will appear in the results of research and may help others.

  • whenever I click on something on that I get pop up as I'm right click how to make this stop?

    whenever I click on something on that I get pop up as I'm right click how to make this stop?

    Cindy,

    What should I have selected in system preferences... > mouse > Point & Click > secondary click?

  • "$US" automatically... How to make this stop?

    Hello

    I have "joint currency" spreasheet

    But the numbers seem to AUTOMATICALLY add a 'US' before ' $'.

    How to make this STOP?

    Thank you very much

    Troy

    Hi Troy,

    This is probably connected with the region setting in system preferences > language and text. Several countries use the sign $ as their monetary symbol.

    Browse from the context menu in the preferences to see which is the "naked" in your area and who to choose as your marker for amounts in US dollars.

    The symbol has no effect on the number of underlyings.

    Kind regards

    Barry

  • I signed up for Apple music and since then I can't synchronize playlists from my computer to my phone because it says I have iTunes game turned on, but I do not subscribe to iTunes recently Match (ish). How to make this stop?

    I signed up for Apple music and since then I can't synchronize playlists from my computer to my phone because it says I have iTunes game turned on, but I do not subscribe to iTunes recently Match (ish). How to make this stop?

    Hello

    You cannot synchronize in usb or wifi if you subscribe to the Apple's music. The basic principle of the AM is that your iTunes library is scanned to determine what can be matched or must be downloaded. Once completed, all the music you will be available to listen to or download on your iOS device.

    Jim

Maybe you are looking for

  • Satellite A300 - SPDIF disabled after installing XP

    Hello again. After I downgrade my A300 from Vista to XP everythings works fine.Just one problem. My SPDIF no longer works. No red lights, no possibility of he chose in the acoustic Panel...I have installed the Toshiba page sounddrivers. Someone couns

  • Why is the movie 13 hours: soldiers Secret The of Benghazi available only in French to order in advance at the Canada?

    Hello Does anyone know the secrets of this mystery?  I can't find answers on google.  U.S.. iTunes, you can find the English version on order in advance but not to the Canada.  Why is this?  iTunes Canada, can you please enlighten us?  YOU know why t

  • Slow to update contacts

    It was slower and slower, train whenever I try to update or Add Contacts. Did anyone alse notice this? Come on Apple, we can afford to wait a month for the iCloud update my contacts.

  • Why canon 100-400mm fucos not good lens

    Why objective canon 100-400 f/4.5-5.6l usm fucos not well when I take wild birds, the lens just in and out when I fucos with the subject and take a picture, I try a lot of adjustment, but the problem still not solved, the lens is used from adorama tv

  • Google advertising on the main screen playstore

    When I want to open my phone by entering a code, and I get the main screen, I often get some advertising on the screen. Several times he said: "We recomment the clash of the Titans" and this with a button that links to the playstore. How can I disabl