Script for setting Imported Excel Table Cell Inset

InDesign CS3 Windows XP
I've checked the FAQ and ran all the searches, but I can't find this. My old computer crashed and took with it a script that I had that would set all the cell insets for the cells of the imported Excel tables in one swelled foop. Can someone point me to the source again? My price sheets are nothing but imported Excel tables and it takes forever to set all the insets for each block separately.
Thanks,
JAG

Phah.
app.documents.everyItem().stories.everyItem().tables.everyItem().cells.everyItem().propert ies = [topInset:"1cm"]; //??
This one-liner may need some additional work, but when I am done with it, it'll set the insets for all tables in every open document.
Perhaps 'everyItem' also works on disk files ...
[Edit] Just pulling your leg. I'll take a look on the one-liner when I'm back at work.
I've got a class in a couple of weeks on Javascripting ...
I'm jealous. They give classes about this? BTW, JavaScript is not that hard (e.g., not harder than any other reasonably popular programming language), but its interface to InDesign is something else. In this case, the magic word is 'everyItem'. (You'll learn.)

Similar Messages

  • Problem import excel table with photos

    When I import excel table with photos, the photos don't appear

    Welcome to Project Siena!
    If you're seeing an 'x' instead of your photo in the data source it's possible that Project Siena can't access the directory.  Try saving your images in another folder such as C:\Users\Public\Pictures.
    Others have also reported that if the Library isn't set up correctly in Windows 8 that they've had issues.
    Here are some posts to look at while we wait for additional information from you:
    Importing local images via an Excel file
    Siena Gallery unable to load image
    Images in Public Pictures directories showing
    up as X in Img from URL
    (fyi - this last post's screenshot will look different than yours as it was from Beta 1.)
    Thor

  • Set text in table cell to bold

    I am trying to get the text in a table cell to alternate between plain and bold on a ctrl-click.
    The setFont() statements seeming have no effect.
    Can anyone help?
    Self Contained thing here:
    package boldTableCell;
    import java.awt.BorderLayout;
    import java.awt.Component;
    import java.awt.Dimension;
    import java.awt.Font;
    import java.awt.Point;
    import java.awt.event.ActionEvent;
    import java.awt.event.MouseEvent;
    import java.awt.event.MouseListener;
    import java.awt.event.WindowAdapter;
    import java.awt.event.WindowEvent;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    import javax.swing.JTable;
    import javax.swing.UIManager;
    import javax.swing.table.DefaultTableModel;
    public class MyTable extends JTable implements MouseListener {
         private boolean isBold = false;
         private String[] columnNames = {"First Name", "Last Name", "Sport", "# of Years", "Vegetarian"};
         private Object[][] data = {
                   {"Mary", "Campione", "Snowboarding", new Integer(5), new Boolean(false)},
                   {"Alison", "Huml", "Rowing", new Integer(3), new Boolean(true)},
                   {"Kathy", "Walrath", "Knitting", new Integer(2), new Boolean(false)},
                   {"Sharon", "Zakhour", "Speed reading", new Integer(20), new Boolean(true)},
                   {"Philip", "Milne", "Pool", new Integer(10), new Boolean(false)},
          * constructor
         public MyTable() {
              super();
              DefaultTableModel defaultTableModel = new DefaultTableModel(data, columnNames);
              this.setModel(defaultTableModel);
              this.setName("My Table");
              setListeners();
          * set listeners
         private void setListeners() {
              addMouseListener(this);
         // on ctrl-click in variable column, flip bold/not bold
         @Override
         public void mouseClicked(MouseEvent event) {
              System.out.println ("mouseClicked(): # of clicks: " + event.getClickCount());
              // ctrl -click
              if ((event.getModifiers() & ActionEvent.CTRL_MASK) > 0) {
                   System.out.println("ctrl-click");
                   Point point = event.getPoint();
                   int row = rowAtPoint(point);
                   int column = columnAtPoint(point);
                   // if not valid then return
                   if ( row < 0 || column < 0) {
                        return;
                   // if this click was on the variable column
                   if (column == 0) {
                        System.out.println("ctrl-click on column 0 ");
                        Component component = super.prepareRenderer(this.getCellRenderer(row, column), row, column);
                        // now get the current font used for this cell
                        Font font = component.getFont();
                        isBold = ! isBold; // flip boolean
                        if (isBold) {
                             System.out.println ("ctrl-click: bold: " + isBold);
                             component.setFont(font.deriveFont(Font.BOLD));
                             component.setForeground(getForeground()); // otherwise text disappears
                             //     (JLabel)t.getHeaderRenderer()).setFont(new Font(("Courier", Font.BOLD, 12));
                        else { // not bold
                             System.out.println ("ctrl-click: not bold: " + isBold);
                             component.setFont(font.deriveFont(Font.PLAIN));
                             component.setForeground(getForeground()); // otherwise text disappears
                        component.invalidate();
                        component.repaint();
                        this.invalidate();
                        this.repaint();
                   } // end if click on definition column
         } // end mouseClicked
         @Override
         public void mouseEntered(MouseEvent arg0) {
         @Override
         public void mouseExited(MouseEvent arg0) {
         @Override
         public void mousePressed(MouseEvent arg0) {
         @Override
         public void mouseReleased(MouseEvent arg0) {
          * @param args
         public static void main(String[] args) {
              try {
                   UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
              catch (Exception e){
                   e.printStackTrace();
              final JPanel jPanel = new JPanel();
              final MyTable myTable = new MyTable();
              jPanel.add(myTable);
              final JFrame frame = new JFrame();
              frame.add(jPanel, BorderLayout.CENTER);
              frame.setTitle("My Panel");
              frame.setPreferredSize(new Dimension(400, 150));
              frame.addWindowListener(new WindowAdapter(){
                   @Override
                   public void windowClosing(WindowEvent e) {
              frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
              frame.setLocation(300, 200);
              frame.pack();
              frame.setVisible(true);
    }Edited by: allelopath on Jul 8, 2010 11:06 AM
    Edited by: allelopath on Jul 8, 2010 11:07 AM

    got it
    package boldTableCell;
    import java.awt.BorderLayout;
    import java.awt.Component;
    import java.awt.Dimension;
    import java.awt.Font;
    import java.awt.Point;
    import java.awt.event.ActionEvent;
    import java.awt.event.MouseEvent;
    import java.awt.event.MouseListener;
    import java.awt.event.WindowAdapter;
    import java.awt.event.WindowEvent;
    import java.util.ArrayList;
    import java.util.List;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    import javax.swing.JTable;
    import javax.swing.UIManager;
    import javax.swing.table.DefaultTableModel;
    import javax.swing.table.TableCellRenderer;
    public class MyTableWithCustomRenderer extends JTable implements MouseListener {
         private boolean isBold = false;
        private List<Boolean> isBoldList;
         private String[] columnNames = {"First Name", "Last Name", "Sport", "# of Years", "Vegetarian"};
         private Object[][] data = {
                   {"Mary", "Campione", "Snowboarding", new Integer(5), new Boolean(false)},
                   {"Alison", "Huml", "Rowing", new Integer(3), new Boolean(true)},
                   {"Kathy", "Walrath", "Knitting", new Integer(2), new Boolean(false)},
                   {"Sharon", "Zakhour", "Speed reading", new Integer(20), new Boolean(true)},
                   {"Philip", "Milne", "Pool", new Integer(10), new Boolean(false)},
          * constructor
         public MyTableWithCustomRenderer() {
              super();
              // initialize bold for each row to false
              isBoldList = new ArrayList<Boolean>(5);
              for (int row = 0; row < 5; row++) {
                   isBoldList.add(row, false);     
              DefaultTableModel defaultTableModel = new DefaultTableModel(data, columnNames);
              this.setModel(defaultTableModel);
              this.setName("My Table");
              setListeners();
          * set listeners
         private void setListeners() {
              addMouseListener(this);
         // on ctrl-click in column 0 , flip bold/not bold
         @Override
         public void mouseClicked(MouseEvent event) {
              // ctrl -click
              if ((event.getModifiers() & ActionEvent.CTRL_MASK) > 0) {
                   System.out.println("mouseClicked(): ctrl-click");
                   Point point = event.getPoint();
                   int row = rowAtPoint(point);
                   int column = columnAtPoint(point);
                   // if not valid then return
                   if ( row < 0 || column < 0) {
                        return;
                   // if this click was on column 0
                   if (column == 0) {
                        isBoldList.set(row, ! isBoldList.get(row)); // flip boolean for this row
                        this.invalidate();
                        this.repaint();
         } // end mouseClicked
         @Override
         public void mouseEntered(MouseEvent arg0) {
         @Override
         public void mouseExited(MouseEvent arg0) {
         @Override
         public void mousePressed(MouseEvent arg0) {
         @Override
         public void mouseReleased(MouseEvent arg0) {
        @Override
        public Component prepareRenderer (TableCellRenderer renderer,int row, int column) {
            Component component = super.prepareRenderer(renderer, row, column);
            // now get the current font used for this cell
            Font font = component.getFont();
            if (column == 0) {
                 if (isBoldList.get(row)) {
                      System.out.println ("prepareRenderer(): ctrl-click: bold: " + isBold);
                      component.setFont(font.deriveFont(Font.BOLD));
                      component.setForeground(getForeground()); // otherwise text disappears
                 else { // not bold
                      System.out.println ("prepareRenderer(): ctrl-click: not bold: " + isBold);
                      component.setFont(font.deriveFont(Font.PLAIN));
                      component.setForeground(getForeground()); // otherwise text disappears
              return component;
          * @param args
         public static void main(String[] args) {
              try {
                   UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
              catch (Exception e){
                   e.printStackTrace();
              final JPanel jPanel = new JPanel();
              final MyTableWithCustomRenderer myTable = new MyTableWithCustomRenderer();
              jPanel.add(myTable);
              final JFrame frame = new JFrame();
              frame.add(jPanel, BorderLayout.CENTER);
              frame.setTitle("My Panel - Custom Renderer");
              frame.setPreferredSize(new Dimension(400, 150));
              frame.addWindowListener(new WindowAdapter(){
                   @Override
                   public void windowClosing(WindowEvent e) {
              frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
              frame.setLocation(300, 200);
              frame.pack();
              frame.setVisible(true);
    }Edited by: allelopath on Jul 8, 2010 2:07 PM

  • Importing Excel tables into RoboHelp

    This procedure worked with RoboHelp 8.0.2, Microsoft Office 2003 and Windows XP. It should be OK for other versions and for OpenOffice but I can't test that here.
    My developer proudly gave me a list of 200 error codes as an Excel table with four columns: Number, Description, Source, Possible Solution. Top-class stuff for a service manual, but it meant 800 rounds of Tab Ctrl-C Alt-Tab Tab Ctrl-V Alt-Tab. Being naturally lazy I decided to try an easier way.
    In RoboHelp I created a simple table of 2 rows and 4 columns. I formatted the cells as Normal and looked at the HTML.
    The Table Row <tr> and Cell <td> structure is easy to see; Each row begins with
      <tr><td><p>
    Between each cell is
      </p></td><td><p>
    Each row ends with
      </p></td></tr>
    First I `cleaned' my Excel sheet; I used Replace All to replace all commas with a string "COMMA". I also replaced ampersands "&" with the html "&amp;" and then replaced greater-than ">" with "&gt;" and less-than "<" with "&lt;"
    Then I inserted columns in the spreadsheet and filled them with the HTML table structure described above. I saved the Excel sheet as a comma-delimited file CSV.
    I closed Excel and opened the CSV file with a text editor (Notepad).
    I used Replace All to remove all commas (inserted by Excel); then restored the real commas by replacing the string COMMA.
    Then I copied the entire contents of the file onto the clipboard, and pasted it into the HTML to replace my dummy rows.
    That was it! RoboHelp accepted the transplant and I could format the header rows and set column widths in the normal way.
    Dear RH and HTML gurus reading this: is my procedure safe? or will something come back to bite me later?
    --- Derek

    Our developer-provided tables are huge (up to 15 columns and 400 rows), so we've been able to have the developers create HTML files (not HTM) with similar formatting to our regular tables.
    We then set up links to those files and add them to Baggage Files. They don't become part of the search (no problem for us, since we can include them into our Zoom Search indexing process), nor do they get processed by RoboHelp (which was a big plus because RH used to choke on those tables in HTM format).
    The other plus is not having to repeat your process every time changes are made by the developers (they run their own conversion process and you plug in the replacement version of the file that they provide).
    Good luck,
    Leon

  • Scripting for different numbers of table rows in cs3

    As always thank you for the help.
    My question: is there a simple newbie way to script for stroke placements when the numbers of rows in the category between the stroke will vary. I have not even attempted to script this style, as frankly I don't know where to start, but here is an explanation of what I need:
    The table foodstuff contains:
    animal, vegetable, fruit
    Under animal there is:
    beef, lamb, pork, poultry
    Under vegetable there is:
    potato, pepper, onion
    Under fruit there is:
    orange
    If wanted a line under each category, ie after poultry, after onion, and after orange how would I go about it.
    Thank you to all who have helped me so far, either by reading answers to other people's queries, or by responding directly to my own

    Interesting ... I don't think there is a newbie-level answer to this challenge. It comes down to finding the first (left-to-right) cell that contains text, and adding a line on top of it all the way to the last cell in that row.
    Here's a first attempt:
    table = app.selection[0];
    if (table.hasOwnProperty("baseline"))
    table = table.parent;
    if (table instanceof Cell)
    table = table.parent;
    if (table instanceof Column)
    table = table.parent;
    if (table instanceof Row)
    table = table.parent;
    if (table instanceof Table)
    table.cells.everyItem().properties = {topEdgeStrokeWeight:0, bottomEdgeStrokeWeight:0, leftEdgeStrokeWeight:0, rightEdgeStrokeWeight:0};
    table.rows.lastItem().bottomEdgeStrokeWeight = 1;
    for (r=0; r<table.rows.length; r++)
      for (c=0; c<table.rows[r].cells.length; c++)
       if (table.rows[r].cells[c].contents)
        for (; c<table.rows[r].cells.length; c++)
         table.rows[r].cells[c].topEdgeStrokeWeight = 1;
        break;
    } else
    alert ("You were supposed to be somewhere inside a Table");

  • Automated script for setting authorization limit in GL

    Hi,
    I am trying to create an automated script in our General Ledger application to set authorization limit. I have looked into code of form GLXSTEAL.fmb. There I found that, GL_AUTHORIZATION_LIMITS_PKG is being used for setting authorizations limit.
    Below is the code I am trying to run from PL/SQL developer using apps id:
    declare
    l_Rowid varchar2(30);
    l_Set_Of_Books_Id apps.GL_AUTHORIZATION_LIMITS.SET_OF_BOOKS_ID%TYPE;
    l_Employee_Id apps.GL_HR_EMPLOYEES_CURRENT_V.EMPLOYEE_ID%TYPE;
    l_Authorization_Limit apps.GL_AUTHORIZATION_LIMITS.AUTHORIZATION_LIMIT%TYPE;
    l_user_id number := FND_GLOBAL.USER_ID;
    l_login number :=FND_GLOBAL.login_id;
    p_Attribute1 apps.GL_AUTHORIZATION_LIMITS.Attribute1%TYPE;
    p_Attribute2 apps.GL_AUTHORIZATION_LIMITS.Attribute2%TYPE;
    p_Attribute3 apps.GL_AUTHORIZATION_LIMITS.Attribute3%TYPE;
    p_Attribute4 apps.GL_AUTHORIZATION_LIMITS.Attribute4%TYPE;
    p_Attribute5 apps.GL_AUTHORIZATION_LIMITS.Attribute5%TYPE;
    p_Attribute6 apps.GL_AUTHORIZATION_LIMITS.Attribute6%TYPE;
    p_Attribute7 apps.GL_AUTHORIZATION_LIMITS.Attribute7%TYPE;
    p_Attribute8 apps.GL_AUTHORIZATION_LIMITS.Attribute8%TYPE;
    p_Attribute9 apps.GL_AUTHORIZATION_LIMITS.Attribute9%TYPE;
    p_Attribute10 apps.GL_AUTHORIZATION_LIMITS.Attribute10%TYPE;
    p_Attribute11 apps.GL_AUTHORIZATION_LIMITS.Attribute11%TYPE;
    p_Attribute12 apps.GL_AUTHORIZATION_LIMITS.Attribute12%TYPE;
    p_Attribute13 apps.GL_AUTHORIZATION_LIMITS.Attribute13%TYPE;
    p_Attribute14 apps.GL_AUTHORIZATION_LIMITS.Attribute14%TYPE;
    p_Attribute15 apps.GL_AUTHORIZATION_LIMITS.Attribute15%TYPE;
    p_Context apps.GL_AUTHORIZATION_LIMITS.context%TYPE;
    l_date date :=sysdate;
    begin
    GL_AUTHORIZATION_LIMITS_PKG.Insert_Row(
    p_Rowid => l_Rowid,
    p_Set_Of_Books_Id => 1001,
    p_Employee_Id => 9236,
    p_Authorization_Limit => 100,
    p_Last_Update_Date => l_date,
    p_Last_Updated_By => l_user_id,
    p_Creation_Date => l_date,
    p_Created_By => l_user_id,
    p_Last_Update_Login => l_login,
    p_Attribute1 => p_Attribute1,
    p_Attribute2 => p_Attribute2,
    p_Attribute3 => p_Attribute3,
    p_Attribute4 => p_Attribute4,
    p_Attribute5 => p_Attribute5,
    p_Attribute6 => p_Attribute6,
    p_Attribute7 => p_Attribute7,
    p_Attribute8 => p_Attribute8,
    p_Attribute9 => p_Attribute9,
    p_Attribute10 => p_Attribute10,
    p_Attribute11 => p_Attribute11,
    p_Attribute12 => p_Attribute12,
    p_Attribute13 => p_Attribute13,
    p_Attribute14 => p_Attribute14,
    p_Attribute15 => p_Attribute15,
    p_Context => p_Context );
    commit;
    end;
    I am getting the error PLS-00306: wrong number or types of arguments in call to 'INSERT_ROW'.
    Please help me with this.
    Thanks

    I have found another way to achieve this. By inserting the data directly to GL_AUTHORIZATION_LIMITS table.
    INSERT INTO gl.GL_AUTHORIZATION_LIMITS
    (set_of_books_id,employee_id,authorization_limit,CREATION_DATE,CREATED_BY,LAST_UPDATE_DATE,LAST_UPDATED_BY,LAST_UPDATE_LOGIN)
    VALUES (1001,p_person_id,1.00,SYSDATE,l_user_id,SYSDATE,l_user_id,l_login);

  • A small wrapper script for setting the lib32-gtk environment.

    Hi all,
    i've created a small script [1], which sets the gtk2 environment for
    lib32 applications.
    Thanks to buttons and alexwizard...
    just put run_bin32_gtk before the app command.
    I use this script for QT4 apps mostly, for instance:
    run_bin32_gtk opera
    or
    run_bin32_gtk skype --disable-cleanlooks
    so it fits best in my gnome environment...
    best wishes
    [1] http://aur.archlinux.org/packages.php?ID=27419

    I did something similar a couple of months ago, but instead of attempting to be clever and guessing what the background image is supposed to be, I just write it in the filename. Since some pictures just end up being too bright (or whatever) when used as a background to a urxvt terminal, I added some extra parameters for setting gamma, brightness, tint and the direction the image should be rendered. It relies on hsetroot for actually rendering the picture.
    #!/usr/bin/python
    # set-background
    import sys, os, string, re
    patterns = [ (re.compile("t-([a-f\d]+)"), lambda x: "-tint \#" + x)
    , (re.compile("b-([\d]+)"), lambda x: "-brightness -0." + x)
    , (re.compile("g-([\d]+)"), lambda x: "-gamma "+ x)
    , (re.compile("f-(v|h|d)"), lambda x: "-flip" + x)
    def buildCommand(file):
    output = ["hsetroot"]
    output.append("-" + (string.split(file,".")[-2]))
    output.append(file)
    for token in string.split(file,".")[1:-2]:
    for (pat,f) in patterns:
    if pat.match(token):
    output.append( f(pat.findall(token)[0]))
    return string.join(output)
    print buildCommand(img)
    os.system(buildCommand(img))
    # vim:set et:
    So for instance, an image with the name background.t-704214.f-v.full.jpg would be rendered as a stretched image, flipped vertically with a sepia tint. The files are required to be in the following format NAME.(MODIFIER.)*TYPE.SUFFIX, where the the order and number of modifiers are unimportant. The gamma values are somewhat unintuitive, but I guess you'll just have to play around with it to get it right.
    And to randomize the whole thing, I just used the following script in my .xinitrc to randomly pick a image from a folder.
    #!/bin/bash
    bg_folder="$HOME/.backgrounds";
    pics=($(ls $bg_folder))
    let "n = $RANDOM % ${#pics[@]}"
    (cd $bg_folder; set-background ${pics[$n]})

  • Adding hyperlinks to imported excel file cells

    Good Afternoon All,
    I am having trouble assigning hyperlinks and defining names to the individual cells of an imported excel file (import into Visio). Ideally, I would like to be able to hyperlink shapes in other Visio pages (of the same
    workbook) to individual cells of the imported excel file and vice versa.  Is there any way of doing this? 
    Please let me know if I can clarify.
    -Tom

    In a similar thread from a few days ago:
    Albert Geven wrote:
    > You can also download from the developer zone our excel (goop)
    >library.
    >search for philips and you'll find it.
    We've used this with good success for creating multiple worksheets. If you
    like goop, its great. It may be worth a look for you. It's at this link
    http://zone.ni.com/devzone/devzoneweb.nsf/opendoc?openagent&42E12CDCDBD1C682
    8625699D004EEFA8&cat=9C6DF90777E5A78206256874000FA14E
    Spencer
    "Jeff - PPL" wrote in message
    news:[email protected]..
    > Is it possible to send data to two different worksheets in an excel
    > file? For example, I have raw data and then calculations from that
    > raw data. Right now I have the raw data being sent to the exc
    el file.
    > I would like to be able to send the calculation results to the same
    > file but a new worksheet. Is this possible?
    >
    > Thanks

  • A script for setting a random wallpaper

    I've cooked up this small bash script for changing the wallpaper to a random one from a specified directory (it is recursive)
    The script tries to be smart in determining whether the wallpaper should be scaled, centered or tiled.
    Just configure it and try it out.
    Anyway, here goes:
    #!/bin/bash
    # Random wallpaper setter, by moljac024
    # Configuration
    # Wallpaper directory
    wpDir="$HOME/Wallpapers"
    # Wallpaper list path
    wpList=$HOME/.wallpaper-list
    # Folders to be skipped, you can put as many as you like
    #wpSkip=("Dir1/" "Dir2/")
    # Scale images that have a lower resolution than that of the screen (yes or no)
    scaleLowerRes="yes"
    #scaleLowerRes="no"
    # Screen resolution
    resWidth=1280
    resHeight=800
    # Command for tiling the wallpaper
    cmdTile="feh --bg-tile"
    #cmdTile="nitrogen --set-tiled --save"OA
    #cmdTile="xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitor0/image-style -s 2 && xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitor0/image-path -s"
    #cmdTile="gconftool-2 -t str --set /desktop/gnome/background/picture_options "wallpaper" -t str --set /desktop/gnome/background/picture_filename"
    # Command for scaling the wallpaper
    cmdScale="feh --bg-scale"
    #cmdScale="nitrogen --set-scaled --save"
    #cmdScale="xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitor0/image-style -s 3 && xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitor0/image-path -s"
    #cmdScale="gconftool-2 -t str --set /desktop/gnome/background/picture_options "zoom" -t str --set /desktop/gnome/background/picture_filename"
    # Command for centering the wallpaper
    cmdCenter="feh --bg-center"
    #cmdCenter="nitrogen --set-centered --save"
    #cmdCenter="xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitor0/image-style -s 1 && xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitor0/image-path -s"
    #cmdCenter="gconftool-2 -t str --set /desktop/gnome/background/picture_options "centered" -t str --set /desktop/gnome/background/picture_filename"
    # End of configuration
    setTiled ()
    `$cmdTile "$1"`
    if [ "$?" = "0" ]; then
    echo "Wallpaper tiled."
    else
    echo "Wallpaper not set!"
    exit 1
    fi
    setScaled ()
    `$cmdScale "$1"`
    if [ "$?" = "0" ]; then
    echo "Wallpaper scaled."
    else
    echo "Wallpaper not set!"
    exit 1
    fi
    setCentered ()
    `$cmdCenter "$1"`
    if [ "$?" = "0" ]; then
    echo "Wallpaper centered."
    else
    echo "Wallpaper not set!"
    exit 1
    fi
    createList ()
    # Go to the wallpaper directory
    cd "$wpDir"
    # Load the list of pictures to a variable
    wpDirList=`(find . -regex ".*\([jJ][pP][gG]\|[jJ][pP][eE][gG]\|[gG][iI][fF]\|[pP][nN][gG]\|[bB][mM][pP]\)$" -type f)`
    # Save the list to disk
    if [[ ( -w "$wpList" ) ]]; then
    echo -n "$wpDirList" > "$wpList"
    # Filter out unwanted folders
    if [[ "$dontSkip" == "false" ]]; then
    for dir in "${wpSkip[@]}"
    do
    grep -Ev "$dir" "$wpList" > ~/.wallpapers-tmpr; mv ~/.wallpapers-tmpr "$wpList"
    done
    fi
    # Output result
    echo "Wallpaper list saved."
    else
    echo "Can't write wallpaper list, aborting!"
    exit 1
    fi
    getImage ()
    # Count number of pictures in the wallpaper list by counting number of lines.
    # Check if the wallpaper list exists, is not empty and we have read persmission on it
    if [[ ( -s "$wpList" && -f "$wpList" ) && -r "$wpList" ]]
    then
    wpListNumber=$(wc -l < "$wpList")
    else
    echo "Can't read wallpaper list, aborting!";
    exit 1
    fi
    # Counter for bad entries in wallpaper list
    badMax=100
    while true; do
    # Get a seed for the random number generator from /dev/urandom
    SEED=$(head -1 /dev/urandom | od -N 1 | awk '{ print $2 }')
    RANDOM=$SEED
    # Find a random line number in the wallpaper list
    # Random number from 1..n.
    #r=$((RANDOM % $wpListNumber + 1))
    r=$(echo $RANDOM%"$wpListNumber"+1 | bc)
    # Print what the line number is
    # Print the r'th line.
    imgPath=`sed -n "$r{p;q;}" "$wpList"`
    # #./ crops that substring but it doesn't matter if it left there
    wpPath="${wpDir}${imgPath#./}"
    # Check if the chosen file exists
    if [ -f "$wpPath" ]; then
    break
    else
    echo -e ""$wpPath": doesn't exist!\n"
    badMax=$(( $badMax - 1 ))
    if [ "$badMax" == "0" ]; then
    echo "Too many non-valid entries found in wallpaper list, aborting!"
    exit 1
    else echo "Choosing new image..."
    fi
    continue
    fi
    done
    # Calculate size and aspect for chosen image and print out information
    imgHeight=$(identify -format "%h" "$wpPath")
    imgWidth=$(identify -format "%w" "$wpPath")
    imgAspect=$(echo "scale=1; "$imgWidth"/"$imgHeight"" | bc)
    echo -e "Image: "$wpPath"\n"
    echo -e "Resolution: "$imgWidth"x"$imgHeight""
    echo -e "Aspect: "$imgAspect":1\n"
    setWallpaper ()
    # Calculate resolution aspect ratio
    resAspect=$(echo "scale=1; "$resWidth"/"$resHeight"" | bc)
    # If the image is smaller than the resolution and is not a tile then scale it, otherwise look at aspect
    if [[ ("$scaleLowerRes" == "yes") && ( "$imgAspect" != "1.0" && ("$imgWidth" -lt "$resWidth" || "$imgHeight" -lt "$resHeight") ) ]]
    then
    setScaled "$wpPath"
    else
    case $imgAspect in
    1.0)
    setTiled "$wpPath"
    1.5 | 1.6 | 1.7 | 1.8)
    if [[ "$resAspect" < "1.5" ]]; then
    setCentered "$wpPath"
    else
    setScaled "$wpPath"
    fi
    if [[ "$resAspect" < "1.5" ]]; then
    setScaled "$wpPath"
    else
    setCentered "$wpPath"
    fi
    esac
    fi
    checkConfig ()
    # Initial errors
    errorsPresent="no"
    dontSkip="false"
    # Check if all variables are set
    if [[ !( ( -n "$wpDir" ) && ( -n "$wpList" ) && ( -n "$resWidth" ) && ( -n "$resHeight" ) && ( -n "$scaleLowerRes" ) && ( -n "$cmdTile" ) && ( -n "$cmdScale" ) && ( -n "$cmdCenter" ) ) ]]
    then
    echo -e "\nOne or more options not set, aborting!"
    exit 1
    fi
    # Check if there is a trailing backslash in the wallpaper directory
    spDir=`echo -n "$wpDir" | tail -c -1`
    if [[ !( "$spDir" == "/" ) ]]
    then
    wpDir=""$wpDir"/"
    fi
    # Check if there is read permission on wallpaper directory and if it is a directory
    if [[ !( ( -r "$wpDir" ) && ( -d "$wpDir" ) ) ]]
    then
    echo "Can't read wallpaper directory!"
    errorsPresent="yes"
    fi
    # Check if the specified wallpaper list is a regular file and not a directory
    touch "$wpList" &> /dev/null
    if [[ ( -d "$wpList" ) ]]
    then
    echo "Specified wallpaper list is a directory, not a file!"
    errorsPresent="yes"
    fi
    # Check if variables are set correctly
    if [[ !( "$scaleLowerRes" == "yes" || "$scaleLowerRes" == "no" ) ]]
    then
    echo "Specified option for scaling the wallpaper is not valid!"
    errorsPresent="yes"
    fi
    if $(echo ""$resWidth"" | grep [^0-9] &>/dev/null)
    then
    echo "Specified resolution width is not a number!"
    errorsPresent="yes"
    fi
    if $(echo ""$resHeight"" | grep [^0-9] &>/dev/null)
    then
    echo "Specified resolution height is not a number!"
    errorsPresent="yes"
    fi
    # Check if any of the tests failed
    if [[ "$errorsPresent" == "yes" ]]
    then
    echo -e "\nOne or more errors found, aborting!"
    exit 1
    fi
    ignoreWPSkip()
    dontSkip="true"
    printUsage ()
    echo -e "Invalid command line argument(s)!\nUsage:\n"
    echo -e "`basename "$0"` [options]\n"
    echo -e "Options:\n"
    echo -e "-s | --set \tSet a wallpaper without updating the list"
    echo -e "-u | --update \tUpdate the list without setting a wallpaper"
    echo -e "-ua | --update-all\tUpdate the list without setting a wallpaper, but don't skip any folders"
    echo -e "-su | --set-update\tUpdate the list and set a wallpaper"
    exit 1
    if [ "$#" == "1" ]; then
    case "$1" in
    "-s" | "--set")
    checkConfig
    getImage
    setWallpaper
    exit 0
    "-u" | "--update")
    checkConfig
    createList
    exit 0
    "-ua" | "--update-all")
    checkConfig
    ignoreWPSkip
    createList
    exit 0
    "-su" | "--set-update")
    checkConfig
    createList
    getImage
    setWallpaper
    exit 0
    printUsage
    exit 1
    esac
    else
    printUsage
    exit 1
    fi
    Last edited by moljac024 (2009-09-14 21:02:13)

    I did something similar a couple of months ago, but instead of attempting to be clever and guessing what the background image is supposed to be, I just write it in the filename. Since some pictures just end up being too bright (or whatever) when used as a background to a urxvt terminal, I added some extra parameters for setting gamma, brightness, tint and the direction the image should be rendered. It relies on hsetroot for actually rendering the picture.
    #!/usr/bin/python
    # set-background
    import sys, os, string, re
    patterns = [ (re.compile("t-([a-f\d]+)"), lambda x: "-tint \#" + x)
    , (re.compile("b-([\d]+)"), lambda x: "-brightness -0." + x)
    , (re.compile("g-([\d]+)"), lambda x: "-gamma "+ x)
    , (re.compile("f-(v|h|d)"), lambda x: "-flip" + x)
    def buildCommand(file):
    output = ["hsetroot"]
    output.append("-" + (string.split(file,".")[-2]))
    output.append(file)
    for token in string.split(file,".")[1:-2]:
    for (pat,f) in patterns:
    if pat.match(token):
    output.append( f(pat.findall(token)[0]))
    return string.join(output)
    print buildCommand(img)
    os.system(buildCommand(img))
    # vim:set et:
    So for instance, an image with the name background.t-704214.f-v.full.jpg would be rendered as a stretched image, flipped vertically with a sepia tint. The files are required to be in the following format NAME.(MODIFIER.)*TYPE.SUFFIX, where the the order and number of modifiers are unimportant. The gamma values are somewhat unintuitive, but I guess you'll just have to play around with it to get it right.
    And to randomize the whole thing, I just used the following script in my .xinitrc to randomly pick a image from a folder.
    #!/bin/bash
    bg_folder="$HOME/.backgrounds";
    pics=($(ls $bg_folder))
    let "n = $RANDOM % ${#pics[@]}"
    (cd $bg_folder; set-background ${pics[$n]})

  • Scripting for GarageBand: import; compress; export

    Hi there -
    I'm not sure where the best place to post this is, so forgive me if this was not the best guess. I'm doing research on language and have a workflow that involves collecting thousands of recordings of individual words:
         I record someone for half an hour;
         splice that single audio file into hundreds or thousands of single-word chunks;
         export each splice as a separate audio file;
         (would like to) use automator / script to automatically rename the resultant files with an alphanumeric prefix and numerical postfix;
         import each of these files into GarageBand (or StudioOne) individually;
         compress the file to reduce dynamic range;
         export the finalized file into a designated folder.
    I have some very basic background in programming (primarily MatLab, but very basic dabbling in C), but I know nothing about scripting for Macs. In the long term, I'm interested in learning how to do this, but in the short term I'm looking at a lot of work that needs to get procssed and just need a quick fix for automating so that I don't have to (continue to) do this manually for each file!
    In case it is of interest to anyone who may respond: the ultimate goal fo the process is to attain as constant a volume across all the files as possible: I record many different people, in different settings over the course of months or years and was told that compression will help standardize the playback volume. The reason for compressing each file individually is because even within a single recording session, the individual's voice may fluctuate notably as they move closer and further from the mic, or even if there is a single loud noise during recording - it would act as the reference point for compression, even though it was an anamoaly.
    Finally, to clarify the questions involved here:
    How can I automate the last 4 or so (or more?!) points from the above workflow? or Any suggestions where to find someone who could do this?
    Alternatievely: suggestions on standardizing volume playback that does not involve the above process (NB: the standardization has to be as professional as possible, so I don't want to compromise the result for a simpler workflow).
    Where can I start to learn more about scripting on the Mac so I can tackle such issues on my own, in the future?
    Kind regards,
    Rax Adam

    Yes, the Keynote presentation slides/project is set for 1920x1080, the reason is I'm outputting via a high lumens projector that natively projects at 1920x1080p.
    Even though a Macbook Pro does not have a screen that size, the Macbook can send out even larger than 1920x1080, but I am limiting the output to the native screen res of the projector.

  • Creating SQL-Loader script for more than one table at a time

    Hi,
    I am using OMWB 2.0.2.0.0 with Oracle 8.1.7 and Sybase 11.9.
    It looks like I can create SQL-Loader scripts for all the tables
    or for one table at a time. If I want to create SQL-Loader
    scripts for 5-6 tables, I have to either create script for all
    the tables and then delete the unwanted tables or create the
    scripts for one table at a time and then merge them.
    Is there a simple way to create migration scripts for more than
    one but not all tables at a time?
    Thanks,
    Prashant Rane

    No there is no multi-select for creating SQL-Loader scripts.
    You can either create them separately or create them all and
    then discard the one you do not need.

  • Help on preparing shell script for setting the listener password

    Hi All,
    I am working on checking all my DB servers listeners and if the password is not set for the listener then I need to set the password for that.
    As we have many servers, I am planning to prepare the shell script for doing this task.
    I am familiar with setting up the listener password manually, but strucked up to prepare the shell script to do the same task.
    Can any one kindly help me on this.
    Thanks in advance,
    Mahi

    815537 wrote:
    Could any body please help me.
    Thanks,
    MahiPatience, Grasshopper
    This forum is not a chat line, and it is not paid support.
    No one is responsible for monitoring it and giving a quick response.
    Furthermore, it is a global forum. The person with the information you seek may very well live 20 time zones away from you and was going to bed just as you posted. He will not even see your post for several more hours.
    Your original post went up in the middle of the night for half the world.
    No one with the information you seek is deliberately withholding it until you sound sufficiently desperate.

  • Setting Visibility to Table cell editor

    Hi
    I created a table and added a colomn to the table in view layout. Cell editor of that colomn contains an image. Based on some conditions , I need to make image invisible in table cell editor of custom colomn.
    How can I do it.

    Example:
    Context:
    Rows (model node)
    -- Name (attribute, string)
    -- Additional (value node, card=1:1, selection=1:1, singleton=false)
    ---- EditorVisibility (attribute, type=Visibility)
    Data binding:
    LinkToAction.visible -> Rows.Additional.EditorVisibility
    Make editor in row at index 4 visible if name is not empty:
    IRowsElement row = wdContext.nodeRows().getRowsElementAt(4);
    row.currentAdditionalElement().setEditorVisibility(row.getName() != null && row.getName().length() > 0
      ? WDVisibility.VISIBLE
      : WDVisibility.NONE);
    Ok?
    Armin

  • Help with scripting: need to import Excel files into PS type layers

    Howdy all,
    I have a series of TV commercials provided to me as layered PS files.  I work in CS3 and export to Avid for editing.
    For customization, I need to import their Excel list of phone numbers and duplicate each one into a type layer with existing efx and placement.
    There are 30-60 #s, which appear in 2 locations, so automation is key (just finished a 45 # series, and they have more!)
    I dont know how to script this, and would appreciate any guidance. I am not asking for someone to do it for me, just help me learn what I have to do.
    Dave Koslow

    From Excel save your file out as either CSV or TDT from the drop down 'save as' options. Once you have a plain text file script will be able to read the text file using which ever delimiter best suits you and create an array of string variables that you can use within photoshop to assign to the contents of a text layer…

  • Setting the excel sheet cell category

    Hi all,
    I have a program which downloads SAP data in excel sheet using OLE (Function modules cannot be used as its multiple tab download).
    I am facing an issue regarding the date fields.The cell category (data type) is choosen randomly so the date is displayed in wrong format.So  i need to set the category or the data type of the cell before populating the data in it.
    I have placed a part of my code below.
    CALL METHOD OF gw_sheet 'cells' = gw_cells
            EXPORTING
            #1 = g_row
            #2 = g_col.
          SET PROPERTY OF gw_cells 'value' = lw_table-data.
    Can somebody help me in setting the data type of the cell ( eg,Number,text,date,Currency etc)
    Ps :- Actually i need to set the data type as Text for all cells.
    Thanks in advance,
    Kiran

    Try like:
    CALL METHOD OF gw_sheet 'cells' = gw_cells
    EXPORTING
    #1 = g_row
    #2 = g_col.
    SET PROPERTY OF gw_cells 'NumberFormat' = '@'.   "For Text
    To get the Property in excel you can take a help of Macro.
    Follow this steps:
    1. Create a new workbook
    2. Tools > Macro > Record a new macro
    3. Now, perform your actions i.e. Set the cell format to Text
    4. Stop the Macro Tools > Macro > Stop Recording
    5. Now Edit Macro to see which property it has accessed.
    Tools > Macro > Run (Alt + F8)
    Select Your macro and Edit
    Here you will see which property you have to set to make it Text.
    Regards,
    Naimesh Patel

Maybe you are looking for

  • SCCM 2012 SP1 - Offline Servicing failure - Failed to find or access the update binaries to be applied on the image

    Hi there Trying to patch a new Windows 7 SP1 image within SCCM 2012 SP1, but it's failing. I've searched for information on the failure messages I am seeing, but although there is a LOT of information online concerning Offline Servicing failures, I c

  • EXCEPTION: there should be exactly one local peer

    I am trying to get started using PHD, but I can not get it to working yet. When I have login on the client it acts as if the sync is happening, but it never happens. I have poured through the FileSync logs on the client and keep finding complaints of

  • Services feature

    I am interested in learning how to email a copy of my pages document to someone while I am still in the document. In Word I can do this by going to file, scrolling down to send and then sending the document as an email attachment. Can I do this in pa

  • Get the report name in reports 6i??

    Hi!! I need to get the report name from reports 6i, in forms i can get the form name whit :SYSTEM.CURRENT_FORM, but in reports this is not possible. How Can I get the name of the report?? Thanks! Regards!! Edited by: JuaNiNNaio on 30-jun-2009 9:55

  • Plug-ins of the MIME type

    I have the latest Flash Player, Windows Media Player, Quicktime, and probably several others. I have gone to the Macromedia site and verified that they are installed. However, many times a site says that Flash Player isn't there. Further, I get the f