A pair of oddities

Well, my app is coming together nicely. I’m doing everything I can since I want this one to be nice, as I’m hoping to release it.

Anywho…

--properties
property pspsstick : null
property bploc : {}
property makefold : bploc as string
--script
on clicked theObject
	if name of theObject is "pspsbrowse" then
		set disklist to list disks
		set pspsstick to (choose from list disklist as list with prompt "Choose your PSP Memory Stick")
		if pspsstick is false then return
		set the contents of text field "pspsloc" of tab view item "brtab" of tab view "tabwind" of window "PSPkit" to pspsstick as string
	else
		if name of theObject is "bpbrowse" then
			set bploc to (choose folder with prompt "Please select the folder to save your backup to")
			set the contents of text field "bploc" of tab view item "brtab" of tab view "tabwind" of window "PSPkit" to (POSIX path of bploc)
		else
			if name of theObject is "backupbut" then
				if bploc is not "PSP Backup" then
					tell application "Finder"
						set makefold to (make new folder at bploc with properties {name:"PSP Backup"}) as string
					end tell
				end if
				set psps2 to (pspsstick as string) as alias
				set bploc2 to (bploc as string) as alias
				duplicate every item of psps2 to makefold
			end if
		end if
	end if
end clicked

This is the script for one of my tabs in the app. In this case, the Memory Stick Backup and Restore tab.

The 2 oddities. First, when I select a folder (and a disk, of course :P), and click backup, even if the folder is called “PSP Backup”, it will still create a new folder with the name “PSP Backup”, even though it isn’t supposed to.

The second error comes after the makefold step. I’m pretty sure that it is on the duplicate line, though I’m not positive. Upon clicking backup, I get an error 'can’t make alias “psptest:” into type reference (-1700)". I’m not entirely sure what that error represents, but I can’t seem to find the problem myself by just poking around. Is there some oddity in AS Studio that I’m missing? If I recall, this particular method worked fine in plain Apple Script… (FYI- psptest is the name of the disk image I’m using, created using disk utility, so I don’t have to drain my PSP’s battery. It has the same file/folder structure as a PSP’s memory stick)

So basically, these are 2 errors that I’m not familliar with, and as far as I know, shouldn’t be happening, and am having no luck tracking down the source :stuck_out_tongue: Chances are, I made some stupid mistake in there. I am still pretty new to AS Studio/xcode, so I’m still getting used to the differences between it and applescript, but I’m liking it so far :slight_smile:

Thanks :slight_smile:
-Parrot

Just offhand, I’d say
1)You’re comparing a file reference to a string (bploc to “PSP backup”). Try name of bploc

2)This time you’re forcing makefold to a string, when it should be a reference. Then when you try to duplicate things to it, it will fail because it’s a string. Just because a file reference or path looks to you like a string doesn’t mean it’s a string to AppleScript.

Try those two things, see if they help.