Development on SharePoint on-line using JavaScript in an Script Editor

Hi,
I’m doing a SharePoint development on SharePoint on-line using JavaScript in a Script Editor. I've changed the Calendar NewForm.aspx  in SharePoint designer and I should check the Start Date and End date and I should change the procedure of Save button.
The problem is I cannot have the component ID’s. I even tried to create new components and rebuild the form but my script sometimes working and sometimes not working.
I've also tried SharePoint Apps in Visual Studio 2013 and Napa but I have problems  accessing SP lists.
Could you please advise me?

Hi Sachin,
Before I read you reply, I had a "Eureka" moment that I was about to write about.  I got my Javascipt to read my the value that was set in the Filterdropdown!  However, you somewhat burst my balloon with the revelation about how re-sizing
window changes their size (i.e., Large to Medium, etc)?  It is true, my function does not work when I click the "restore down" icon on the upper right corner of my window, then it works again when I maximize the window.  That sucks : (
     Oh, well.  Thanks just the same!
For what it is worth, here is the script I wrote:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
    <script language="javascript">
        //This function reads the digest using /contextinfo.
        function ShowAlert()
            alert(document.getElementById("Ribbon.ContextualTabs.MyWork.Home.Data-Large-2-1").textContent);
    </script>
</head>
<body>
What filter am I set to?  Click the Button snd I will tell you... <input type="button" value="Button" onclick="ShowAlert()";/>
</body>
</html>
\Spiro Theopoulos PMP, MCITP. Montreal, QC (Canada)

Similar Messages

  • Set "peoples or groups" field with current user "login name" in sharepoint list form using javascript

    hi friends
    i am trying to set peoples or groups field in sharepoint  list form with current user login name
    here my code
    <script src="http://ajax.aspnetcdn.com/ajax/jquery/jquery-1.9.0.js"></script>
    <script type="text/javascript">
    $(document).ready(function NewItemView () {
    var currentUser;
        if (SP.ClientContext != null) {
          SP.SOD.executeOrDelayUntilScriptLoaded(getCurrentUser, 'SP.js');
        else {
          SP.SOD.executeFunc('sp.js', null, getCurrentUser);
        function getCurrentUser() {
          var context = new SP.ClientContext.get_current();
          var web = context.get_web();
          currentUser = web.get_currentUser();
          context.load(currentUser);
          context.executeQueryAsync(onSuccessMethod, onRequestFail);
        function onSuccessMethod(sender, args) {
          var account = currentUser.get_loginName();
          var accountEmail = currentUser.get_email();
          var currentUserAccount = account.substring(account.indexOf("|") + 1);
        SetAndResolvePeoplePicker("requester",account);
    // This function runs if the executeQueryAsync call fails.
        function onRequestFail(sender, args) {
          alert('request failed' + args.get_message() + '\n' + args.get_stackTrace());
     function SetAndResolvePeoplePicker(fieldName, userAccountName) {
       var controlName = fieldName;
        var peoplePickerDiv = $("[id$='ClientPeoplePicker'][title='" + controlName + "']");
        var peoplePickerEditor = peoplePickerDiv.find("[title='" + controlName + "']");
        var spPeoplePicker = SPClientPeoplePicker.SPClientPeoplePickerDict[peoplePickerDiv[0].id];
        peoplePickerEditor.val(userAccountName);
        spPeoplePicker.AddUnresolvedUserFromEditor(true);
    </script>
    but it is not working
    please help me

    Hi,
    According to your post, my understanding is that you wanted to set "peoples or groups" field with current user "login name" in SharePoint list form using JavaScript.
    To set "peoples or groups" field with current user "login name”,  you can use the below code:
    <script src="http://ajax.aspnetcdn.com/ajax/jquery/jquery-1.9.0.js"></script>
    <script type="text/javascript">
    function SetPickerValue(pickerid, key, dispval) {
    var xml = '<Entities Append="False" Error="" Separator=";" MaxHeight="3">';
    xml = xml + PreparePickerEntityXml(key, dispval);
    xml = xml + '</Entities>';
    EntityEditorCallback(xml, pickerid, true);
    function PreparePickerEntityXml(key, dispval) {
    return '<Entity Key="' + key + '" DisplayText="' + dispval + '" IsResolved="True" Description="' + key + '"><MultipleMatches /></Entity>';
    function GetCurrentUserAndInsertIntoUserField() {
    var context = new SP.ClientContext.get_current();
    var web = context.get_web();
    this._currentUser = web.get_currentUser();
    context.load(this._currentUser);
    context.executeQueryAsync(Function.createDelegate(this, this.onSuccess),
    Function.createDelegate(this, this.onFailure));
    function onSuccess(sender, args) {
    SetPickerValue('ctl00_m_g_99f3303a_dffa_4436_8bfa_3511d9ffddc0_ctl00_ctl05_ctl01_ctl00_ctl00_ctl04_ctl00_ctl00_UserField', this._currentUser.get_loginName(),
    this._currentUser.get_title());
    function onFaiure(sender, args) {
    alert(args.get_message() + ' ' + args.get_stackTrace());
    ExecuteOrDelayUntilScriptLoaded(GetCurrentUserAndInsertIntoUserField, "sp.js");
    </script>
    More information:
    http://alexeybbb.blogspot.com/2012/10/sharepoint-set-peoplepicker-via-js.html
    Best Regards,
    Linda Li
    Linda Li
    TechNet Community Support

  • Validate Sharepoint site url using javascript

    Hi All,
    I have the below requirement.
    User enters sharepoint site in a textbox and clicks on button.
    On button click, we have to validate the entered sharepoint site exist or not.
    All the code should be in client side. No server side code
    This should be achieved using javascript.
    So, if anyone has a solution for this, could you please help me in sharing the code for the requirement. 
    Thanks & Regards,
    Kishore
    Kishore

    Hi Kishore
    Please go through the links and below code..
    It'll help
    Validation of the entered SharePoint Site
    1. _spUserId (Variable)
    This variable gives the ID of the logged in user. For an anonymous user, this variable will be empty.
    var uid = _spUserId;
    You can test this variable in the address bar of your browser. Try
    javascript:alert(_spUserId);
    You will see an alert message with the ID of the logged in user.
    2. JSRequest (Object)
    Using this JSRequest object, we can get the querystring, pathname and filename. Before using any of these properties, you should call JSRequest.EnsureSetup();
    Ex: page url is http://www.xyz.com?qid=15
    To get a querystring value
    JSRequest.EnsureSetup();
    var q = JSRequest.QueryString["qid"]; // q = 15
    Similarly, you can use
    JSRequest.EnsureSetup();
    var f = JSRequest.FileName; // current page name
    var p = JSRequest.PathName; // server relative url
    3. GetUrlKeyValue(parameter, noDecode, url) (Method)
    GetUrlKeyValue() is a javascript function using which we can get the Query string parameter either from url in the browser or a url that we specify.
    parameter(string): query string parameter from the url.
    noDecode(bool): specifies whether the value has to be encoded or not. If false value is decoded, else returned as it is.(Optional)
    url(string): the url from which Query string values are to be retrieved.(Optional)
    Ex:
    alert(GetUrlKeyValue('a', false, 'www.xyz.com?a=te%20st'));
    The above statement will return the value ‘te st’. Here we are specifying our own url.
    alert(GetUrlKeyValue('a', false));
    The above statement will look for a query string variable ‘a’ in the browser url, and returns the decoded value.
    alert(GetUrlKeyValue('a'));
    The above statement will look for a query string variable ‘a’ in the browser url.
    4. _spPageContextInfo (Object)
    _spPageContextInfo object has several useful properties, some are
    a. webServerRelativeUrl (for current web)
    b. siteServerRelativeUrl (current site collection url)
    c. webLanguage (for localization)
    d. currentLanguage (for localization again)
    e. webUIVersion
    f. userId (current user id just like _spUserId)
    g. alertsEnabled (more for current page if it has any alerts on it)
    h. allowSilverlightPrompt (to have that prompt or not on the page)
    i. pageItemId
    j. pageListId (Guid)
    We can get the webServerRelativeUrl simply by saying
    var url = _spPageContextInfo.webServerRelativeUrl;
    All the remaining object properties can be used in the same way.
    5. escapeProperly(str) (Method)
    This function returns the URL encoded value of a given string.
    var s = escapeProperly("hello world!!"); //s = "hello%20world%21%21"
    6. unescapeProperly(str) (Method)
    This function decodes a URL encoded string.
    var s = unescapeProperly("hello%20world%21%21"); //s = "hello world!!"
    7. STSHtmlEncode(htmlString) (Method)
    This function encodes an html string
    var s = STSHtmlEncode("<p>sample text</p>");
    //s = "&lt;p&gt;sample text&lt;/p&gt;"
    8. TrimSpaces(str) (Method)
    This method trims out the leading and trailing white spaces of a string. It doesn’t remove spaces created by special characters such as ‘\n’, \t’
    var s = TrimSpaces(" Hello World!! "); //s = "Hello World!!"
    I intentionally put more spaces between ‘Hello’ and ‘World!!’ just to show that this method doesn’t remove any spaces between words.
    9. TrimWhiteSpaces(str) (Method)
    This method trims out the leading and trailing white spaces of a string. It also removes spaces created by special characters such as ‘\n’, \t’
    var s = TrimWhiteSpaces("\n\nHello World!!\t\t"); //s = "Hello World!!"
    10. LoginAsAnother(url, bUseSource)
    This method is used to login as different user.(as the name says)
    url(string): the url of the page to which the new user has to be sent after login.
    bUseSource(boolean): A boolean that indicates that the source will be added to the url, otherwise the source will be the window.location.href. This parameter is optional, default is false.
    <a href="#" onclick="javascript:LoginAsAnother('\u002f_layouts\u002fAccessDenied.aspx?loginasanotheruser=true', 0)">Log on as a different user</a>
    11. STSPageUrlValidation(url)
    This function validates a url if it starts with “http” or “/” or “:” ONLY. It returns the url value back if it is a valid url and an empty value if it is an invalid url. If the url is not valid, an alert message is displayed that says “Invalid page URL:”.
    var s = STSPageUrlValidation("praneethmoka.wordpress.com"); //s = praneethmoka.wordpress.com
    var s = STSPageUrlValidation(":praneethmoka.wordpress.com"); //s = "";
    var s = STSPageUrlValidation("w.wordpress.com"); //s = "w.wordpress.com";
    Now please don’t ask me what kind of a validation this is.
    STSPageUrlValidation(url) in turn calls a method PageUrlValidation(url) and here’s the code for PageUrlValidation method
    function PageUrlValidation(url)
    {ULSA13:;
    if((url.substr(0, 4) == "http") || (url.substr(0, 1) == "/") || (url.indexOf(":") == -1))
    return url;
    else
    var L_InvalidPageUrl_Text="Invalid page URL: ";
    alert(L_InvalidPageUrl_Text);
    return "";
    Indul Hassan
    Microsoft Community Contributor
    http://www.indulhassan.com
    You Snooze.. You Lose !!

  • Error when using function CDbl in Script Editor

    Hello,
    While using the CDbl function in the Script Editor I am getting the following error:
    Error - 13 - Type mismatch: 'CDbl' at Line 24
    The reason I am trying to use CDbl is that I get another error while importing the data from a .CSV file
    Import Error = TC - [Amount=NN|http://forums.oracle.com/forums/] 01-000-1030,Cash in Bank - Payroll,837.83,0.00,"1,569.50",0.00
    Any suggestions would be appreciated.
    -Tony

    Tony,
    Please keep in mind that pressing 'Save' and then 'Run' without using the script in a workflow is sometimes not a valid test. As the scripting generally created inside of FDM needs to be part of a workflow and certain variables/functions are passed when that workflow is executed as a whole.
    Hopefully this helps...

  • Has anyone used the IC Interactive scripting editor for the Webclient ?

    We originally received the 'Loading %0' message when loading the editor via the IC_MANAGER business role. This was overcome by updating Java (See note 717921).
    However, the editor now seesm to working, I can see two examples as standard, but when I click on them I do not see anything.  I've ifnored this issue and have started to create my own question and answers in preparation for a script.
    However, I have hit a few quirky things while using editor. Am I alone in this, or is this just the way it is.
    I'm using the latest version of CRM 7.
    If anyone's used this script editor I would dearly like to hear from you, especially in avoiding any upcoming nasties that I may hit.
    A perfect example of this kind of problem is in how you create 'Answers'. If I highlight the answer section and click on the 'Create' button I have the options to create the following: Field, Objective script, Question, Action, Button and script, of which none of these are what I want. I can however create a question with an answer section, but of course when it comes to dragging a answer in to the answer box I can't do this as I can't create any answers. Am I missing something?.
    With regards
    Jason

    Hi,
    We are facing similar kind of problem in our scenario "Loading 0%". We have crm7.0, IE6 and JRE 1.5.0 version.
    Kindly help us, which version of JRE do we need to use?
    we reffered notes: 1105843, 717921. However this did not help us.
    Kindly help us.
    Thanks!

  • Auto update people picker value with email id when we add username in another people picker field in sharepoint 2013 list using javascript

    hi friends
    i have to people picker fields
    pp1 and pp2
    pp1 represents username
    pp2 represents email id
    here i problem is if user enters name in pp1, pp2 has to update with email id of corresponding user in pp1 dynamically.
    using java script is there any solution for this.
    please help me

    Hope below will help
    <asp:Content ID="Main" ContentPlaceHolderID="PlaceHolderMain" runat="server">
    <script type="text/ecmascript" language="ecmascript">
    var user;
    var visitorsGroup;
    function runCode() {
    var clientContext = new SP.ClientContext();
    var groupCollection = clientContext.get_web().get_siteGroups();
    // Get the visitors group, assuming its ID is 4.
    visitorsGroup = groupCollection.getById(4);
    user = clientContext.get_web().get_currentUser();
    var userCollection = visitorsGroup.get_users();
    userCollection.addUser(user);
    clientContext.load(user);
    clientContext.load(visitorsGroup);
    clientContext.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceeded), Function.createDelegate(this, this.onQueryFailed));
    function onQuerySucceeded() {
    alert(user.get_title() + " added to group " + visitorsGroup.get_title());
    function onQueryFailed(sender, args) {
    alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());
    </script>
    <input id="Button1" type="button" value="Run Code" onclick="runCode()" />
    </asp:Content>http://msdn.microsoft.com/en-us/library/office/jj246835%28v=office.15%29.aspxhttp://msdn.microsoft.com/en-us/library/office/jj920104%28v=office.15%29.aspxhttp://stackoverflow.com/questions/20981226/sharepoint-2013-get-current-user-javascripthttp://sharepoint.stackexchange.com/questions/31457/get-user-via-javascript-client-object-model

  • Add bookmarks to all pdf files at once using javascript or apple script

    Hello
    I have a folder containing pdf files of a survey.
    There is also a 'surveyname.pdf' file which consists of a number of pages.
    These pages have to be bookmarked for easy reference.There is a 'dummy.pdf' file which has all the bookmarks of the survey pages. I am using Adobe Acrobat 7.0 to open this file.
    There are also some map pdf's in the same folder.
    How can I add the bookmarks that are in the 'dummy.pdf' file to all the other pdf files in the same folder at once instead of doing one at a time which consumes a lot of time for 100-120 files?
    I use extendscript toolkit for writing the javscript or applescript code.
    I would be grateful if anyone could help me in solving this.
    Thankyou
    Krishna

    Here are some examples of doing the insert and the save in a separate operation. You can put them together on your own.
    ~T
    //From the JS Reference:
    this.insertPages ({
    nPage: -1,
    cPath: "/c/temp/myCoverPage.pdf",
    nStart: 0
    //Example of a trustedFunction SaveAs
    mySaveAs = app.trustedFunction(function (cPath)
    app.beginPriv();
    this.saveAs(cPath);
    app.endPriv();
    app.addMenuItem({ cName: "mySaveAs", cParent: "Insert Page",
    cExec: "mySaveAs('/c/myFolder/myNewPDF.pdf')",
    cEnable: "event.rc = (event.target != null);",
    nPos: 0

  • Adding new javascript in LiveCycle script editor

    The form has a Print button and already has this javascript xfa.host.print(1, "0", (xfa.host.numPages -1).toString(), 0, 1, 0, 0, 0);
    How do I add the following javascript to the same button and its click event?
    newDocName = "";
    f1 = this.getField("topmostSubform[0].Page1[0].Last_Name[0]").valueAsString;
    if (f1!="") newDocName += f1 + " ";
    f2 = this.getField("topmostSubform[0].Page1[0].First_Name[0]").valueAsString;
    if (f2!="") newDocName += f2 + " ";
    f3 = this.getField("topmostSubform[0].Page1[0].Date[0]").valueAsString;
    if (f3!="") newDocName += f3 + " ";
    f4 = this.getField("topmostSubform[0].Page1[0].Email[0]").valueAsString;
    if (f4!="") newDocName += f4;
    newDocName = newDocName.replace(/[\\,\/,\:,\*,\?,\",\<,\>,\|,\,,\n,\r]/g,"");
    docPath = this.path+"";
    docPath = docPath.substring(0, docPath.lastIndexOf("/")+1);
    mySaveAs(this,docPath+newDocName+".pdf");
    I had this working in Acrobat on an earlier version of the same form (with an external script also in the Acrobat directory -- so it all worked perfectly), but on this form, I don't have full access. My only option is to try to add this javascript to save the file with a new filename by using LiveCycle.

    Post your question in the forum for LiveCycle Designer.

  • Connect to Home Computer using Mail / iChat / Automator / Script Editor

    http://screenerschoice.com/video_tutorials/ScreenSharing/ScreenSharing.html
    1. Start with Automator > Choose Custom Workflow
    2. Drag Launch Application into the window and choose iChat
    3. With whatever account you have signed at home (you need 2 accounts), make sure it is logged on. On automator, hit the Record button and Watch Me Do will start recording. (You have to do it in this sequence and no shortcuts or it can get hung up and not continue with the script.)
    4. Choose the Finder > Applications > Type iChat > Hit Apple O (for open)
    5. In the iChat window for your buddy list click once on the name you want to share with
    6. Then on the top menu, go to Buddies > Share my screen with ....
    http://screenerschoice.com/video_tutorials/ScreenSharing/Automator.png
    7. Save this workflow as an application
    8. Open Applications > Applescript > Script Editor
    9. Hit Record
    10. Go to Finder > Then keep going through until you find the application you just created and double click on it. Then hit stop on Script Editor.
    11. Save this as an application as well. Mail will run these apps, but not the Automator apps.
    12. Go to mail and go to rules
    13. Create a rule with a few stipulations that will trigger the script. This way, not just anyone can send a script to your computer to control it. It would have to meet all the criteria you set it. Then in the action list in the rule, go to run applescript and choose the file you created with Script Editor.
    14. In mail at the other computer, it needs to be set to check mail every so often. I do mine every minute.
    15. Also on that computer, the finder window needs to be open. If it is not, the script will not run properly. I don't have time to figure out a workaround for that, so in the meantime, I just open the finder window and minimize it to my dock.

    Haven't tired it yet, but a thought would be to create an alias of iChat and place it on the desktop. Then save your scripts on the desktop as well. When you run everything from the desktop, you shouldn't have to have a Finder window open.

  • Unable to update rating (rating column) on host document using JavaScript Object Model API inside sharepoint hosted apps

    Hi Everyone,
    We are developing SharePoint hosted apps for Office 365, for that we are going
    to implement document rating functionality inside Sharepoint app. The host web contain document library (“Documents”) and from apps we need to rate each document. The rating functionality working fine with CQWP in team site  using
    JavaScript Object Model API.
    But the same code is not working inside apps and giving error:-
    If we are using app context than error will be:-
    "List does not exist.
    The page you selected contains a list that does not exist.  It may have been deleted by another user."
    And for Host context than error will be:-
    "Unexpected response data from server."
    Please help on this
    Please see below code..
    'use strict';
    var web, list, listItems, hostUrl, videoId, output = "";
    var videoLibrary = "Documents";
    var context, currentContext;
    var lists, listID;
    var list, parentContext;
    var scriptbase;
    (function () {
        // This code runs when the DOM is ready and creates a context object which is 
        // needed to use the SharePoint object model
        $(document).ready(function () {
            hostUrl = decodeURIComponent(getQueryStringParameter("SPHostUrl"));
            context = SP.ClientContext.get_current();      
            SP.SOD.executeFunc('sp.js', 'SP.ClientContext', sharePointReady);
        function sharePointReady() {
            scriptbase = hostUrl + "/_layouts/15/";
            // Load the js files and continue to the successHandler
            $.getScript(scriptbase + "SP.Runtime.js", function () {
                $.getScript(scriptbase + "SP.js", function () {
                    $.getScript(scriptbase + "SP.Core.js", function () {
                        $.getScript(scriptbase + "reputation.js", function () {
                            $.getScript(scriptbase + "sp.requestexecutor.js", execCrossDomainRequest);
        //Query list from hostweb
        function execCrossDomainRequest() {       
            //Load the list from hostweb
            parentContext = new SP.AppContextSite(context, hostUrl);
            web = parentContext.get_web();
            list = web.get_lists().getByTitle(videoLibrary);
            context.load(list, 'Title', 'Id');
            var camlQuery = new SP.CamlQuery();
            camlQuery.set_viewXml('<View><Query><OrderBy><FieldRef Name="Modified" Ascending="FALSE"/></OrderBy></Query><RowLimit>1</RowLimit></View>');
            listItems = list.getItems(camlQuery);        
            context.load(listItems);
            context.executeQueryAsync(onQuerySucceeded, onQueryFailed);
        //Process the image library
        function onQuerySucceeded() {       
            var lstID = list.get_id();
            var ctx = new SP.ClientContext(hostUrl);       
            var ratingValue = 4;
            EnsureScriptFunc('reputation.js', 'Microsoft.Office.Server.ReputationModel.Reputation', function() {      
            Microsoft.Office.Server.ReputationModel.Reputation.setRating(ctx, lstID, 1, ratingValue);       
            ctx.executeQueryAsync(RatingSuccess, RatingFailure);
        function onQueryFailed(sender, args) {
            alert('Failed' + args.get_message());
        function failed(sender, args) {
            alert("failed because:" + args.get_message());
        function RatingSuccess() {
            alert('rating set');
            //displaystar();
        function RatingFailure(sender, args) {
            alert('Rating failed : : ' + args.get_message());
        //Gets the query string paramter
        function getQueryStringParameter(paramToRetrieve) {
            var params;
            params = document.URL.split("?")[1].split("&");
            for (var i = 0; i < params.length; i = i + 1) {
                var singleParam = params[i].split("=");
                if (singleParam[0] == paramToRetrieve) return singleParam[1];
    Thanks & Regards
    Sanjay 
    Thank you in advance! :-)
          

    Hi,
    According to your post, my understanding is that you want to update list column in SharePoint hosted apps using JavaScript Client Object Model.
    Based on the error message, it seems not retrieve the list object in context. I suggest you debug the code step by step using Internet Explorer Developer Tools to
    find the problem.
    Here are some demos about using JavaScript Client Object Model in SharePoint hosted app:
    http://blogs.msdn.com/b/officeapps/archive/2012/09/04/using-the-javascript-object-model-jsom-in-apps-for-sharepoint.aspx
    http://sharepoint.stackexchange.com/questions/55334/how-to-access-list-in-sharepoint-hosted-app
    http://www.dotnetcurry.com/showarticle.aspx?ID=1028
    Best regards
    Zhengyu Guo
    TechNet Community Support

  • Drawing Lines Photoshop CS4 using JavaScript

    I am new to javascript and have read a manuel on the basics of javascript in regards to photoshop. I was just wondering how to draw a straight line using javascript. Thanks.

    You could start by looking at the sample scripts that ship with photoshop to see a coding sample of stroking a selection. Then look at the doc on making selection and paths etc.
    // Copyright 2002-2007.  Adobe Systems, Incorporated.  All rights reserved.
    // Create a stroke around the current selection.
    // Set the stroke color and width of the new stroke.
    // enable double clicking from the Macintosh Finder or the Windows Explorer
    #target photoshop
    // in case we double clicked the file
    app.bringToFront();
    // debug level: 0-2 (0:disable, 1:break on error, 2:break at beginning)
    // $.level = 0;
    // debugger; // launch debugger on next line
    if (app.documents.length > 0)
        if (app.activeDocument.activeLayer.isBackgroundLayer == false)
            var strtRulerUnits = app.preferences.rulerUnits;
            app.preferences.rulerUnits = Units.PIXELS;
            var selRef = app.activeDocument.selection;
            var offset = 10;
            var selBounds = Array(Array(offset, offset), Array(app.activeDocument.width - offset, offset), Array(app.activeDocument.width - offset, app.activeDocument.height - offset), Array(offset, app.activeDocument.height - 10));
            selRef.select(selBounds);
            selRef.selectBorder(5);
            var strokeColor = new SolidColor();
            strokeColor.cmyk.cyan = 20;
            strokeColor.cmyk.magenta = 90;
            strokeColor.cmyk.yellow = 50;
            strokeColor.cmyk.black = 50;
            app.displayDialogs = DialogModes.NO;
            selRef.stroke(strokeColor, 2, StrokeLocation.OUTSIDE, ColorBlendMode.VIVIDLIGHT, 75, true);
            app.preferences.rulerUnits = strtRulerUnits;
            selRef = null;
            strokeColor = null;
            selBounds = null;
        else
            alert("Operation cannot be performed on background layer");
    else
        alert("Create a document with an active selection before running this script!");

  • Animation using JavaScript

    Hi,
    I have created an animation exercise for an eLearning lesson in a program that uses JavaScript as the scripting for a Windows executable. A retired social worker who creates these eLearning materials as give-away's to help people in the community improve health, it would be a big help to reaching more people if instead of a Windows executable version, the animation could be developed in a web page. A lot more people could view the eLearning and try this exercise which trains people in pacing their breathing.
    The animation has a 300X300 circle on the canvas with a couple of text input boxes and a start button. The JS < 50 lines of script, but since it was not developed for a web page, it has no tags and it depends on objects like the circle or button (or 2 audio files to craete the inhale/exhale sounds) that were already placed on the canvas in the Windows executable program.
    I'm not very skilled using Dreamweaver CS5, but with help, reading, references can try to convert this JS into a web version, if it's possible. Not sure how to do this and would appreciate any help.
    I am adding a screenshot of the interface and the JS functions that are called by the start button.
    //JS: ( bar1 is the variable entered by the use as breaths per minute-BPM; time1 is the exercise length; the variables initially are set as follows: time1=15, //volume=100)
    var time1
    function minuteTimer()
    breakLoop = false
    stopLoop = false
    fork (calcBreathing)
    for (var i=0;i<time1;i++)
        wait(60)
        breakLoop = true
        Submit.Show()
        Text122.Show()
        Text12.Show()
        TextInput22.Show()
        TextInput2.Show()
        Submit2.Hide()
        TextInput2.SetTransparency(0,false)
        TextInput22.SetTransparency(0,false)
        Text12.SetTransparency(0,false)
        Text122.SetTransparency(0,false)
        Text5.SetTransparency(0,false)
        Frame12.SetTransparency(0,false)
        Submit.SetTransparency(0,false)
        TextInput2.Enable(true)
        TextInput22.Enable(true)
        Debug.trace("\n minutes elapsed "+(i+1)+"\n")
    stopLoop = true   
    function calcBreathing()
        var bar2 = 60/bar1
        for (loop = 0;loop<bar1;loop++)
            mySound.Play(1,volume)
            Vector8.Scale(.5,.5, bar2*.3)
            mySound.Stop()
            wait (bar2*.05)
            mySound2.Play(1,volume)
            Vector8.Scale(-.5,-.5,bar2*.6)
            mySound2.Stop()
            wait (bar2*.05)
            if (breakLoop) break
        breakLoop = false
        if (bar1 > 6) bar1--
        if (!stopLoop) calcBreathing()
    Any help appreciated. Thanks very much.
    Kind Regards,
    saratogacoach

    joel pau thank you for all the support.
    now i will explain the anwer if anyone else will be stuck with the same problem.
    first of all in edge animate need to mark all the things that created and "convert to symbol"(mark all and right click).
    second:
    in the top of your html file you got the script to the edge_preLoad.js .....
    so now in your js code:
    lets say we use append to add new div to our code and now we got <div id="new"</div>.
    $.Edge.getComposition("yourCompositionID").createSymbolChild("yourSymbolThatCreatedInStepO ne","#new");
    like this you can get new animation of the same composition.
    if you want to conroll the animation you just need to take the id of the new symbol your created using jquery or any way you like.
    and example of control it:
    $.Edge.symbol.get("#theNewID").play();

  • How to validate People Picket control at client side using javascript/Designer in New form.aspx

    Hi Folks,
    I have list library with 2 columns. where as 1 column is people picker control and it is not mandatory filed .
    When the user open newform.aspx and fill all the column values and submit it should show error message if user not enter any data in people picker control column though it is not a mandatory column.
    How to achieve this by using javascript or sharpoint designer.

    Hello,
    Here is script for that:
    http://social.msdn.microsoft.com/Forums/en-US/f1c2a651-a0fb-484d-af33-e7084439b6c8/validate-sharepoint-people-picker-using-javascript?forum=sharepointgeneralprevious
    http://ankursharepoint.blogspot.in/2012/10/javascript-validation-of-people-picker.html
    Edit your newform.aspx page and add content editor webpart on that page. Then add script on HTML source section.
    Hope it could help
    Hemendra:Yesterday is just a memory,Tomorrow we may never see
    Please remember to mark the replies as answers if they help and unmark them if they provide no help

  • Trying to open a page in IE-tab using javascript, script type="text/javascript" window.location.href="chrome://coralietab/content/container.html?url=0,myurl" /script Error:Component returned failure code:0x80004005 (NS_ERROR_FAILURE) [nsIDOMLocation.href]

    I am trying to open a page in IE-tab using javascript like this, <script type="text/javascript"> window.location.href = "chrome://coralietab/content/container.html?url=0,myurl" ;</script>.Error occured : [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIDOMLocation.href]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame ::myurl :: load :: line 234" data: no] I have IE-Tab plug-in installed..when I open the same link manually in mozilla,it works fine and page gets opened in Ie-tab.

    The only way this might be possible is by using the HostContainer object
    to access the HTML page and do it from there.

  • Start workflow using javascript

    function AfterSave() {
    alert("in");
    var scriptbase = _spPageContextInfo.webAbsoluteUrl + "/_layouts/15/";
    $.getScript(scriptbase + "SP.js", function () {
    $.getScript(scriptbase + "SP.Runtime.js", function () {
    $.getScript(scriptbase + "SP.WorkflowServices.js", function () {
    var itemId=5;
    var subscriptionId = '{8891EB88-D7F6-495B-A420-877E74754522}';
    var clientContext = SP.ClientContext.get_current();
    var web = clientContext.get_web();
    clientContext.load(web);
    var wfManager = SP.WorkflowServices.WorkflowServicesManager.newObject(clientContext, clientContext.get_web());
    clientContext.load(wfManager);
    alert("in2");
    var subscription = wfManager.getWorkflowSubscriptionService().getSubscription(subscriptionId);
    clientContext.load(subscription);
    alert("in3");
    clientContext.executeQueryAsync(
    function(sender, args){
    alert("Subscription load success. Attempting to start workflow.");
    var inputParameters;
    wfManager.getWorkflowInstanceService().startWorkflowOnListItem(subscription, itemId, inputParameters);
    clientContext.executeQueryAsync(
    function(sender, args){ alert("Successfully starting workflow."); },
    function(sender, args){
    alert("Failed to start workflow.");
    alert("Error: " + args.get_message() + "\n" + args.get_stackTrace());
    function(sender,args){
    alert("Failed to load subscription.");
    alert("Error: " + args.get_message() + "\n" + args.get_stackTrace());
    function closeInProgressDialog() {
    if (dlg != null) {
    dlg.close();
    function showInProgressDialog() {
    if (dlg == null) {
    dlg = SP.UI.ModalDialog.showWaitScreenWithNoClose("Please wait...", "Waiting for workflow...", null, null);
    hi friends
    i am using above code to start workflow
    there is no error in code but it is not starting.
    please help me to figure out my problem

    Hi,
    You can't start workflow in Javascript object model in SP 2010
    http://social.technet.microsoft.com/Forums/sharepoint/en-US/84659489-eba7-4a41-a137-820b01d4bc69/start-a-sharepoint-2010-workflow-using-javascript?forum=sharepointgeneralprevious
    Please remember to click 'Mark as Answer' on the answer if it helps you

Maybe you are looking for