Monday, December 11, 2017

#1 2011-03-28 12:28:29 pm

airbuff
Member
Registered: 2008-10-01
Posts: 60

File...wasn´t found (-43)

Hi,
I use Xcode for Applescript the first time. I have pasted the code, which works fine in the Apple script editor, into xcode (3.2) and ran it, but it states the mentioned message: File...wasn´t found (-43)

Applescript:

set sc_folder to ":Library:Application Support:Native Instruments:Service Center" as alias

Thankful for any hints,
Andreas

Offline

 

#2 2011-03-28 12:34:37 pm

StefanK
Member
From:: St. Gallen, Switzerland
Registered: 2006-10-21
Posts: 11482
Website

Re: File...wasn´t found (-43)

Hi,

a common mistake: HFS paths start always with a disk name,
a leading colon is never a replacement for the startup volume like a leading slash in POSIX paths.

It's not necessary to specify the startup volume, just use a relative path

Applescript:


set sc_folder to (path to application support folder as text) & "Native Instruments:Service Center" as alias


regards

Stefan

Offline

 

#3 2011-03-28 12:47:59 pm

airbuff
Member
Registered: 2008-10-01
Posts: 60

Re: File...wasn´t found (-43)

Fast & Furious as always. It´s working fine in the AppleScript Editor though.

Big help, thank you Stefan!

Offline

 

#4 2011-03-29 09:16:57 am

airbuff
Member
Registered: 2008-10-01
Posts: 60

Re: File...wasn´t found (-43)

To fast hmm

It unfortunately still doesnt work. I have tried this:

Applescript:

set sc_folder to ((path to startup disk) as Unicode text) & ":Library:Application Support:Native Instruments:Service Center" as alias

Again it works fine in AppleScript Editor, but not in xcode.

This one doesn´t work also:

Applescript:

display dialog "Enter admin password:" default answer "" with hidden answer
   set admin_pass to text returned of result

Xcode spits out a fatal error, but it doesn´t give me an exact error or something like the events and results in the Editor. It´s the second line coursing the trouble. I had to find this out by trial and error.

The only reason for me to use xcode is a progress bar. I also like the used admin pass prompt with the inclided icons...

Do you have a hint for general xcode vs. editor issues to port code from the editor?

best,
a.

Offline

 

#5 2011-03-29 09:23:46 am

StefanK
Member
From:: St. Gallen, Switzerland
Registered: 2006-10-21
Posts: 11482
Website

Re: File...wasn´t found (-43)

airbuff wrote:

It unfortunately still doesnt work. I have tried this:

Applescript:

set sc_folder to ((path to startup disk) as Unicode text) & ":Library:Application Support:Native Instruments:Service Center" as alias

Again it works fine in AppleScript Editor, but not in xcode.


why not path to application support folder ?

Xcode has its own display dialog version without hidden answer parameter, it's described in the documentation. Use a secure text field instead


regards

Stefan

Offline

 

#6 2011-03-29 09:45:00 am

airbuff
Member
Registered: 2008-10-01
Posts: 60

Re: File...wasn´t found (-43)

why not path to application support folder ?


Because the script uses other pathes on the root directory later on, so I need to find a way to target those.

Offline

 

#7 2011-03-29 09:57:32 am

StefanK
Member
From:: St. Gallen, Switzerland
Registered: 2006-10-21
Posts: 11482
Website

Re: File...wasn´t found (-43)

This should work

Applescript:


set sc_folder to (path to startup disk as Unicode text) & "Library:Application Support:Native Instruments:Service Center" as alias

btw: it's not recommended to write user data into the root directory.


regards

Stefan

Offline

 

#8 2011-03-29 10:31:27 am

airbuff
Member
Registered: 2008-10-01
Posts: 60

Re: File...wasn´t found (-43)

Can´t make it. Always states:

File :Library:Application Support:Native Instruments:Service Center wasn´t found (-43)


I wonder it states "file", as it is a folder. Might be a hint?!

it's not recommended to write user data into the root directory.


I know, I don´t write anything. I have to read out a lot of plist files and list and analyse other existing directories. It´s a diagnostic tool I´m scripting. It´s already working fine in the editor, only: there is no progress bar and it takes pretty long, so I need one too keep users calm...

Offline

 

#9 2011-03-29 10:37:50 am

StefanK
Member
From:: St. Gallen, Switzerland
Registered: 2006-10-21
Posts: 11482
Website

Re: File...wasn´t found (-43)

airbuff wrote:

Can´t make it. Always states:

File :Library:Application Support:Native Instruments:Service Center wasn´t found (-43)


I wonder it states "file", as it is a folder. Might be a hint?!


a folder string path should have a colon at the end.
Is the line in any tell block which contains AppleScript Studio terminology?

If yes, put it out. Scripting Additions and Studio terminology sometimes clash in the same tell block


regards

Stefan

Offline

 

#10 2011-03-29 11:06:33 am

airbuff
Member
Registered: 2008-10-01
Posts: 60

Re: File...wasn´t found (-43)

Is the line in any tell block which contains AppleScript Studio terminology?


No. The only AppleScript Studio part I use is a window with a progress spinner.

This all looks very complicated. Maybe I try to start the actual program (made with the editor) from another studio made programm with a progress bar.

Thank you for your suggestions  Stefan.

Offline

 

#11 2011-03-29 01:56:26 pm

DJ Bazzie Wazzie
Member
From:: the Netherlands
Registered: 2004-10-20
Posts: 2726
Website

Re: File...wasn´t found (-43)

to let it work in script editor and xcode the most shortest answer to get the name of boot volume is

Applescript:

POSIX file "/" as string

EDIT:

then you don't need to start the appending string with a ":".

Last edited by DJ Bazzie Wazzie (2011-03-29 01:57:32 pm)

Offline

 

#12 2011-03-30 10:09:23 am

airbuff
Member
Registered: 2008-10-01
Posts: 60

Re: File...wasn´t found (-43)

Thi one worked. Thanx.

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)