Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

willfurnell

macrumors member
Original poster
Feb 24, 2011
44
0
Hello there!

I am having a slight problem with Applescript and my simple test Connect to an AFP Server application. It is very basic at the moment, but I hope to expand on it.

Whenever I try and input text into one of my textboxes, I get this error:

Code:
2012-03-03 16:32:38.391 Test[7460:707] *** -[WFAppDelegate buttonConnect:]: Finder got an error: «class RApw» doesn’t understand the stringValue message. (error -1708)

I don't have a clue how to solve this.

This error does not appear when I remove the following line from the code below:

Code:
set passWordValue to passWord's stringValue()

Code:
--
--  WFAppDelegate.applescript
--  Test
--
--  Created by Will Furnell on 02/03/2012.
--  Copyright (c) 2012 Will Furnell Virtual. All rights reserved.
--

script WFAppDelegate
	property parent : class "NSObject"
	
	on applicationWillFinishLaunching_(aNotification)
		-- Insert code here to initialize your application before any files are opened 
	end applicationWillFinishLaunching_

    
    property serverID : missing value
    property network_share1 : missing value
    property userName : missing value
    property passWord : missing value
        
    
    on buttonConnect_(sender)
        

        
        tell application "Finder"
            
            
            set serverIDValue to serverID's stringValue() 
            set userNameValue to userName's stringValue() 
            set passWordValue to passWord's stringValue()
            
            try
                set network_share1 to "afp://" & userNameValue & ":" & passWordValue & "@" & serverIDValue & "/Shared"
                if not (exists network_share1) then
                    mount volume network_share1
                    else
                    eject network_share1
                    mount volume network_share1
                end if
                on error
                display dialog "Could not conect to the server you specified. Did you enter your correct credentials? If in doubt, contact your system administrator." buttons "OK" default button "OK"
            end try
        end tell
            
        
    end buttonConnect_
    
    
	on applicationShouldTerminate_(sender)
		-- Insert code here to do any housekeeping before your application quits 
		return current application's NSTerminateNow
	end applicationShouldTerminate_

end script

Thanks in advance :)
 
Last edited:
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.