G'day all
This has driven me bonkers. I've spent all afternoon trying to convert the path into the resource folder on an application, and all I get is an error message, 'Can't make ≪class ocid≫ id ≪data kptr40452101≫ into type string'.
I'm trying to put a password into the resource folder in the App. made with ApplescriptObjC.
The part of the script is
on SecurePasswordEntry_(sender)
set ThePassword to SecurePassword's stringValue() as text
if ThePassword ≠ "" then
set ptsf to current application's NSBundle's mainBundle()'s resourcePath() as text
display dialog ptsf
set pathToFile to POSIX file ptsf -- error occurs here
try
display dialog pathToFile
on error errmsg
display dialog errmsg
end try
set tester to false
try
Any help appreciated, thanks.
Regards
Santa
And what, you ask, was the beginning of it all?
And it is this......
Existence that multiplied itself
For sheer delight of being
And plunged with numberless trillions of forms
So that it might
find
itself
innumerably
Sri Aurobindo
On 10/07/2010, at 6:16 PM, Mark Schonewille wrote:
> Hi,
>
> Use
>
> set myPath to POSIX path of myPath
>
> to create a unix path and
>
> set myFile to POSIX file myPath as alias
>
> to create an AS path.
>
> --
> Best regards,
>
> Mark Schonewille
>
Thanks Mark, but adding 'as alias' only froze the script completely. Even ensuring the path was a true unix path made no difference.
I tried t his, with the same error message....
on SecurePasswordEntry_(sender)
set ThePassword to SecurePassword's stringValue() as text
if ThePassword ≠ "" then
set ptsf to current application's NSBundle's mainBundle()'s resourcePath() as text
set tempPath to POSIX path of ptsf
display dialog tempPath
say 4
set pathToFile to POSIX file tempPath
try
say 3
display dialog pathToFile
on error errmsg
display dialog errmsg
end try
And what, you ask, was the beginning of it all?
And it is this......
Existence that multiplied itself
For sheer delight of being
And plunged with numberless trillions of forms
So that it might
find
itself
innumerably
Sri Aurobindo
For some reason can't use "POSIX file" in a specifier -- you have to coerce:
set hfsPath to (((POSIXPath as text) as POSIX file) as text)
--
_______________________________________________
___________________________________________________
Posted on the AppleScript-Studio mailing list. Go to http://lists.apple.com/mailman/listinfo/applescript-studio to subscribe.
Thanks again Shane.
I never would have worked that out.
Regards
Santa
On 10/07/2010, at 9:55 PM, Shane Stanley wrote:
> For some reason can't use "POSIX file" in a specifier -- you have to coerce:
>
> set hfsPath to (((POSIXPath as text) as POSIX file) as text)
>
>
> --
>
>
>
> _______________________________________________
___________________________________________________
Posted on the AppleScript-Studio mailing list. Go to http://lists.apple.com/mailman/listinfo/applescript-studio to subscribe.