Possible to script palette menus Save and Load Curves?

Is it possible to script CS4 Photoshop's palette menus? Specifically, the "Save Curves Preset ..." and "Load Curves Preset" ... of the Adjustments Palette.
I have 600 images, some of which have layer>new adjustment layer>curves applied.
I want to save the curves using the image name. Later, I want to be able to load the appropriate curve.
E.g., for image001.tif, the curve would be image001.acv
(I already have a loop set up to iterate through the files and get the file names.)

Thank you.
I got both scripts working without JS or AS errors, but, when trying to load .acv files generated by the second script, CS4 Photoshop gave an error:
"Could not load the curves because the file is not compatible with this version of Photoshop"
(The loading script works fine when loading .acv files created directly from Photoshop.)
The only change I made to your Save Curves code was:
FROM: var myACV = new File('~/desktop/myCurve.acv')
TO: var myACV = new File(file);
and made the code a function:
saveCurves(file)
YOUR CODE HERE
so that I could incorporate it into the Applescript.
Maybe that was naive (I'm not very knowledgeable about JS).
Here are the scripts I'm using:
SAVE CURVES:
set gammaFolder to "/Users/me/Desktop/myproject/gamma/"
tell application "Finder"
          set TheFolder to choose folder
          set FileList to every file of entire contents of TheFolder as alias list
end tell
repeat with theFile in FileList
          set thefilename to theFile as string
          set text item delimiters to ":"
          set thefilename to last text item of thefilename --remove path
          set text item delimiters to "."
          set thefilename to first text item of thefilename --remove extension
          tell application "Adobe Photoshop CS4"
  activate
  open theFile
                    tell current document
                              if exists layer "Curves 1" then
                                        set current layer to layer "Curves 1"
                                        do javascript "saveCurves('" & gammaFolder & thefilename & ".acv');
function saveCurves(file) {
-- SAVE CURVES JAVASCRIPT HERE
};" --show debugger on runtime error
                              end if
                    end tell
          end tell
end repeat
LOAD CURVES:
set gammaFolder to "/Users/me/Desktop/myproject/gamma/"
tell application "Finder"
          set TheFolder to choose folder
          set FileList to every file of entire contents of TheFolder as alias list
end tell
repeat with theFile in FileList
          set thefilename to theFile as string
          set text item delimiters to ":"
          set thefilename to last text item of thefilename --remove path
          set text item delimiters to "."
          set thefilename to first text item of thefilename --remove extension
          set acvFile to gammaFolder & thefilename & ".acv"
          tell application "Finder" to set acvExists to exists my POSIX file acvFile
          if acvExists then
                    tell application "Adobe Photoshop CS4"
  activate
  open theFile
                              tell current document
                                        if not (exists layer "Curves 1") then
                                                  do action "Create Curve Layer" from "MyActions"
                                        end if
                                        set current layer to layer "Curves 1"
                                        do javascript "loadCurves('" & gammaFolder & thefilename & ".acv');
function loadCurves(file) {
-- LOAD CURVES JAVASCRIPT HERE
};" --show debugger on runtime error
                              end tell
                    end tell
          end if
end repeat

Similar Messages

  • I want to save and load the swf-file to a local disk of any user. Possible?

    Hi, It's good to see you.
    I am a developer in Web Flash Game.( I use AS3.0 )
    I want to save and load the swf-file to a local disk of any user,
    Because I want to decrease the time for loading a flash movie from site.
    Is it possible?
    If it is possible, I hope the swf-file has only one loading from site and
    it will be loaded from a local disk of any user after that.
    (I know a concept of Internet temporary file.
    I want to know the other techniques of only using AS3.0.)

    Hi,
    I have similar problem. We are producing a 70 meg browser based game and would like the user to be able to cache the game to avoid reloading the game the next time. Can this be done if the user authorise the save? If, so how? We don't care where the game is cached .
    Can we prompt the user to download the file by providing a link from within the SWF application?

  • SQL Dev 2.1:Ability to save and load visual query models?

    At SQL Dev 2.1, do we now have the ability to save and load visual query models as with TOAD? Or has that functionality been rolled into the for-pay Data Modeler extension? Seemed strange to hide the functionality deep within SQL Worksheet, then not allow query models to be saved or loaded. From what I recall, load/save was scheduled to be in 2.0.
    I've not yet downloaded and installed 2.1, but also as I recall, it was promised to be a significant (e.g. new-feature rich) release. Has it lived up to that promise? Hoping also that it's not so buggy as to not merit an upgrade. At my workplace, folks have different versions of SQL Dev 1.X installed, each for the purpose of retaining functionality that got broken in future releases, etc. Would love to be able to advise them to retire their 1.X installs in favor of 2.1.
    Edited by: Dana N on Jan 21, 2010 6:45 AM

    Dana, We are working on the query builder. We have not done anything with it in recent releases as we knew that it needed completely overhauled and a
    couple of bug fixes were not going to give us the query builder we needed. Sue will be able to tell you more as the we get closer to releasing it as a feature.Thanks Barry. I know it's probably impossible to give firm dates, but my colleagues would love to know, ballpark, when query builder might be ready. Any particular year/quarter that's targeted for?
    A lot of the bugs in the 2.1 are probably my fault as we decided to build a framework which allowed tasks to be scheduled like eclipse and push them to the
    background. Coupled with this, we tore apart the worksheet to allow us to fit tasks in, but to also give us the ability to do some of the enhancement requests
    that you guys, our users, have been asking for. While its not perfect, I believe its getting much better from both a functionality and performance standpoint. The
    worksheet will not change again and there are no enhancements logged or scheduled which will do that. The issues that have come as part of 2.1 are being
    addressed and we are fixing the highest priority ones as we speak. One of my priorities is to make these components as rock solid as possible.Thanks again. It really is a nice tool to work with, and I'm grateful to have it. I would choose stability for existing features over new ones, but I suppose there always has to be a balance in development. What was really scary in the past was getting bizarre / wrong answers in query results--that's a complete show stopper; e.g. clicking on a row/col intersection in a result set row would show strange and false values. New features can wait, but core functionality must be solid. If one can't presume integrity of query results, it's game over--using a version of SQL Developer that returns inconsistent result sets between runs could be Considered Harmful, or so it is to me.
    Anyway, thanks for responding and I hope Oracle Corp gets you whatever assistance you need to improve the quality of existing functionality while adding new features; with one not being at the expense of the other. :-) Glad also to see Sue has authored a book on the tool. Hopefully that will drive customer demand and force increased allocation of development resources toward the product. I'd like to think having out-of-the-box tools that are a joy to use might even increase market share.
    Data Modeler I would love to use, but am completely priced out of it. Enterprise Architect from Sparx Systems is the best value there so far as I can tell.
    Dana

  • Save and load jtree

    Hi,
    I have a jtree which I would like to save and then load and display in a JPanel. Just for info, the nodes of the tree are instances of a user object i have created. Now I have looked into two ways of doing this:
    1) Serialize the actual JTree object; write it to a file using objectoutputstream and then read it in using objectinputstream, OR
    2) Serialize the tree model again using objectoutputstream then read the model back and create a new JTree initialising with the model i read in.
    I made some progress using the second approach, but when I load the tree model back and create a new tree with that model it just displays as a blank root with blank children. (Although the tree structure is the same).
    What am i doing wrong?
    The code is:
    public void saveTheTree() {
            TreeModel tm = tree1.getModel();
            try {
                 ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream("treeModel"));
                 out.writeObject(tm);//the actual tree object
                 out.flush();
                 out.close();
            catch(IOException e){}
      public void openTheTree() {
           ObjectInputStream in = null;
             try {
                 in = new ObjectInputStream(new FileInputStream("treeModel"));
                 TreeModel atm = (TreeModel) in.readObject();
                 JTree loaded = new JTree(atm);
                 abPanel3.removeAll();
                 abPanel3.revalidate();
                 abPanel3.add(loaded, BorderLayout.CENTER);
                 abPanel3.revalidate();
             catch(Exception e) {
                  e.printStackTrace();
      }abPanel3 is where the tree is displayed and tree1 is my tree.
    Any help would be much appreciated!

    well the leaves are defaultmutabletreenodes instantiated with a user object which attaches a link and level to each one. According to the java documentation, defaultmutabletreenode is serializable, but do i need to serialize each node of the tree as well?
    Has anyone managed to save and load a jtree before?
    Thanks.

  • Save and load game into and from binary file

    hello!
    I'm new to java and i'm doing a game at school.
    i�m doing the same game and i�m doing a "save" and "Load" game. i'm doing this to save the game:
    public void jMenuJogoSalvar_actionPerformed(ActionEvent e) {
    System.out.println("SAlvar o Jogo actual");
    FileOutputStream out = null;
    ObjectOutputStream s = null;
    int valorRet = jFileChooserSalvar.showSaveDialog(this);
    if (valorRet == jFileChooserSalvar.APPROVE_OPTION) {
    try {
    out = new FileOutputStream(jFileChooserSalvar.getSelectedFile().getAbsoluteFile());
    s = new ObjectOutputStream(out);
    s.writeObject(mesa);
    s.flush();
    catch (FileNotFoundException fNFExc) {
    System.out.println("FileNotFound");
    catch (IOException ioExc) {
    ioExc.printStackTrace();
    finally {
    try {
    if (s != null) {
    s.close();
    if (out != null) {
    out.close();
    catch (IOException ex) {
    and i'm getting this error:
    java.io.NotSerializableException: com.sun.java.swing.plaf.windows.WindowsFileChooserUI
    i have already implemented the method Serializable into the classes that i'm trying to write and the classes they use but i still have this.
    Tell me what to do .
    thanks for the time.

    Does the Object mesa have a com.sun.java.swing.plaf.windows.WindowsFileChooserUI
    object in side it? or does any of the object that are in side it have a com.sun.java.swing.plaf.windows.WindowsFileChooserUI
    object?
    If you post code please use the code button

  • Save and load public/private RSA key on file

    hi
    i'm triyng to save and load an RSA key to a file
    i generate the keys:
            KeyPairGenerator generator=null;
            KeyPair coppia=null;
            PrivateKey c_privata=null;
            PublicKey c_pubblica=null;
                generator=KeyPairGenerator.getInstance("RSA");
                //imposto la dimensione
                generator.initialize(1024);
                //genero le 2 chiavi
                coppia=generator.genKeyPair();
                //imposto la privata
                c_privata=coppia.getPrivate();
                //imposo la pubblica
                c_pubblica=coppia.getPublic();
    //i save the key
            FileOutputStream file = new FileOutputStream("key");
            file.write(c_pubblica.getEncoded());
            file.close();and then i use another program that imports the key:
       Key chiave=null;
       FileInputStream file=new FileInputStream("key");
       byte[]byte_chiave=new byte[162];
                 X509EncodedKeySpec chiave_spec = new X509EncodedKeySpec(byte_chiave);
                KeyFactory keyFactory = KeyFactory.getInstance("RSA");
                chiave = keyFactory.generatePublic(chiave_spec);but when i try to reload he key i get:
    java.security.InvalidKeyException: IOException : DER input, Integer tag error
    where am i wrong?
    thanks

    sorry...
    this is the correct code:
            Key chiave=null;
            FileInputStream file=new FileInputStream(path);
            byte[]byte_chiave=new byte[file.available()];
            System.out.println("leggo: "+file.read(byte_chiave));
            X509EncodedKeySpec chiave_spec = new X509EncodedKeySpec(byte_chiave);
            KeyFactory keyFactory = KeyFactory.getInstance("RSA");
            chiave = keyFactory.generatePublic(chiave_spec);

  • 1.is it possible to read a .xls file and load it into an oracle table

    1.is it possible to read a .xls file and load it into an oracle table, using oracle database or oracle forms i.e. either utl_file, or text_io, or any other oracle tool.
    As far as I know we need a csv file or a txt ( tab delimited) file ?
    2.Are there any windows tools for the same

    Hi,
    If you want to use the DDE package to read the XLS file then yes, you will neeed to know the number of rows and columns in the input file.
    i.e. How will you know :
    1) How many columns are there in the input file.
    If I have a XLS file with the following data :
    R1C1 R1C2 R1C3 R1C4 R1C5 R1C6 R1C7
    xxx xx x
    Where R represents row and C represents column, then how will you know the each row has 7 columns. If you know the answer upfront, then it's not a issue.
    Using the DDE apprach, you will have to specify the RowNum and the ColumnNo of each idividual cells to read/write data from xls sheet.
    Look at the syntax in my ealier post.
    using the other approch (i.e. comma delimited text file - CSV file) , you need not know the number of columns as you can loop thru the input record till the last column is read.
    All you have to do is to look for the 'n' occurances of the field delimiter say ',', do a substr from the current position to the point where the ',' was found.
    This process is to be repeated in a loop till all columns are read.
    The TEXT_IO package can trap for EOF (End Of File).
    Hope I made myself clear.
    -- Shailender Mehta --

  • Save and load variables in java

    Hi ,
    I need a help about Save and load .
    I have a project(tool) which have JText, JRadioButton and other things also.
    I want to save all the changes for the next execution ( fresh startup or fresh bring up of the tool).
    Please let me know what will be the better way to save and load.
    can i get below use of C# in Java similar way ( below one is the C# code)
    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "9.0.0.0")]
        internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
            private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
            public static Settings Default {
                get {
                    return defaultInstance;
            [global::System.Configuration.UserScopedSettingAttribute()]
            [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
            [global::System.Configuration.DefaultSettingValueAttribute("PATH")]
            public string SourceDirectory {
                get {
                    return ((string)(this["SourceDirectory"]));
                set {
                    this["SourceDirectory"] = value;
    }Can i do Strore and load without any File storage?
    Thanks in advance

    Assuming you are deploying applet or webstart than perhaps you can use PersistenceService?
    http://download-llnw.oracle.com/javase/1.5.0/docs/guide/javaws/developersguide/examples.html#PersistenceService

  • Cannot Read From Registry - Need to save and load config

    I have code the I have tested in other programs. I cannot read or write to the registry from a plugin. Any ideas?
    Any suggestions for the best way to save and load config information?
    Thanks!!!

    Hi Srikanth,
    Thank you for responding.
    I had a problem on one material. So deleted the request and Reload it from PSA. That issue got solved.
    And Now the problem is , Now my senior is saying Delete the data from April-09 till date and Reload it. The issue is My CUBE ( ZSD_C03 ) is updated with 4 data sources. 2LIS_11_V_ITM   ,  2LIS_13_VDITM   ,  2LIS_12_VCHDR  , 2LIS_11_VAITM .
    And I need to delete data from 2LIS_13_VDITM  data source . How Can I proceed for the current issue   ?
    Please suggest   ...
    Thank you ,
    Utpal

  • Core Data - Save and Load

    Hi
    I need to add functionality to my iPad app so that I can save and load notes from a UITextView then load them when the user selects the date in the UIDatePicker that it was originally saved on, much like a calendar, notes for different dates.
    I have asked around on StackOverFlow and people have been spoon feeding me code samples but I am not quite latching on. Complain all you like, but I really want to learn how to do this, however currently its fairly important that I get the functionality added in.
    Here is where I asked:
    http://stackoverflow.com/questions/4133405/core-data-iphone-save-load-depending- on-date
    http://stackoverflow.com/questions/4177398/save-and-load-data-coredata
    I have unsuccessful so far and if anyone can help me here I would be ever so grateful and even more so if you would take a short time to take a peek at my project. You can email me at [email protected], its a fairly simple project and Im sure especially for you guys you could see what I am doing.
    Hope you can help me out.

    Core Data pretty much does away with the concepts of saving and loading. The data is just there. If you want a particular view of data, on a specific date, for examples, you create a predicate to pull only the matching data into a particular controller/UI control.

  • How can I Save and Load the Configurat​ion File of a VNA HP8510C with LabView

    Hello, I'm working with a HP8510C. In order to simplfy the use, I try to save and to load the configuration file. Actually, such files are saved in the HP8510C, but there is only 4 places to save. It will be more interresting when I can storage this file in the computer with Labview. I don't have found anything about in the Documentation.
    Has someone already deal with such a question?
    Géraud DEVOS
    IWE Karlsruhe

    geraudIWE a écrit:
    Hello, I'm working with a HP8510C. In order to simplfy the use, I try to save and to load the configuration file. Actually, such files are saved in the HP8510C, but there is only 4 places to save. It will be more interresting when I can storage this file in the computer with Labview. I don't have found anything about in the Documentation.
    Has someone already deal with such a question?
    Géraud DEVOS
    IWE Karlsruhe
    Hello GerauIWE,
    Have you try to use the Hewlett-Packard 8510C Instrument Driver?
    You can download it on :
    http://sine.ni.com/apps/we/niid_web_display.drv_re​sults?p_app_area=&p_man=hewlettPackard&p_keywords=​8510c&p_inst_type=&p_env=845&p_drv_type=&p_int=
    Best Regards,
    Sanaa T
    National Instruments France
    Sanaa T.
    National Instruments France
    #adMrkt{text-align: center;font-size:11px; font-weight: bold;} #adMrkt a {text-decoration: none;} #adMrkt a:hover{font-size: 9px;} #adMrkt a span{display: none;} #adMrkt a:hover span{display: block;}
    >> http://www.nidays.fr/images/081110_ban_nidays09_468X60.gif

  • Parent  changes between save and load of a PDF file

    I am using LiveCycle 8.2 and Acrobat 9.2 - and Reader 9.2
    I have an automated process that uses a plug-in to fill out and save a PDF form using XML data.
    This works well - saves time , etc.
    I have a problem where a certain data element seems to have a different heirarchical relationship in the Reader  than in Acrobat..
    I have added some xfa.host.MessageBox() statements to print out data as the form is being saved  and then when it is loaded into the Reader - these  values are not the same -
    but i have checked and when I laod it using Acroabt everyhting is the same as when the data was saved - but there a different relationship apparently exists when I load the form using the reader.
    Has anyone seen this before ?
    Is there anything that I can do about it ?
    Any help is appreciated - thanks

    a snippet of the code involved is listed here :
    Provider.page2.Practice.Associatec.AssociateType.AssociateTypeDescription::initialize - (JavaScript, client)
     var CovgYN;
    var msg; var lineofdata; 
    var assttype = this.rawValue;msg
    = "Check1 : " + assttype + " = " + this.parent.parent.AssociateLastName.rawValue;xfa.host.messageBox(msg);
    lineofdata= this.parent.parent.AssociateFirstName.rawValue + " " + this.parent.parent.AssociateLastName.rawValue + " " + assttype + " -" + CovgYN; 
    The data contained in the msg and lineofdata variables - is different in Acrobat 9.2 and The Reader ... It is correct in Acrobat when I load the form and Import the XML data file.
    When the correct data Form is saved and loaded using the reader the values "parent" is different so - the values are not the same -=
    This is a serious problem !.
    Is this a known bug or issue  ?
     

  • How do you create a Browser cookie in Captivate to save and load a set of variables?

    Using the below tutorial I am trying to set a cookie that remembers the menu of sections that have been viewed when the browser reopens. Basically sets and loads 6 variables with a cookie. But it's not working and I can't find the JavaScript to debug in Chrome. Alternately does anyone know of a better tutorial for setting cookies in Captivate then this post?
    Eating JavaScript Cookies with Adobe Captivate - CaptivateDev.com

    Thanks for replying. The variables define a number of states within the training. Mostly a main menu showing modules completed or not and also defining areas as locked or unlocked. So it's more then a text caption. I'd like a button on the intro/splash screen that when clicked loads about 6 variable as 0 or 1 from the cookie. Then the user would continue to the training with all the variables loaded.

  • WPF Save and Load - Load Error

    Hi everyone, I'm having a weird error on with this small basic app I made. I can insert the Name and Price of the Listbox fine, it does Save. However, when I load it the problem occurs. Example : Name = 50cent, Price = 10. The listbox will display "Name
    of album is 50cent, Price is 10". Then I can Save it as that is correct. However when I start the app again and press load it will display "Name of album is Name of album is 50cent, price is 10,price is 0" I believe it is somewhere in my class
    but I don't know exactly. I'm pretty sure it is a simple error, but I just can't see it. Any help with this would be appreciated. Thanks in Advance
    This is the class.cs where I believe the problem occurs.
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    namespace musiccdapp
    public class Music
    public string CDName { get; set; }
    public int CDPrice { get; set; }
    public Music()
    public Music(string cdname, int cdprice)
    CDName = cdname;
    CDPrice = cdprice;
    public string LoadFile()
    //return CDName + CDPrice;
    // return "Name is " + CDName + " , price is " + CDPrice + " . ";
    return ToString();
    public override string ToString()
    return "Name of album is " + CDName + " , price is " + CDPrice + " . ";
    Here is the xaml.cs
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Windows;
    using System.Windows.Controls;
    using System.Windows.Data;
    using System.Windows.Documents;
    using System.Windows.Input;
    using System.Windows.Media;
    using System.Windows.Media.Imaging;
    using System.Windows.Navigation;
    using System.Windows.Shapes;
    using System.Collections.ObjectModel;
    using System.IO;
    namespace musiccdapp
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    public ObservableCollection<Music> album = new ObservableCollection<Music>();
    public MainWindow()
    InitializeComponent();
    album = new ObservableCollection<Music>();
    lbxalbum.ItemsSource = album;
    private void Button_Click_1(object sender, RoutedEventArgs e)
    string name = txtname.Text;
    int count = Convert.ToInt32(txtprice.Text);
    album.Add(new Music(name,count));
    private void Button_Click_2(object sender, RoutedEventArgs e)
    string[] allalbums = new string[album.Count];
    for (int i = 0; i < album.Count; i++ )
    allalbums[i] = album[i].LoadFile();
    File.WriteAllLines(Directory.GetCurrentDirectory() + "\\Albums.txt",allalbums);
    private void Button_Click_3(object sender, RoutedEventArgs e)
    album = new ObservableCollection<Music>();
    string[] listofalbums = File.ReadAllLines("Albums.txt");
    string[] details = new string[2];
    //int[] detilsp = new int[1];
    for (int i = 0; i < listofalbums.Length; i++ )
    Music albums = new Music();
    int total;
    string totals;
    total = albums.CDPrice;
    total.ToString();
    totals = Convert.ToString(total);
    details = listofalbums[i].Split('.');
    // detilsp = listofalbums[i].Split('.')
    albums.CDName = details[0];
    // albums.CDPrice = Convert.ToInt32(details[1]);
    totals = details[1];
    // albums.CDPrice = detilsp[0];
    album.Add(albums);
    lbxalbum.ItemsSource = album;
    This is the xaml code
    <Window x:Class="musiccdapp.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="MainWindow" Height="350" Width="525">
    <Grid>
    <Grid.ColumnDefinitions>
    <ColumnDefinition Width="150"></ColumnDefinition>
    <ColumnDefinition Width="200"></ColumnDefinition>
    <ColumnDefinition Width="150"></ColumnDefinition>
    </Grid.ColumnDefinitions>
    <ListBox Grid.Column="1" Name="lbxalbum" VerticalAlignment="Bottom" Height="200"></ListBox>
    <TextBox Name="txtname" Width="100" Height="25" VerticalAlignment="Top" Margin="10">CD Name</TextBox>
    <TextBox Name="txtprice" Width="100" Height="25" VerticalAlignment="Top" Grid.Column="1" Margin="10">CD Price</TextBox>
    <Button Width="100" Height="25" VerticalAlignment="Top" Margin="10" Grid.Column="2" Click="Button_Click_1">Add</Button>
    <Button Width="100" Height="25" Margin="10" Click="Button_Click_2">Save</Button>
    <Button Width="100" Height="25" Margin="10" VerticalAlignment="Bottom" Click="Button_Click_3">Load</Button>
    </Grid>
    </Window>

    public class HomeController : Controller
    private MovieDb db = new MovieDb();
    public ActionResult Index(string sort, string Search_Data)
    { //Variable sort for sorting
    IQueryable<Movie> movie = db.Movies;
    ViewBag.SortingName = String.IsNullOrEmpty(sort) ? "Name_Description" : "";
    //Search bar
    if (!String.IsNullOrEmpty(Search_Data))
    movie = movie.Where(s => s.MoviesName.Contains(Search_Data));
    //Search bar
    var albu = from alb in db.Movies select alb;
    albu = albu.Where(alb => alb.MoviesName.ToUpper().Contains(Search_Data.ToUpper()));
    //Sorting in switch
    switch (sort)
    case "Name_Description":
    movie = movie.OrderBy(alb => alb.MoviesName);
    break;
    default:
    movie = movie.OrderBy(alb => alb.MovieID);
    break;
    return View(movie.ToList());
    public ActionResult Details(int id = 0)
    Movie m = db.Movies.Find(id);
    if (m == null)
    return HttpNotFound();
    else
    //HEY SHOW ME ACTORS
    m.Actors = (from e in db.Actors
    where e.MovieID.Equals(id)
    select e).ToList();
    //m.Actors.Count();
    return View(m);
    #region Create Movie
    public ActionResult Create()
    return View();
    [HttpPost]
    [ValidateAntiForgeryToken]
    public ActionResult Create(Movie movie)
    if (ModelState.IsValid)
    db.Movies.Add(movie);
    db.SaveChanges();
    return RedirectToAction("Index");
    return View(movie);
    #endregion
    #region Edit Movie
    public ActionResult Edit(int id)
    Movie movie = db.Movies.Find(id);
    if (movie == null)
    return HttpNotFound();
    return View(movie);
    [HttpPost]
    [ValidateAntiForgeryToken]
    public ActionResult Edit(Movie movie)
    if (ModelState.IsValid)
    db.Entry(movie).State = EntityState.Modified;
    db.SaveChanges();
    return RedirectToAction("Index");
    return View(movie);
    #endregion
    #region Delete Movie
    public ActionResult Delete(int id)
    Movie movie = db.Movies.Find(id);
    return View(movie);
    [HttpPost, ActionName("Delete")]
    [ValidateAntiForgeryToken]
    public ActionResult DeleteConfirmed(int id)
    Movie movie = db.Movies.Find(id);
    db.Movies.Remove(movie);
    db.SaveChanges();
    return RedirectToAction("Index");
    #endregion
    Here is the Home Page
    <h2>Movies</h2>
    <p>
    @Html.ActionLink("All Actors", "Index", "Actor", null, new { @class = "btn btn-success" })
    </p>
    <p>
    @Html.ActionLink("Create New", "Create", null, new { @class = "btn btn-primary" })
    </p>
    @using (Html.BeginForm("Index", "Home", FormMethod.Get))
    <p>
    Search Name: @Html.TextBox("Search_Data")
    <input type="submit" value="Filter" />
    </p>
    @Html.ActionLink("Rearrange Alphabetically", "Index", new { sort = ViewBag.SortingName})
    <div class="table-responsive" >
    <table class="table table-striped">
    <tr class="info">
    <th>
    @Html.DisplayNameFor(model => model.MoviesName)
    </th>
    <th>
    @Html.DisplayNameFor(model => model.Description)
    </th>
    <th></th>
    </tr>
    @foreach (var item in Model)
    <tr>
    <td>
    <a href="@Url.Action("Details", null, new{id = item.MovieID})">@Html.DisplayFor(modelItem => item.MoviesName)</a>
    </td>
    <td>
    @Html.DisplayFor(modelItem => item.Description)
    </td>
    <td>
    <div class="form-group">
    <div class="btn-group" data-toggle="buttons">
    <label class="pdsa-radiobutton btn btn-warning active">
    <span class="glyphicon glyphicon-pencil"></span>
    @Html.ActionLink("Edit", "Edit", new { id = item.MovieID })
    </label>
    </div>
    </div>
    </td>
    <td>
    <div class="form-group">
    <div class="btn-group" data-toggle="buttons">
    <label class="pdsa-radiobutton btn btn-danger active">
    <span class="glyphicon glyphicon-minus"></span>
    @Html.ActionLink("Delete", "Delete", new { id = item.MovieID })
    </label>
    </div>
    </div>
    </td>
    </tr>
    </table>
    </div>
    @section scripts
    <script>
    $(function () {toastr.info("Click Movie for details") })
    </script>
    public static void RegisterBundles(BundleCollection bundles)
    bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
    "~/Scripts/jquery-{version}.js",
    "~/Scripts/toastr.js",
    "~/Scripts/bootstrap.js"));
    bundles.Add(new ScriptBundle("~/bundles/jqueryui").Include(
    "~/Scripts/jquery-ui-{version}.js"));
    bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
    "~/Scripts/jquery.unobtrusive*",
    "~/Scripts/jquery.validate*"));
    // Use the development version of Modernizr to develop with and learn from. Then, when you're
    // ready for production, use the build tool at http://modernizr.com to pick only the tests you need.
    bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
    "~/Scripts/modernizr-*"));
    bundles.Add(new StyleBundle("~/Content/css").Include("~/Content/bootstrap.css", "~/Content/toastr.css"));

  • How to save and load control's values

    Hello,
    Thank you john and evan,
    I use, as you've understand, the invoke node "get all control value variant", and i want to change the format of the output array in order to save it an load it later to get back the configuration of my VI. For the moment i've try as john tell me with the data manipulation's functions and it's not runing. I send you an example of the code that i read in the array it's a string for controls name and a variant for the values.
    I don't really now in what format i must change them to load it later with the invoke node "set control value".
    Regards
    alexis (sorry for my awfull english)
    Attachments:
    Sans titre.vi ‏56 KB

    Hmm, the attachements didn't attach so here's another try:
    Attachments:
    Restore example.jpg ‏40 KB

Maybe you are looking for

  • Trying to play diablo 3, graphics card incompaitble

    Hey guys,      I just bought Diablo 3 yesterday and it says my graphics card isnt able to run the game. I have a HP pavillion DV6-1230us, im running windows 7 64-bit with the first service pack. All my drivers and software are up to date it still won

  • Synching BB Contacts to folder other than outlooks default "contacts" folder

    Hi I used to be able to select (within the blackberry desktop software) a folder I created within outlook called blackberry, to synchronize my 8130 to Outlook without getting a thousand contacts from my default outlook contact list mixed into my Blac

  • BAPI to create customer master record

    Hi , I was looking for the BAPI to create the customer master record in R/3. we are using the ERP 2005 system . I did find the BAPI but it will only creat the personal information of the customer . I was looking for a BAPI that will create the whole

  • Error in my SQL Query

    HI Following is my query SELECT * FROM xxrb_requisitions_in_stage where message_type = decode(:message_type,'NEWBUY','NEWBUY', 'REPAIR','REPAIR', 'NEWBUY,REPAIR','(SELECT MESSAGE_TYPE FROM xxrb_requisitions_in_stage WHERE MESSAGE_TYPE IN (NEWBUY,REPA

  • Nested table too wide in IE7, fine everywhere else

    I have a table nested into a table cell in a pretty much straight HTML page. It renders fine in Safari and Firefox Mac, and in Firefox Win. The nested table renders about 25 pixels too wide in IE7. Can't check IE6 because my install overwrote v.6 whe