[TxMt] TextMate vs Applescript

pascal@g ymostudio at gmail.com
Thu Mar 20 09:50:31 UTC 2008


sorry to follow up only now, but I've been away.

the script works perfectly: THANK YOU.
thanks also for taking the time to comment each section: I am always  
eager to learn, and this helps.

finally, can I ask you what is this "mate" shell command you refer to?  
what are the benefits? and how to set it up?
--
cheers, Pascal



On 18/03/2008, at 11:34 PM, Dr. Drang wrote:

> On Mon, Mar 17, 2008 at 11:22 PM, pascal at g <ymostudio at gmail.com>  
> wrote:
>> I am having difficulties implementing your suggestions, not having  
>> enough
>> knowledge of the Applescript syntax; I mainly do html and css  
>> coding, and
>> have adapted a script to my needs.
>
> You've put my two lines after the wrong 'tell application "Finder"'. I
> should have been more explicit in my message--electrons are cheap.
> Here is a script that does what your script wants to do:
>
>    -- get the base folder
>    set theFolder to choose folder with prompt "Create/Choose Client
> Project folder"
>
>    -- get the Briefs subfolder, making it if it doesn't already exist
>    try
>        set briefFolder to ((theFolder as text) & "Brief") as alias
>    on error
>        tell application "Finder" to set briefFolder to (make new
> folder at theFolder with properties {name:"Brief"}) as alias
>    end try
>
>    -- ensure that a set of subfolders exists
>    try
>        get ((theFolder as text) & "Captures") as alias
>    on error
>        tell application "Finder" to make new folder at theFolder with
> properties {name:"Captures"}
>    end try
>    try
>        set processedFolder to ((theFolder as text) & "Processed") as  
> alias
>    on error
>        tell application "Finder" to set processedFolder to (make new
> folder at theFolder with properties {name:"Processed"}) as alias
>    end try
>    try
>        get ((processedFolder as text) & "Hi-Res Images") as alias
>    on error
>        tell application "Finder" to make new folder at
> processedFolder with properties {name:"Hi-Res Images"}
>    end try
>    try
>        get ((processedFolder as text) & "Low-Res Images") as alias
>    on error
>        tell application "Finder" to make new folder at
> processedFolder with properties {name:"Low-Res Images"}
>    end try
>    try
>        get ((theFolder as text) & "Trash") as alias
>    on error
>        tell application "Finder" to make new folder at theFolder with
> properties {name:"Trash"}
>    end try
>
>    -- make a new file in the Briefs subfolder and open it in TextMate
>    set briefDoc to (POSIX path of briefFolder) & "$.tasks"
>    do shell script ("touch " & briefDoc & "; open -a TextMate " &  
> briefDoc)
>
>
> This may be unnecessarily verbose, but the 'try/on error' clauses will
> allow it to work regardless of whether the subfolders already exist.
> Your script assumes that "Captures," "Processed," etc. do not exist
> and will fail if they do.
>
> I've also changed the shell script in the last line. Most people on
> this list will have the "mate" shell command available, but a newcomer
> may not.
>
> Hope this works for you.
>
> -- 
> Dr. Drang
>
> ______________________________________________________________________
> For new threads USE THIS: textmate at lists.macromates.com
> (threading gets destroyed and the universe will collapse if you don't)
> http://lists.macromates.com/mailman/listinfo/textmate




More information about the textmate mailing list