Re: Fast Way Of Crunching Through Files
- Subject: Re: Fast Way Of Crunching Through Files
- From: Michelle Steiner <email@hidden>
On Oct 15, 2004, at 8:19 AM, Steve Suranie wrote:
I need to clean up files for our Digital Asset Management system. There's about 5000 files and some of them have names with space in them which is incompatible with some of the software used in our workflow. Is there a faster way than looping through each character of each file to see if it equals ASCII Number 32? Things are working fine but chugging slowly and I'd like to speed up the process. Any suggestions would be appreciated.
set l to {}
set f to choose folder
tell application "Finder"
repeat with x in (files of f as alias list)
if name of x contains space then
copy contents of x to end of l
end if
end repeat
end tell
l
-- Michelle
--
Never play strip Tarot. _______________________________________________
jimgreen8 Send AppleScript-Users mailing list submissions to
email@hiddenTo subscribe or unsubscribe via the World Wide Web, visit https://lists.apple.com/mailman/listinfo/applescript-users
or, via email, send a message with subject or body 'help' to email@hidden
You can reach the person managing the list at email@hiddenWhen replying, please edit your Subject line so it is more specific
than "Re: Contents of AppleScript-Users digest..."Today's Topics: 1. Re: Do shell script question - timeouts (Joe)
2. Re: Do shell script question - timeouts (Alex Zavatone) 3. ichat on message received handler (Yuma Antoine Decaux) 4. Re: ichat on message received handler (email@hidden)
----------------------------------------------------------------------Message: 1Date: Sun, 01 Apr 2012 16:10:34 -0700From: Joe <email@hidden>
To: Alex Zavatone <email@hidden>Cc: Applescript Users List <email@hidden>
Subject: Re: Do shell script question - timeoutsMessage-ID: <email@hidden">email@hidden>
Content-Type: text/plain; charset="windows-1252"Not certain if this helps…The link you provided led me to a comment here: http://www.macupdate.com/app/mac/13388/bonjour-browser
Quote: There is a command-line utility testing and reporting tool for multicast DNS in the current builds of both Tiger and Leopard. Called 'dns-sd' (with sd as shorthand for Service Discovery) it's a replacement for the less-informative mDNS command. dns-sd is meant for interactive service discovery, not for scripting (its API's, however, are listed in /usr/include/dns_sd.h.)
Obviously, 'man dns-sd' will explain it far better than I.This is from the man page OMM, 10.7.3:dns-sd(1) BSD General Commands Manual dns-sd(1)
NAME dns-sd -- Multicast DNS (mDNS) & DNS Service Discovery (DNS-SD) Test ToolSYNOPSIS dns-sd -R name type domain port [key=value ...]
dns-sd -B type domain dns-sd -L name type domainDESCRIPTION The dns-sd command is a network diagnostic tool, much like ping(8) or
traceroute(8). However, unlike those tools, most of its functionality is not implemented in the dns-sd executable itself, but in library code that is available to any application. The library API that dns-sd uses is
documented in /usr/include/dns_sd.h. The dns-sd command replaces the older mDNS(1) command. The dns-sd command is primarily intended for interactive use. <SNIP>
On Apr 1, 2012, at 11:48 AM, Alex Zavatone wrote:Here's the background email that I'm referencing with notes on mDNS
http://lists.apple.com/archives/applescript-users/2004/Oct/msg00465.html
-------------- next part --------------An HTML attachment was scrubbed...URL: <https://lists.apple.com/mailman/private/applescript-users/attachments/20120401/0587fc2f/attachment.html>
------------------------------Message: 2Date: Sun, 01 Apr 2012 20:50:43 -0400From: Alex Zavatone <email@hidden>
To: Joe <email@hidden>Cc: Applescript Users List <email@hidden>
Subject: Re: Do shell script question - timeoutsMessage-ID: <email@hidden">email@hidden>Content-Type: text/plain; charset="windows-1252"
Hmm. It appears they do the same thing, or close to it. Thanks.dns-sd -B _afpovertcp._tcp. local.mdns -B _afpovertcp._tcp. local.
But in the docs, it says this: The dns-sd command replaces the older mDNS(1) command.So, it's good that now I'll be using the most updated command. Thanks Joe.
Zavs-lil-iMac-2:~ zav$ dns-sd -B _afpovertcp._tcp. local.Browsing for _afpovertcp._tcp..local.Timestamp A/R Flags if Domain Service Type Instance Name
20:40:05.816 Add 3 8 local. _afpovertcp._tcp. Zav's lil iMac20:40:05.820 Add 3 9 local. _afpovertcp._tcp. Zav's lil iMac
20:40:05.820 Add 3 6 local. _afpovertcp._tcp. Zav's 27" iMac20:40:05.820 Add 3 6 local. _afpovertcp._tcp. Zav's lil iMac
20:40:05.820 Add 3 6 local. _afpovertcp._tcp. Zavatone's MBP20:40:05.820 Add 2 6 local. _afpovertcp._tcp. Development MBP 13
Notice how one machine has been added three times.What would be awesome is if I could get it iPods on bonjour as well. Of course, that leads me to Erica Sadun who has gotten bonjour on the iPhone/iPad.
http://ericasadun.com/ftp/Erica Utilities for iPhone 2.0/Cheers.
On Apr 1, 2012, at 7:10 PM, Joe wrote:Not certain if this helps…
The link you provided led me to a comment here: http://www.macupdate.com/app/mac/13388/bonjour-browser
Quote:
Obviously, 'man dns-sd' will explain it far better than I.
This is from the man page OMM, 10.7.3:
dns-sd(1) BSD General Commands Manual dns-sd(1)
NAME
dns-sd -- Multicast DNS (mDNS) & DNS Service Discovery (DNS-SD) Test Tool
SYNOPSIS
dns-sd -R name type domain port [key=value ...]
dns-sd -B type domain
dns-sd -L name type domain
DESCRIPTION
The dns-sd command is a network diagnostic tool, much like ping(8) or
traceroute(8). However, unlike those tools, most of its functionality is
not implemented in the dns-sd executable itself, but in library code that
is available to any application. The library API that dns-sd uses is
documented in /usr/include/dns_sd.h. The dns-sd command replaces the
older mDNS(1) command.
The dns-sd command is primarily intended for interactive use. <SNIP>
On Apr 1, 2012, at 11:48 AM, Alex Zavatone wrote:
Here's the background email that I'm referencing with notes on mDNS
http://lists.apple.com/archives/applescript-users/2004/Oct/msg00465.html
-------------- next part --------------An HTML attachment was scrubbed...URL: <https://lists.apple.com/mailman/private/applescript-users/attachments/20120401/94277a9d/attachment.html>
------------------------------Message: 3Date: Mon, 02 Apr 2012 20:20:39 +1200From: Yuma Antoine Decaux <email@hidden>
To: AppleScript Users <email@hidden>Subject: ichat on message received handlerMessage-ID: <email@hidden">email@hidden>
Content-Type: text/plain; charset=us-asciiHi all,I've been working on this for a while, writing code then erasing it all and writing again, checking the net for other examples, but can't get around it, or maybe i'm not sure how exactly on handlers work yet.
I've tried the handler example on a script which monitors my ichat and upon reception of a message, takes the content of the message, compares it with a list i have, then plots a chart and sends back to the sender.
I've figured out everything for plotting the chart with smilelab's graph maker, as well as a workaround for dragging and dropping generated image into the ichat window and sending it with a keycode 36 ui command.
However, i'm still stuck at the ichat "message received" handler.Here's what i wrote:Set thebuddy to buddy id "blahblah"
Set curpair to {"eu", "gu", "au", "nu"}Set posvalue to ()Set errmsg to {"syntax error, unrecognized currency pair", "unknown pair, please try eu, gu, au or nu"}
On message received from thebuddy For ichatSet thetext to message received Repeat with i from 1 to count of curpair If thetext is item i of curpair--Tell block for plotting graph (didn't include it here)--
--tell block for sending created image in ichat back to sender (didn't include either)--Copy "true" to end of posvalueElse Copy "false" to end of posvalue
End ifEnd repeatIf every item of posvalue is "false"Tell application "ichat"Send an item of errmsg to thebuddyEnd if
End tellEnd message receivedThis has several problems, mainly that buddy id works for sending, but not for using as a variable, but that's just a restriction i have for 1 buddy.
However, is the syntax for the on handler correct?Any help greatly appreciatedThanks, and best regards
Yuma ------------------------------Message: 4Date: Mon, 02 Apr 2012 12:19:12 +0000From: email@hidden
To: Yuma Antoine Decaux <email@hidden>, applescript-users-bounces+zavpublic=email@hidden,
AppleScript Users <email@hidden>Subject: Re: ichat on message received handlerMessage-ID:
<email@hiddenberry>
Content-Type: text/plainI have something. Will send soon.Sent from my Verizon Wireless BlackBerry-----Original Message-----
From: Yuma Antoine Decaux <email@hidden>Sender: applescript-users-bounces+zavpublic=email@hiddente: Mon, 02 Apr 2012 20:20:39
To: AppleScript Users<email@hidden>Subject: ichat on message received handler
Hi all,I've been working on this for a while, writing code then erasing it all and writing again, checking the net for other examples, but can't get around it, or maybe i'm not sure how exactly on handlers work yet.
I've tried the handler example on a script which monitors my ichat and upon reception of a message, takes the content of the message, compares it with a list i have, then plots a chart and sends back to the sender.
I've figured out everything for plotting the chart with smilelab's graph maker, as well as a workaround for dragging and dropping generated image into the ichat window and sending it with a keycode 36 ui command.
However, i'm still stuck at the ichat "message received" handler.Here's what i wrote:Set thebuddy to buddy id "blahblah"
Set curpair to {"eu", "gu", "au", "nu"}Set posvalue to ()Set errmsg to {"syntax error, unrecognized currency pair", "unknown pair, please try eu, gu, au or nu"}
On message received from thebuddy For ichatSet thetext to message received Repeat with i from 1 to count of curpair If thetext is item i of curpair--Tell block for plotting graph (didn't include it here)--
--tell block for sending created image in ichat back to sender (didn't include either)--Copy "true" to end of posvalueElse Copy "false" to end of posvalue
End ifEnd repeatIf every item of posvalue is "false"Tell application "ichat"Send an item of errmsg to thebuddyEnd if
End tellEnd message receivedThis has several problems, mainly that buddy id works for sending, but not for using as a variable, but that's just a restriction i have for 1 buddy.
However, is the syntax for the on handler correct?Any help greatly appreciatedThanks, and best regards
Yuma _______________________________________________Do not post admin requests to the list. They will be ignored.AppleScript-Users mailing list (email@hidden)
Archives: http://lists.apple.com/archives/applescript-usersThis email sent to email@hidden
------------------------------_______________________________________________AppleScript-Users mailing list
email@hiddenhttps://lists.apple.com/mailman/listinfo/applescript-users
End of AppleScript-Users Digest, Vol 9, Issue 143*************************************************
|