• 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: Problematic AppleScript Advice needed!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problematic AppleScript Advice needed!


  • Subject: Re: Problematic AppleScript Advice needed!
  • From: Jake Pietrykowski <email@hidden>
  • Date: Tue, 21 Dec 2004 08:13:05 -0600

> Also on a second note :
>
> How do you convert a POSIX path to a Mac OS path? Yes, that's the question.
> The reverse of "POSIX path of" is what I am looking for.

Same thing...it works BOTH ways...

Just re-apply the POSIX path of to your variable...but then, you'll have to
add the HD name and remove the slashcolon prefix...that's just a workaround
I use if I need.

(The following is JUST an example, as I realize it isn't logical! I assume
Mr. Cline has other reasons for use! ;-)

<snip>
tell application "Finder"
 set theFiles to choose folder --Mac path
 set theFilesPOSIX to the POSIX path of theFiles --POSIX path
 set theFilesPOSIX to the POSIX path of theFilesPOSIX --Mac path
end tell
</snip>

HOWEVER...it adds a slash/colon: to the beginning of the new path...so I use
the following to remove it.

<snip>
set slashcolon to "/:"
if theFilesPOSIX begins with slashcolon then
 set theFilesPOSIX to text ((count slashcolon) + 1) thru -1 of theFilesPOSIX
end if

set theFilesPOSIX to "Macintosh HD:" & theFilesPOSIX --FULL Mac path
</snip>

Cheers,
Jake



> On 12/20/04 11:59 PM, "Steffan A. Cline" <email@hidden> wrote:

> I am trying to make a simple script to be used as part of an installer for
> MacOS X. The part in question works but it seems to be a bit lengthy though.
> Odd thing first off is some odd text that no one seems to understand. When
> the following script executes:
>
> __________________________________________________________
> #!/bin/bash
>
> INSTALL_PATH=`osascript -e "
> on getLassoHome()
>     set lassoHome to do shell script \"echo ~lasso\"
>     if lassoHome begins with \"/Volumes/\" then
>         set lassoHome to characters 10 thru -1 of lassoHome as text
>     else
>         tell application \"Finder\"
>             set volName to name of startup disk
>         end tell
>         set lassoHome to volName & lassoHome
>     end if
>     set lassoHome to replace_chars(lassoHome, \"/\", \":\")
>     return lassoHome
> end getLassoHome
>
> on replace_chars(this_text, search_string, replacement_string)
>     set AppleScript's text item delimiters to the search_string
>     set the item_list to every text item of this_text
>     set AppleScript's text item delimiters to the replacement_string
>     set this_text to the item_list as string
>     set AppleScript's text item delimiters to \"\"
>     return this_text
> end replace_chars
>
> set validAnswer to false
> set theFolder to alias (my getLassoHome() & \":LassoModules\")
> tell application \"Installer\"
>     activate
>     repeat until validAnswer
>         set theFolder to (choose folder with prompt \"Select the
> LassoModules folder where you want the tag installed:\" default location
> theFolder)
>         if the name of (info for theFolder) is \"LassoModules\" then
>             set validAnswer to true
>         else
>             display dialog \"The folder you have chosen is not named
> LassoModules!\" with icon caution buttons {\"Oops!\"}
>         end if
>     end repeat
> end tell
> return POSIX path of theFolder"`
>
> echo $INSTALL_PATH
>
> ________________________________________________________________
>
>
> I get some odd text :
>
> Last login: Mon Dec 20 19:54:23 on ttyp2
> Welcome to Darwin!
> Phat-G5:~ steffancline$ ./test
> ## Component Manager: attempting to find symbols in a component alias of
> type (regR/carP/x!bt)
> osascript[4281]: CWM: Loaded successfully.
> AE2000 (4281): Sending an event: ------oo start of event oo------ { 1 }
> 'aevt': ascr/gdut (ppc ){ return id: 280559616 (0x10b90000) transaction id:
> 0 (0x0) interaction level: 64 (0x40) reply required: 1 (0x1) remote: 0 (0x0)
> target: { 2 } 'psn ': 8 bytes { { 0x0, 0x2 } (osascript) } optional
> attributes: < empty record > event data: { 1 } 'aevt': - 0 items { } }
> ....
> { true } key 'ispk' - { 1 } 'bool': 1 bytes { false } key 'asty' - { 1 }
> 'TEXT': 4 bytes { " ------oo end of event oo------ /Applications/Lasso
> Professional 8/LassoModules/
> ...
>
>
>
> It goes on and on for hundreds of lines. What is this and why does it
> happen? The same script runs fine on my laptop and I get no such output. In
> my case the exact output should be :  "/Applications/Lasso Professional
> 8/LassoModules/". Are my applescript internal components hosed? Is a
> complete reinstall absolutely necessary?
>
> Also on a second note :
>
> How do you convert a POSIX path to a Mac OS path? Yes, that's the question.
> The reverse of "POSIX path of" is what I am looking for.
>
> ANY help is GREATLY appreciated.
>
>
> Thanks
>
> Steffan
>
> ---------------------------------------------------------------
> T E L  6 0 2 . 5 7 9 . 4 2 3 0 | F A X  6 0 2 . 9 7 1 . 1 6 9 4
> Steffan A. Cline
> email@hidden                             Phoenix, Az
> http://www.ExecuChoice.net                                  USA
> AIM : SteffanC          ICQ : 57234309
> The Executive's Choice in Lasso driven Internet Applications
>                                   Lasso Partner Alliance Member
> ---------------------------------------------------------------
>
>
>  _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Applescript-users mailing list      (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Problematic AppleScript Advice needed! (From: "Steffan A. Cline" <email@hidden>)

  • Prev by Date: Re: Satimage: non-greedy regexp matching?
  • Next by Date: Re: Problematic AppleScript Advice needed!
  • Previous by thread: Problematic AppleScript Advice needed!
  • Next by thread: Re: Problematic AppleScript Advice needed!
  • Index(es):
    • Date
    • Thread