Hello,
I have been putting an interface on my applescript of about 200 lines and have been successful in having it run headless in XCode once loaded so all is well with the code at this point after some tweaking.
The app has the both a file’s path and it’s name hard coded as separate properties and I would like to add them as choices for the user in the interface but am having many challenges even after having read as much documentation as I could find. The app also has the same 2 properties for an application path and it’s name that the same issue would apply to. One I get this worked out the other should be the same solution.
Although I have bound the pathControl to both the IBOutlets and an IB Action as well as the app delegate to the pathControl instance in the window, I am only getting the file path as “file://localhost/Users/username/Desktop/my%20%folder/thefile.txt” and would like to see it as /Desktop/my folder/thefile.txt. Also I can’t seem to get the name of the file that the path is pointing to separately (thefile.txt). I have followed the tutorials and gleened some hints from them for this issue but still seem far from a solution.
I hope I am explaining this well, here is the code so far for this pathControl:
script AppDelegate
property parent : class "NSObject"
-- IB Outlets
property filepathControl : missing value
property apppathControl : missing value
property filePath : missing value
property myFile : missing value
--IB Actions
on setFilepathFromFilePathControl_(sender)
set filepath to filepathControl's stringValue()
set myFile to filepathControl's URL {}
end setFilepathFromFilePathControl_
Once run, setting the path in the interface I get “file://localhost/Users/username/Desktop/my%20%folder/thefile.txt” for the filePath property but nothing for the myFile property.
Also I get this from the debugger console:
AppDelegate setFilepathFromFilePathControl:]: Can’t get «class url » {} of «class ocid» id «data kptr0000000060D0920002000000». (error -1728)
and this from Console’s system log:
Can’t get «class url » {} of «class ocid» id «data kptr0000000060D0920002000000». (error -1728)
I am very new to ApplescriptOBJC, no Studio experience, but have been using Applescript for years. Looking forward to taking the next step.
Thanks again for any assistance.