Some problems with my scripts

Hey all,
Im new to this forum ive been using it for a couple days to answer most of my questions but im running into a couple of problems.

  1. i have a browse button, that opens an open panel where they choose a file, next to a text field i want the text field to say that path when they open it. Here is the code i have right now:
		if theResult is 1 then
			-- Convert the list into a list of strings separated by return characters that we can put in the 'path names' text view
			-- For some unknown (as of yet) you must coerce the 'path names' to a list (even though it is defined as list).
			set the videoFile to (path names of open panel as list)
			set AppleScript's text item delimiters to return
			set the videoFile to videoFile as string
			set AppleScript's text item delimiters to ""
			set contents of text field "inputFile" of window "main" to videoFile as string

The error I am getting is: Can’t set window “main” to “/Volumes/Final Cut/Lars/On-Air Graphics.mov”. (-10006)

  1. I have a text box with a button and I want it so that if they hit the button it makes sure the text box was filled out. If it is set it as a variable. Here is what i have:
		if contents of text field "outputFileName" is "" then
			display dialog "Please enter a File Name!"
		else
			set fileName to contents of text field "outputFileName"
		end if

This is the error I am getting: Can’t get «class texF» “outputFileName”. (-1728)

  1. The last thing is that it runs a shell script when everything is filled out wich is just running a compressor command line which i get this error when i run it: No result was returned from some part of this expression. (-2763)
    I’m guessing this is because part of my other script isnt working.

Thanks a lot,
Lars

Hi,

it’s recommended to use string value instead of contents.
If your open panel doesn’t allow multiple selections you can use the singular version path name


if theResult is 1 then
	set string value of text field "inputFile" of window "main" to (path name of open panel)
end i

in the second snippet probably the reference to the target window is missing


set s to string value of text field "outputFileName" of window "main"
if s is "" then
	display dialog "Please enter a File Name!"
else
	set fileName to s
end if