AppleScript Performance Difference from Finder to System Events

I've just made an interesting discovery. I have a folder that contains about 7000 other folders. When I use the code "tell application "Finder" to set folder_list to folders in folder base_folder" it takes a very long time to respond, about 40 seconds. When I use the code "tell application "System Events" to set folder_list to every folder of folder base_folder" to seems to produce the same result in only about 2 seconds. If I add the filtering criteria, like "whose name begins with search_name", the performance difference is even greater. Clearly I'll be using System Events from now on, but can anyone explain why there is such a large difference in performance? Is there anywhere I can find other performance tweaks like this?
Note, I'm using system 10.6.5, but there is no automator section in that forum.

It seems you're going in panic!
First of all run mainteinance , look for system updates if any, and take care of any block key pressed
on your keyboard.
Do not abuse of Force Quit it 'd destroy preference applications, if your itunes take 3h to import your library you can setup in Energy Saver panel some tunings to protect lcd.
I think 3h to import a music library is not normal, can you post some other info about?
What can of device you are copying from?
Did you import ,when you set up your new iMac , an user from your old mac?
Take a look also at spotlight corner, if there's a little point inside the glass icon , spotlight is indexing your drive/s , this is normal on the first system's run and this 'd slow mac performance.

Similar Messages

  • No response from Finder or System Preferences

    Today I bought a brand new iMac 20" 2.0ghz to replace my iBook G4 which was getting a bit old and have been using it for hours on end with no problems. Until just now. I have been trying to access the System Preferences panel to get my Front Row remote to work (it just doesn't do anything!) but whenever I try to access any of the settings besides the 'Dock' menu, it freezes up and I have to Force Quit out of System Preferences!
    I also cannot get any info on 'About This Mac' because clicking it does absolutely nothing. I have tried uninstalling the software for my tablet that I installed a few hours ago but it has made no difference.
    Could it be because I'm re-importing my iTunes library at the same time as trying to do this? The remote was working earlier, as were all of the System Preferences panels, and now it has just stopped. Everything else is running as normal. Any light someone can shed on this situation would be greatly appreciated! Thanks.

    It seems you're going in panic!
    First of all run mainteinance , look for system updates if any, and take care of any block key pressed
    on your keyboard.
    Do not abuse of Force Quit it 'd destroy preference applications, if your itunes take 3h to import your library you can setup in Energy Saver panel some tunings to protect lcd.
    I think 3h to import a music library is not normal, can you post some other info about?
    What can of device you are copying from?
    Did you import ,when you set up your new iMac , an user from your old mac?
    Take a look also at spotlight corner, if there's a little point inside the glass icon , spotlight is indexing your drive/s , this is normal on the first system's run and this 'd slow mac performance.

  • System Events keeps crashing

    First of all, forgive me if there is a more appropriate category for this to be posted in. I couldn't think of anything better suited to this exact issue.
    On every boot, OS X brings up a standard "Application quit unexpectedly" dialogue for System Events. I can simply close this and disregard it, and it does not affect operation in any way.
    However, just recently I have found that when I attempt to launch Adium, the open-source IM client, it hangs for a good deal of time and then brings up the same dialogue. Adium, in the end, is unable to start and must be forcefully terminated.
    I was wondering if there might be any relation between the two occurrences. I do not know exactly what System Events is responsible for, and if someone could enlighten me, perhaps I could go about fixing the annoyance at startup, and possibly the problem with Adium at the same time.
    Thanks in advance.
    Oh, another note: both problems started very recently, at least one of them around the time I updated to 10.4.11.

    You can certainly remove System Events from Login Items, and I suggest you do. It serves no useful purpose by being launched independently in that way. It will be 'called' (transparently) by an AppleScript (or something similar) as and when needed. The time penalty for it not already running will be indiscernible.
    However, sorry to tell you, but removing it as a login item is unlikely to make a scrap of difference to anything. Having System Events made to run in that way is unnecessary but should not be harmful in any way: it just runs consuming no CPU, only being used when 'called' by an app, and it is the app that is doing the calling that I would suspect. Did you also check /Library/StartupItems?
    There is the remote (very remote) possibility that System Events.app itself is corrupted. You can easily check that. Launch Script Editor (in /Applications/AppleScript), paste this line:
    tell app "System Events" to say "Hello Benjamin"
    Hit <Enter>. The line should format (the text will change its appearance) without error; then hit the 'Run' button. If, as I expect, that causes no error, you are condemned to carry on playing "hunt the app".
    Does the error message appear when you log into another account? (Create a temporary account if needed, and then delete it).

  • How do you disable cmd-p printing from finder?

    You can print directly from the finder by pressing command-P when a file is selected. I've pressed it inadvertently a few times when trying to open a file (command-O, adjacent to P).
    To me, this is a bad idea. There is no confirmation of any sort, it immediatley prints. I'm in an office with a default printer set, and if I didn't pay attention I might send something to the printer without realizing.
    I'd like to know how to disable this. Thanks.

    Thank you kindly Andy, for your correct suggestion. It lead me in the right direction.
    I've accidentally sent pages upon pages of programming to a printer and wasted so much paper cause I fat-fingered command+p instead of command+o . Also, when you quick print it closes what you choose to print, which is real convenient incase you blink and totally miss that you sent 43 pages of programming to print.
    For the longest time, I set my default printer to a print that didn't exist to avoid this accident, if that is any indication of how long I've battled this flaw. I too consider this issue to be a big oversite, ESPECIALLY for how eco-friendly Apple is because this oversite costs paper.
    HOW I REMOVED command+p FROM FINDER:
         Open System Preferences > click Keyboard > click Keyboard Shortcuts > click Application Shortcuts in the left panel > click the "+" button below the right panel > Select Finder as your Application: > set the menu title to exactly the case-sensative value of "Bring All to Front" > set Keyboard Shortcut to "command+p" by actually pressing the-command-key+p-key
    I tried setting the Keyboard Shortcut of command+p to "Open" but the command+o stopped working.
    _Acker Dawn Apple

  • AppleScript 10.9.0 System Events -10006  Update property list file item

    Have AppleScript that runs without error on Mountain Lion 10.8.5, but errors out on Mavericks  10.9.0.
    At end of script, property list items need to be updated and this is when error occurs.
    Put together a subset of the script, see below) that get the error
    Statement reads "set value of property list item "ArrayList001" to ArrayList001"
    Text of error:
         error "System Events got an error: 'xxx.plist' is not a property list file."
         number -10006 from contents of property list file "xxx05.plist"
    =============================================================================
    property myPListFile : "cbmck05.plist"
    property myPListFilePath : ""
    property constPreviousRunDay : "PreviousRunDay"
    on run
       set today to "Date01" as string
              set List001 to {}
              set List002 to {}
              set myPListFilePath to ""
              repeat with i from 1 to 8
                        set end of List001 to (i * 2) as string
              end repeat
              set myPListFilePath to path to desktop folder from user domain as string
              set fileMyPList to (myPListFilePath & myPListFile) as string
    clear_file(fileMyPList)
    -- First time! need to initalize
              tell application "System Events"
      -- create an empty property list dictionary item
                        set the parent_dictionary to make new property list item with properties {kind:record}
      -- create new property list file using the empty dictionary list item as contents
                        set new_plistfile to ¬
      make new property list file with properties {contents:parent_dictionary, name:fileMyPList}
      make new property list item at end of property list items of contents of new_plistfile ¬
      with properties {kind:string, name:constPreviousRunDay, value:today}
      make new property list item at end of property list items of contents of new_plistfile ¬
                                  with properties {kind:list, name:"ArrayList001"}
      make new property list item at end of property list items of contents of new_plistfile ¬
                                  with properties {kind:list, name:"ArrayList002"}
              end tell
              set previousRunDate to today
              set xxList to (repopulate_lists())
              set ArrayList001 to List001
              set ArrayList002 to List002
    -- save info in the plist file
              tell application "System Events"
                        tell property list file fileMyPList
                                  tell contents
                                            set value of property list item constPreviousRunDay to previousRunDate
                                            set value of property list item "ArrayList001" to ArrayList001     --   <<< ------- error caused by the statement
                                            set value of property list item "ArrayList002" to ArrayList002
                                  end tell
                        end tell
              end tell
    end run
    -- ==========================================
    on repopulate_lists()
              set newList to {}
              set List002 to {}
              repeat with i from 1 to 8
                        set end of newList to i as string
              end repeat
              set List001 to newList
              return List001
    end repopulate_lists
    -- ==========================================
    -- Does the file exist?
    on fileExists(f)
              try
      f as string as alias
                        return true
              on error errMsg number errNum
                        return false
              end try
    end fileExists
    -- Delete the  files if exist
    on clear_file(aFile)
              if fileExists(aFile) then
                        tell application "Finder"
                                  set resultObject to delete aFile
                        end tell
              end if
    end clear_file

    Here's an AppleScript handler that partially works around this bug (warning: it turns each list item into a string).
    on plistWrite(plistPath, plistItemName, plistItemValue)
      -- version 1.1, Daniel A. Shockley
      -- 1.1 - rough work-around for Mavericks bug where using a list for property list item value wipes out data
              if class of plistItemValue is class of {"a", "b"} and AppleScript version of (system info) as number ≥ 2.3 then
      -- Convert each list item into a string and escape it for the shell command:
      -- This will fail for any data types that AppleScript cannot coerce directly into a string.
                        set plistItemValue_forShell to ""
                        repeat with oneItem in plistItemValue
                                  set plistItemValue_forShell to plistItemValue_forShell & space & quoted form of (oneItem as string)
                        end repeat
                        set shellCommand to "defaults write " & quoted form of POSIX path of plistPath & space & plistItemName & space & "-array" & space & plistItemValue_forShell
      do shell script shellCommand
                        return true
              else -- handle normally, since we aren't dealing with Mavericks list bug:
                        tell application "System Events"
      -- create an empty property list dictionary item
                                  set the parent_dictionary to make new property list item with properties {kind:record}
                                  try
                                            set plistFile to property list file plistPath
                                  on error errMsg number errNum
                                            if errNum is -1728 then
                                                      set plistFile to make new property list file with properties {contents:parent_dictionary, name:plistPath}
                                            else
                                                      error errMsg number errNum
                                            end if
                                  end try
                                  tell plistFile
                                            try
                                                      tell property list item plistItemName
                                                                set value to plistItemValue
                                                      end tell
                                            on error errMsg number errNum
                                                      if errNum is -10006 then
      make new property list item at ¬
                                                                          end of property list items of contents of plistFile ¬
      with properties ¬
                                                                          {kind:class of plistItemValue, name:plistItemName, value:plistItemValue}
                                                      else
                                                                error errMsg number errNum
                                                      end if
                                            end try
                                  end tell
                                  return true
                        end tell
              end if
    end plistWrite

  • How can i hide a folder from finder using "Applescript" ?

    hi
    i saw somewhere here and downloaded an applescript file which i was able to hide a folder in finder. so that i can reach them using Terminal but i could not see them in finder.
    help !
    thanks !!!
    happy new year !!!

    Use the following:
    tell application "System Events"
    set visible of (choose folder with invisibles) to false
    end tell
    The Script Editor is in the /Applications/AppleScript/ folder.
    (27742)

  • Is there a performance difference between Automation Plug-ins and the scripting system?

    We currently have a tool that, through the scripting system, merges and hides layers by layer groups, exports them, and then moves to the next layer group.  There is some custom logic and channel merging that occasionally occurs in the merging of an individual layer group.  These operations are occuring through the scripting system (actually, through C# making direct function calls through Photoshop), and there are some images where these operations take ~30-40 minutes to complete on very large images.
    Is there a performance difference between doing the actions in this way as opposed to having these actions occur in an automation plug-in?
    Thanks,

    Thanks for the reply.    I ended up just benchmarking the current implementation that we are using (which goes through DOM from all indications, I wasn't the original author of the code) and found that accessing each layer was taking upwards of 300 ms.  I benchmarked iterating through the layers with PIUGetInfoByIndexIndex (in the Getter automation plug-in) and found that the first layer took ~300 ms, but the rest took ~1 ms.  With that information, I decided that it was worthwhile rewriting the functionality in an Automation plug-in.

  • Applescript: system events keystroke to background?

    Is there a way to make system events send a keystroke to an application that is in the background (already running no need for activation) without bringing it to the foreground?
    i've looked in several places and can't find a way to do this.

    Sending keystrokes is just imitating what a user can do/does on the keyboard. You can no more send a keystroke to an app via System Events that isn't the front and active application than you can type text into a window that is in the background.
    The only way to deal with apps that aren't active is to script them directly. If they're not applescript-able, consider whether you can do it with a bash or python script instead.

  • AppleScript: System Events - delete

    I've been trying to get System Events delete command to accept multiple files and no matter how I try to preset the files to the delete command I get an error.
    According to the dictionary entry for System Events - delete it would appear it should take multiple files:
    delete v : Delete disk item(s).
    delete disk item : The disk item(s) to be deleted.
    This is what I have
    tell application "System Events"
              set ss to every disk item in desktop folder whose name contains "Screen Shot" and name extension is "png"
      delete ss
    end tell
    And this is the log window
    tell application "System Events"
      get every disk item of desktop folder whose name contains "Screen Shot" and name extension = "png"
      --> {file "Mac OS Lion:Users:frank:Desktop:Screen Shot 2013-03-22 at 14.31.02 .png", file "Mac OS Lion:Users:frank:Desktop:Screen Shot 2013-03-22 at 14.31.17 .png"}
      delete {file "Mac OS Lion:Users:frank:Desktop:Screen Shot 2013-03-22 at 14.31.02 .png", file "Mac OS Lion:Users:frank:Desktop:Screen Shot 2013-03-22 at 14.31.17 .png"}
      --> error number -1700 from {file "Mac OS Lion:Users:frank:Desktop:Screen Shot 2013-03-22 at 14.31.02 .png", file "Mac OS Lion:Users:frank:Desktop:Screen Shot 2013-03-22 at 14.31.17 .png"} to reference
    Result:
    error "System Events got an error: Can’t make {file \"Mac OS Lion:Users:frank:Desktop:Screen Shot 2013-03-22 at 14.31.02 .png\", file \"Mac OS Lion:Users:frank:Desktop:Screen Shot 2013-03-22 at 14.31.17 .png\"} into type reference." number -1700 from {file "Mac OS Lion:Users:frank:Desktop:Screen Shot 2013-03-22 at 14.31.02 .png", file "Mac OS Lion:Users:frank:Desktop:Screen Shot 2013-03-22 at 14.31.17 .png"} to reference
    Now if I do
    delete item 1 of ss
    the file is deleted. Also if I do a repeat through the list I can delete each file.
    I've tried every which way I can thing of to play with the list to get multiple files to delete with no success. But I have to admit that file references still send me to the book to get it right.
    So what basic bit of AppleScript vodoo am I missing or is this one of those cases where the dictionary does not match the code?
    thanks

    The only way I've ever been able to get that to work is to do the delete immediately:
    tell application "System Events"
              delete (disk items of desktop folder whose name contains "Screen Shot" and name extension = "png")
    end tell
    it seems that when you store it into a variable, system events no longer accepts it.  The only reason I can think for this is that the scripting dictionary asks for a disk item rather than a list of disk items.  It's possible that editing the scriptSuite files to tell it to accept a list would solve the issue, but I've never experimented.

  • Not able to extract performance data from .ETL file using xperf commands. getting error "Events were lost in this trace. Data may be unreliable ..."

    Not able to extract  performance data from .ETL file using xperf commands.
    Xperf Commands:
    xperf –i C:\TempFolder\Test.etl -o C:\TempFolder\BootData.csv  –a process
    Getting following error after executing above command:
    "33288636 Events were lost
    in this trace. 
    Data may be unreliable
    This is usually caused
    by insufficient disk bandwidth for ETW lo
    gging.
    Please try increasing the minimum
    and maximum number of buffers
    and/or
                    the buffer size. 
    Doubling these values would be a good first at
    tempt.
    Please note, though, that
    this action increases the amount of me
    mory
                    reserved
    for ETW buffers, increasing memory pressure on your sce
    nario.
    See "xperf -help start"
    for the associated command line options."
    I changed page size file but its does not work for me.
    Any one have idea, how to solve this problem and extract ETL file data.

    I want to mention one point here. I have total 4 machines out of these 3 machines above
    commands working properly. Only one machine has this problem.<o:p></o:p>
    Hi,
    I consider that you can try to use xperf to collect the trace etl file and see if it can be extracted on this computer:
    Refer to following articles:
    start
    http://msdn.microsoft.com/en-us/library/windows/hardware/hh162977.aspx
    Using Xperf to take a Trace (updated)
    http://blogs.msdn.com/b/pigscanfly/archive/2008/02/16/using-xperf-to-take-a-trace.aspx
    Kate Li
    TechNet Community Support

  • How to find in R/3 System, which FI document is from which external system?

    Hi Moderator/ FICO Experts,
    How to find in R/3 System, which FI document is from which external system?
    In case of different Non-SAP external Systems posting the data to one R/3 System.
    Thanks
    Chandra

    Hi,
    That really depends on the interfaces that your external systems are using. Check with your ABAP or BASIS team to see what is the method used for posting those documents and with which parameters is passed. Look at BKPF table (FI header) to see the attributes such as user, document type, reference, etc.
    Regards,
    Eli

  • What are the best ways (for best performance) in MII to process the incoming process messages from shop floor systems to SAP ECC 6.0 and vice versa?

    Hi All,
    Can you please suggest to choose the best ways (for best performance) in MII (12.2 on NW 7.3), to process the incoming process messages from shop floor systems to SAP ECC 6.0 and vice versa?
    Thanks

    Hi Surya,
    Best practices for flow of data from ECC --> SAP MII --> Shop floor & Vice verse:
    1. Send ECC data through IDOC's/RFC's as messages to SAP MII message listener and BSL transaction process data and update directly on shop floor database as if you configured in Data services or later send those data by web service to shop floor system (i.e. depends on Shop floor machines).
    From Shop floor:
    shop floor --> SAP MII --> ECC
    1. Use either Web service or fetch data from DB and pass data to BAPI's  for sending to ECC through BLS transaction.
    Regards,
    Praveen Reddy

  • How can I compare a (partial) export folder from iPhoto to an event in iPhoto to find images not exported?

    How can I compare a (partial) export folder from iPhoto to an event in iPhoto to find images not exported?  Or better yet, how can I export selected events to a new iPhoto library or an existing iPhoto library with events, titles and keywords intact?

    Ask here:
    https://discussions.apple.com/community/ilife/iphoto

  • How to avoid system events "ignoring" lines in applescript?

    Hello!
    I am trying to write a very simple script that will trigger macros on another application, however when the script is executed, it skips a couple of lines which makes the whole process go erratically.
    This is the code i'm using:
    tell application "Adam"
      activate front window
    end tell
    tell application "System Events"
      keystroke "4"
              repeat 10 times
              end repeat
      keystroke return
      keystroke (ASCII character 47)
              keystroke "tell test"
      delay 1
      keystroke return
      keystroke (ASCII character 36)
      keystroke "t"
      keystroke (ASCII character 36)
      delay 2
      keystroke return
    end tell
    The red lines are the ones that seem to be neglected somehow (keystroke "4" doesnt carry the expected action in application "Adam"). I'm a newbie at applescripting but i fail to see why this might be happening
    Any help is of course greatly appreciated

    Hi Arthur!
    Tried your solution without much success, after some playing around i found out changing the command to use any other keystroke (e.g. - ) actually made the script work as intended, although it also implied changing the macro trigger (4 to - ) in application Adam.
    repeat 10 times
    keystroke "-"
    end repeat
    Lately I've been testing with other applications and found out this "ignore" behaviour happens mostly when you use numbers for keystrokes, perhaps there is al alternate way of inputting these?
    Thanks for your and everyone's help

  • How to update 1 Event Handler from different SAP systems?

    Hi experts.
    I created an Event Handler via SAP 4.7 Purchase Order.
    I now need to update this same Event Handler with a control parameter from SAP 6.0.
    I was surprised to see that when I updated the Purchase Order in 6.0, EM created a new Event Handler!
    Guess I'm missing something obvious...
    Thanks.
    Zenon.

    Hello Berthold, Steffen,
    Yes it's the same PO in 4.7 and 6.0.  We implemented (upgraded) the ERP system to 6.0.  The Event Handler was orginally created from 4.7, but now we need to update it from 6.0.
    So the Event Handler (tracking id, control parms, EE etc)  can only be updated from the logical system the Eh was created in (4.7), and I can only send Event Messages (Events) from 6.0.  Correct?
    Any thought about how to approach this situation and any future upgrades?  Maybe I need to write a conversion program...
    Thanks.
    Zenon.

Maybe you are looking for

  • Is ther any way to prevent implicit data typing in the block scriptd

    System build /autocode  implicitly define the type of variables that are not defined by the user in a block scripts based on  the value assigned to them. As an example, if there is no type definition for the variable A in a block script,  depending w

  • NOT SAVING CHANGES OR EDIT'S!!PLEASE HELP

    hey guys, i had this problem before along with many others, with the earlier vers of iphoto. until apple gave us the fix...now agin with 5.0.4.any changes or edits(redeye fix) are not saved to any of my pics!! is anybody else having this problem?? is

  • Master Encoder - Slave Axis Gearing (beginner's question)

    Hello In the documentation of this vi there is a sentance: "Note: The use of the term "rotations" here assumes that the encoders being used have the same number of counts per revolution." And what about situation when encoder 'A' (master) has 'X' enc

  • IPhone 3gs and Nike + iPhone

    Do I need to buy the whole starter kit for the iPhone 3gs or just the sensor?

  • WebcamSubscriber positioning and sizing

    I am using 2 WebcamSubcribers in a ConnectSessionContainer.  The first WebcamSubscriber seems to be positioned and sized correctly, then when I add another the size and position changes, and I'm not sure why.  The first image below is with one Webcam