Problem with Nested tell blocks in Applescript

Hello everyone,
I've been trying to do a little Applescript, whose purpose is to open a file selector to let the user choose a bunch of images, then prompt him to ask a resizing ratio, and then resize the chosen pictures accordingly (after duplicating the originals in a folder on the desktop, the copied files being the ones resized).
I'm having problems with the resizing part... Here is the code I've come up with so far... "Image traitées" is the name of the new folder created on the desktop, and "compression" is the factor in %.
     -- Resizing 
     tell application "Finder"
          repeat with photo in folder "Images traitées" of desktop
               tell application "Image Events"
                    launch
                    scale photo by factor compression * 0.01
               end tell
          end repeat 
     end tell
I'm encountering an error number -1708, saying that the 'photo' item doesn't understand the scale message...
As I'm new to Applescript, I have some difficulties solving this... Could it be due to the nested tell blocks ?
Thanks a lot for your help !
Thomas

Your tell statements are OK, although when nesting them you do need to keep track of what application is getting targeted in any given statement (to avoid terminology conflicts).
Each application refers to its objects in its own way - unfortunately, not everything knows about Finder references.  Your photo variable contains a Finder reference (e.g. "file x of folder y of disk z"), but Image Events doesn't know what that is.  The solution is to convert the Finder reference to something more standard, such as text or an alias.
Your script won't work with just that change, however.  Image Events works with the image contained in a file, so you also need to actually get that image, for example:
set compression to 80 -- used in the following snippet
tell application "Image Events" to launch -- just need to do this once
tell application "Finder"
     repeat with photo in folder "Images traitées" of desktop
          tell application "Image Events"
               set theImage to open (photo as alias) -- get the image from the Finder reference
               scale theImage by factor compression * 0.01
               save theImage -- save the changed image
          end tell
     end repeat
end tell

Similar Messages

  • Problem with Family Protection blocking

    I have an ongoing problem with Family Protection blocking allowed websites from my daughter.  I checked her account settings which are the same as her brother's and he has no problems.  I then removed her account and created a new one and copied the settings across from his to ensure everything was the same - still no difference.  Any suggestions?  I guess I could try reinstalling but it is such hassle to get a code etc...

    I am experiencing this issue as well. I can download about 50 of my 900 songs through family sharing the rest say unable to download. Apple call support and genous at Apple store were both unable to solve the issue. I've resorted to using the same Apple ID on all devices but obviously this is not ideal. If anyone has success solving this I would love to see a post on it. It's definitely something with the iTunes or Apple id end of things and not device or setting related because I have tried everything I can locally.

  • Has anyone had problems with iCloud being blocked by corporate web security?

    Has anyone else encountered problems with iCloud being blocked by the web-security on company computers?   I never had any problems with me.com, but now it appears I will be unable to check my mail via any computer at work. 
    Since iCloud is a portal for high-volume image and file sharing, I can understand why the site would be blocked, but it's very frustrating that this possibility would not have been anticipated, and an alternate web-mail site been set up.  Otherwise many me.com subscribers may be left unable to use the iCloud web-mail portal via computers at work or at internet cafes that may block access to potentially risky websites.
    Has anyone figured out a back door to this problem? 

    I dont beleive its an iOS 5 Issue - i think its hardware...
    Simply because i have been running iOS 5 beta's since june and there were no issues with my iPhone 4.
    When i installed the GM on my iphone 4 (which is the same build as the public release) there were no issues with charging in my vehicle.
    Now, charging my iPhone 4S in my car is practically impossible.
    when i plug mine in, it will display the "Plugged" symbol on the battery display but not actually charge. the battery will still decrease.
    then it will randomly "disconnect" and not register that it is plugged in. then appear to be plugged in, then not, then plugged in, then not.
    This will repeat over and over again without actually charging and the charger being in the socket throughout.
    however yesterday i left it plugged in and my battery was 9% and after the strange plugged-in behaviour i noticed it was charging normally after about 20 mins in the car.
    But when i did the same journey time today, the battery wouldnt register at all.... charging has only been successful ONCE since 14th October on the iPhone 4s
    No idea whats up with it...
    anybody else?

  • Strange problem with nested address book groups

    I have a strange problem with iSync. I have created a group On-the-Go in my Address Book that I'm syncing with my phone (Motorola v600). The group consists of three other groups. Let's call them A, B and C.
    The problem is that only group C gets synchronized. Contacts from groups A and B disappear from the phone. Strangely, if I select A or B to sync in iSync - they get synchronized just fine. Also, group C, in turn, contains other nested groups, but that does not seem to be a problem.
    I played with group names, tried to recreate group A to no avail.
    For now, I have added all contacts from A and B to On-the-Go as a workaround, but
    it looks like a bug to me.

    I have a strange problem with iSync. I have created a group On-the-Go in my Address Book that I'm syncing with my phone (Motorola v600). The group consists of three other groups. Let's call them A, B and C.
    The problem is that only group C gets synchronized. Contacts from groups A and B disappear from the phone. Strangely, if I select A or B to sync in iSync - they get synchronized just fine. Also, group C, in turn, contains other nested groups, but that does not seem to be a problem.
    I played with group names, tried to recreate group A to no avail.
    For now, I have added all contacts from A and B to On-the-Go as a workaround, but
    it looks like a bug to me.

  • Massive problems with nested multi-cam sequences

    Hey all,
    I'm absolutely pulling my hair out over some issues I'm having and hope somebody out there might have an answer.  I'm creating a short interview project, including interviews of two people individually, with two separate cameras and external sound capture.  My goal is to cut between their separate answers to each question.  For each interview I created a multi-cam sequence within its own timeline.  Then, in my master sequence, I used the source monitor to pull out the specific clips from each interview sequence which I wanted to include, and assembled them into the master timeline.
    I'm having two difficulties.  First, for whatever reason, I'm experiencing audio glitching when the cuts between sequence clips occur.  The glitch is like an audio "scramble," lasts about a half second, plenty of time to be distracting and detract from the whole of the project.  There are no such audio glitches present when viewing the interview sequences specifically.  I had applied effects to the audio tracks both within the interview sequences and the master sequence.  I've since disabled every effect but the problem persists, and it is still present upon rendering the master timeline.  I have absolutely no idea what to do about this.
    The second issue is more general.  I've got my media cache on an internal SSD, and I'm pulling my media from an internal HDD, with Premiere Installed on a different SSD with my operating system.  The two interview sequences play back wonderfully, no delays whatsoever.  The master timeline, however, with all the clips extracted from the interview sequences, plays slow as molasses.  It takes 10-15 seconds for the play head to even start moving once I click 'play', which has made this entire process excruciatingly difficult.  Is this a known issue?  Why would my performance be so completely degraded working with nested sequences?  Isn't everything referencing the exact same files?
    Ugh, long night working on this.  Thank you for any help.

    Well, I've come up with a terrible, but comical solution for the second issue which doesn't involve reworking anything.  It turns out that, upon launching premiere, I can play the master sequence with nested multi-cam sequences a grand total of ONCE with minimal delay.  If I stop the play through, then it will take 3-4 minutes to get the sequence playing again.  Of course, the Premiere decides to hang when I try to close it after playing this master timeline, so I'm finding that I can inch my way through this project by (1) launching premiere, (2) playing the master sequence, (3) make the edits I need, (4) forcibly crash Premiere, and (5) relaunch Premiere and repeat.  It's a terrible way to work, but the project is so close to completion that I'm willing to suffer through it.
    As to issue 1, I've taken each offending clip, extending the audio track one or two frames in the beginning of each clip, and then use those frames to ramp the volume up from silent to 0db.  This seems to avoid the brief moment of distortion at the beginning.  Notably I did try your suggestion by going back to the original, source audio, but I was still getting the same issue.  My work-around is the only solution I've been able to come up with.

  • Problem with Facebook status blocking phone numbers in contact list

    Unlike a lot of users, I don't mind that my Facebook contacts merge with my other contacts.  However, I am having a problem with viewing all the information in some of the individual profiles.  It seems that whenever someone updates their FB status, the status posts where the phone number usually is.  The only way to view the phone info for these contacts is to "edit" the entry, then you can see the phone info.  Does anyone know if there is any way to eliminate the status update from the contact information?

    I don't mind seeing their updates, I don't even mind seeing the update on the individual contacts page.   I mind not being able to see the phone number field in my contacts list.  I have a friend that has the original Droid and he stated that the update is at the bottom of the screen, not the top covering the phone number.  Why is it that on a phone with so much "ability" that it has to put the Facebook status field over the phone number?

  • Problem with IE8 popup blocker and Windowless mode

    My team is having popup blocker issue, which is crippling our system where a large range of users are now complaining that their links or buttons will not open in IE7 or IE8 and results in the pop-up blocker message.
    Our Flash application's embed code needed wmode set to windowless ('opaque' or 'transparent') since we need to place floating HTML objects over the Flash application. But all links (within static text content) with target set to '_blank' or a custom name and also all navigateToURL() methods with the same target values are now resulting in IE pop-up blocker message once the window mode was changed to 'opaque' (same result also with 'transparent').
    We have a AS3 work around for the navigateToURL() method but no solutions for 100s of pages of simple HTML content contributed by users that have links as well as our own Flash static-text content with links.
    Here is a simple page created to demonstrate the issue - http://clients.projectmiso.net/photobiz/custom_lightbox/Test_File.html
    And the ActionScript 3 code -
    var clickFunction = function(){
        var targetURL:URLRequest = new URLRequest("http://www.yahoo.com");
        navigateToURL(targetURL, '_blank');
    btn1.addEventListener(MouseEvent.CLICK, clickFunction);

    Hi!
    One thing you could try is to use MOUSE_UP instead of CLICK
    ( tip-source : http://www.actionscript.org/forums/showthread.php3?t=176795 )
    This example uses clickTag parameter (through flashvars) instead of a hardcoded URL inside the flashfile though,
    but I'm sure you get the point:
    clickBtn.addEventListener(MouseEvent.MOUSE_UP, function(event: MouseEvent): void {
    var sURL: String;
    if ((sURL = root.loaderInfo.parameters.clickTag)) {
    navigateToURL(new URLRequest(sURL), "_blank");
    clickBtn.buttonMode = true;
    clickBtn.useHandCursor = true;
    Or you might want to have a look at this workaround :
    Example :  http://apdevblog.com/examples/navigatetourl/
    Info : http://apdevblog.com/problems-using-navigatetourl/
    /Ola

  • Problem with nesting repetitive groups, using PDF as template

    We are trying to use a pdf file (Acrobat 5.0) as a template for BI Publisher reports.
    Our report uses as a data source a xml file (facturas.xml) with data from several bills.
    In each bill, there are areas where multiple lines must be displayed. We use the tag BODY_START/BODY_END to define the area of repetition for the lines.
    The problem arises when we want to nest two or more BODY_START/BODY_END. In this case the fields are displayed outside the place where they were defined.
    We do not know the way to do it and the syntax for nesting repetitive groups.
    BI Publisher Version: Oracle BI Publisher 10.1.3.4.1
    Plattform: Windows 2003 R2 64 bits.
    Acrobat: Using Acrobat 5.0 file format.
    Editor: Adobe Acrobat 9, saving as 5.0 file format.

    I have found some solution whcih guide you to how to create links in PDF file. Follow this interesting PDF guide here.
    Video Guide of How To Create eBook using Adobe Acrobat.
    Hope it helps you.

  • Problems with Printing Large Blocks of Colour in InDesign CS 5.5

    I am hoping someone can help me. 
    I purchased InDesign CS 5.5 and Konica Konica Magicolor 7450ll Printer for my business. Essentially I am creating A4 sheets with a background colour with three or four lines of white text.  I was advised that InDesign was the best tool for this type of work.
    I seem to be able to create brilliantly flat colours when using the inbuilt CMYK swatches, however if I attempt to create a new swatch or even fade an inbuilt swatch the print is not flat, it is patchy and very poor quality.
    I raised the issue with Konica, and they have stated that it is an InDesign fault? I am running Windows XP. They told me to do a search on InDesign/Windows conflicts but I have not been able to find any articles which address this problem.
    I have created a PDF and get the same problem, I copied the artwork into Photoshop and the print was much much better but still nowhere near the vibrancy of the inbuilt CMYK swatches.
    Can anyone assist me with this issue?
    Thanks in advance.
    Rach

    Hi Rach
    The standard swatches and any others you make yourself will print perfectly provided the device is up to the job.
    I'm not familiar with the printer you have there (although it looks very nice!) but I've never come across a laser printer that copes well with large areas of solid colour with any reliability, sorry.
    This may help to illustrate what I think you need to see. If you want to see the information (graphically) that InDesign will send to the printer then have a look at the separations preview. Turn on/off the individual separations to see the CMYK channels it will generate. if you can find patches there, then InDesign is at fault, if not, it is your printer and you need to tell Konica specifically that you're trying to print large solids.
    Hope that helps.

  • Problem with Safari being blocked by ***.a2ztech.us

    Safari is blocked, getting msg:
    ***.a2ztech.us
    Warning !
    Your email account has been temporary suspended due to suspicious activity. This may be due to infections on your computer.
    Please call 0800-610-1013 for immediate support!
    Tried to reset Safari and the reset is blocked too.
    Do not know how to get it back working.
    Thank you for help!
    <Link Edited By Host>

    The only infection you have is the scam site trying to fleece you out of hundreds of dollars to fix a non-existent problem.
    Press Command+Option+Esc
    Highlight Safari and choose Force Quit. Close the box.
    Hold down the Shift key and relaunch Safari. That tells it not to reload any pages from the last session.

  • Problem with a initialization block for a repository variable

    This is a very strange problem, some queryies which are issued on behalf of a Repository Variable give a succesfull completion but with 0 rows selected where it should select 1 row.
    I have a query like this
    select var1, var2, var3, var4 from table1
    where var1 = (select max(var1) from table2);
    When i test the query it gives nicely a result 1 row and the repository variables are filled correctly. The initialization block has a schedule so it will run once an hour.
    In the logfile I can see that the query is fired on behalf of my repository variable with a result of 0 rows.
    I thougt i could work around the problem by puttting the query in a view, import this view in my physical layer and do a simpel select var1, var2, var3, var4 from view in the initialization block.
    This still had the same result, testing it works fine I get nicely one record, when it is fired as a result of a schedule it gets a result of 0 rows selected.
    I've tried the query in different formats, the query that i started with was this (see below). When that didn't work i started testing with simplere query's like above
    select var1, var2, var3 , var4 from (
         select var1
         from table2
         where type='x'
    and datum = (select max(var1) from table2 where type='x')
    ) join table2 using (var1)
    Other init blocks work fine. Those init block differ from the one with the problem, they have no join between two tables. The only join I have in one of the working blocks is a join with something from dual.
    The other point is, this init block did work on a previous version of obiee, but after an upgrade it doesn't work anymore.
    The OBIEE version is 10.1.3.4.1.090414.1900
    The database is version 10.2.0.1.0
    I was able to test it myself on a 10.2 database with a 10.1.3.4.0 obiee there it worked fine. Also with 10.1.3.4.1 with a 11g database and that worked ok to.
    Has anybody else stumbeled on this problem and how can i solve it. Also workarounds are welcome. Preferably not changing to a session variable cause in that case i have to change all the reports that use this variable.
    Kind regards,
    Yvon

    Have your DBA put a trace on your OBIEE sessions to see what SQL is OBIEE firing and to confirm the rows do exist. Are you sure this data is always there?

  • Center the DIV content with nested display: block float Left

    I have a series of images that use a Spry fade effect as a slide show.
    It works OK but the images are all jammed up into the top left corner
    even when i put them in a table. I have attached the body code below.
    Can anyone please help solve this poblem?
    Thank you kindly.
    <table width="800" border="0" align="center">
      <tr>
        <td> <div class="quote" style="position: relative; top: 0px; left: 0px; opacity: 0; display: none; visibility: visible;"> <img height="600" width="800" src="/uploads/images/_009a.jpg" alt="" /> </div>
    <div class="quote" style="position: relative; top: 0px; left: 0px; opacity: 1; display: block; visibility: visible;"> <img height="600" width="800" src="/uploads/images/_010a.jpg" alt="" /></div>
    <div class="quote" style="position: relative; top: 0px; left: 0px; opacity: 0; display: block; visibility: visible;"><span class="quote" style="position: relative; top: 0px; left: 0px; opacity: 0; display: block; visibility: visible;"><img height="600" width="800" src="/uploads/images/_047a.jpg" alt="" /></span></div>
    <div class="quote" style="position: relative; top: 0px; left: 0px; opacity: 0; display: none; visibility: visible;"> <img height="600" width="800" src="/uploads/images/_056a.jpg" alt="" /></div></td>
      </tr>
    </table>

    Please refer to the link: http://www.adobe.com/devnet/dreamweaver/articles/first_website_pt3.html
    Styling the images with captions
    To keep the image and caption together and center them, you need to give the <figure> element a width. You'll also add a CSS drop shadow effect to the image to make it look more like a photograph.
    Styling the <figure> and <figcaption> elements
    The small images in the home page and sightseeing.html are all 400 pixels wide. To create the photo effect, you need to add another 20 pixels to the width of the <figure> element.
    Make sure main.css is selected in the Sources pane, and create a new selector called figure.
    In the Layout section, set width to 420px.
    Create a selector for figcaption.
    Before you can center the caption, you need to set its display property (in the Layout section) to block.
    In the Text section, set the following properties:
    font-weight: bold
    font-size: 14px
    text-align: center
    Step 4 above is my problem. How can I set its display property (in the layout Section) to block?

  • Problems with pop up blocker

    My husband bought me a notebook for my birthday this year.  I haven't really had the opportunity to use it because everytime I would get on the internet,  I would be interrupted by the same pop ups.  I put the pop up blocker on, but it never worked.  I've only used the computer 6 times.  Now I have a virus and my notebook won't even allow me to do anything.  I really need help.  Can someone please help me!!!!!!!!  I never even got a chance to download programs or really personalize it.  This sucks.  I'm in desperate need.  Any suggestions?

    I have the same problem and it's really frustating - although my main browser is Google Chrome, I use Firefox for all the RSS feeds that I subscribe to and sites that only have Firefox plug-ins. Will Mozilla FIrefox get this fixed with a newer version soon?

  • Problem with nested data not displaying

    I have created a dataset with a filter as follows:
    var dsCustomer = new
    Spry.Data.XMLDataSet("../xml/orderstatus111307.xml",
    "company/customers/custid",{useCache:false,loadInterval:9000});
    dsCustomer.setColumnType("daterun", "date");
    var myFilterFunc = function(dataSet, row, rowNumber)
    if (row['ds_RowID'] == 1)
    return row;
    return null;
    dsCustomer.filterData(myFilterFunc);
    and then created a nested dataset as follows:
    var dsOrderList = new Spry.Data.NestedXMLDataSet(dsCustomer,
    "orders");
    dsOrderList.setColumnType("duedate", "date");
    My repeat is set in a table as follows:
    <div id="OrderTable" spry:region="dsOrderList
    dsCustomer">
    <table cellspacing="0">
    <tr>
    <th spry:sort="orderno">Orderno</th>
    <th spry:sort="purchaseorder">Purchaseorder</th>
    <th spry:sort="duedate">Duedate</th>
    </tr>
    <tr spry:repeat="dsOrderList" spry:setrow="dsOrderList"
    spry:even="tdAlt" spry:hover="tdOver" spry:select="tdSelect">
    <td class="tdLeft">{orderno}</td>
    <td>{purchaseorder}</td>
    <td>{duedate}</td>
    </tr>
    </table>
    </div>
    For some reason I get the following error when I view it in a
    browser:
    Failed to retrieve data set (dsOrderList) for spry:repeat
    You can see the page here:
    http://apps.esc-online.com/mickelectric2/249000/index.html
    I am using Spry 1.6

    quote:
    Originally posted by:
    mokean
    Hi V1 Fusion...
    I am having the same problem. (Failed to retrieve data set
    (dsOrphans) for spry:repeat)
    What do you mean by; include SpryNestedXMLDataSet.js and u
    would be ready to go ;)
    I am creating a website for an orphanage in Africa.
    Thanks.
    He forgot to include the SpryNestedXMLDataSet.js in the
    header of the page, thats why it wasn't working.
    Do you have url where i can see your issue?

  • Problems with H&R Block software

    Using H&R Block Deluxe with State on my Mac has been a nightmare this year. I've used Block software for years with no problems, but this year has been a bear. I initially couldn't save/open my return using a CD I got from Office Depot. I got an error message: "string ID insertion failed." Customer Support indicated the program ws corrupted. I uninstalled Block and installed a download provided by Customer Support. I was able to complete both federal and state returns and successfully transmitted them. I got the message in my e-mail that both returns were accepted. My problem now is that when I go into the program and try to check the status, I get the same error message about an insertion error. I had saved my data in three different locations, including a flash drive, but I get the same error message when I try to open them. So, I have no acces to my 2014 digital return. My data is supposedly hopelessly lost, even though I backed it up just before filing.

    I've read that the automatic update of H&R Block for the Mac doesn't work properly and could give the kind of problem you're describing.
    The solution has been to get the Federal and State update files manually and install them manually. The Federal update is here, and the State update is here. Note that Block seems to release Mac updates using those links later than they release them for auto update.
    Also note that with the update process, the updater scans every attached drive and Time Machine and seems to be interested in updating every instance, including every appearance of the software in the Time Machine file.

Maybe you are looking for