• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Fast Way Of Crunching Through Files
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Fast Way Of Crunching Through Files


  • Subject: Re: Fast Way Of Crunching Through Files
  • From: 林鹏 <email@hidden>
  • Date: Mon, 02 Apr 2012 23:15:45 -0400

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

在 2012年4月2日,15:00,email@hidden 写道:

Send AppleScript-Users mailing list submissions to
   email@hidden

To 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@hidden

When 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: 1
Date: Sun, 01 Apr 2012 16:10:34 -0700
From: Joe <email@hidden>
To: Alex Zavatone <email@hidden>
Cc: Applescript Users List <email@hidden>
Subject: Re: Do shell script question - timeouts
Message-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 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/0587fc2f/attachment.html>

------------------------------

Message: 2
Date: Sun, 01 Apr 2012 20:50:43 -0400
From: Alex Zavatone <email@hidden>
To: Joe <email@hidden>
Cc: Applescript Users List <email@hidden>
Subject: Re: Do shell script question - timeouts
Message-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 iMac
20: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" iMac
20: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 MBP
20: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: 3
Date: Mon, 02 Apr 2012 20:20:39 +1200
From: Yuma Antoine Decaux <email@hidden>
To: AppleScript Users <email@hidden>
Subject: ichat on message received handler
Message-ID: <email@hidden">email@hidden>
Content-Type: text/plain; charset=us-ascii


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 ichat
Set 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 posvalue
Else
Copy "false" to end of posvalue
End if
End repeat
If every item of posvalue is "false"
Tell application "ichat"
Send an item of errmsg to thebuddy
End if
End tell
End message received

This 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 appreciated

Thanks, and best regards

Yuma


------------------------------

Message: 4
Date: Mon, 02 Apr 2012 12:19:12 +0000
From: email@hidden
To: Yuma Antoine Decaux <email@hidden>,
   applescript-users-bounces+zavpublic=email@hidden,
   AppleScript Users <email@hidden>
Subject: Re: ichat on message received handler
Message-ID:
   <email@hiddenberry>
   
Content-Type: text/plain

I 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 ichat
Set 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 posvalue
Else
Copy "false" to end of posvalue
End if
End repeat
If every item of posvalue is "false"
Tell application "ichat"
Send an item of errmsg to thebuddy
End if
End tell
End message received

This 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 appreciated

Thanks, 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-users

This email sent to email@hidden



------------------------------

_______________________________________________
AppleScript-Users mailing list
email@hidden
https://lists.apple.com/mailman/listinfo/applescript-users

End of AppleScript-Users Digest, Vol 9, Issue 143
*************************************************
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Follow-Ups:
    • Re: Fast Way Of Crunching Through Files
      • From: Alex Zavatone <email@hidden>
  • Prev by Date: Re: InDesign CS5.1 object styles
  • Next by Date: Re: Fast Way Of Crunching Through Files
  • Previous by thread: RE: InDesign CS5.1 object styles
  • Next by thread: Re: Fast Way Of Crunching Through Files
  • Index(es):
    • Date
    • Thread