Problem with a shell script

i used shell scripts for the first time and i got an uninteligeble error

on clicked theObject
	set the_name to result of (display dialog "Name the invisible folder what?" default answer "" buttons {"Make"})
	do shell script "cd desktop"
	do shell script "mkdir ." & the_name
end clicked

and i get a similar error when i try to open the hidden folders with this script

on clicked theObject
	set open_name to result of (display dialog "what is te name of the hidden folder you wish to open?" buttons {"Open"} default button 1)
	do shell script "cd desktop"
		do shell script "open ." & open_name
	on error
		display dialog �
			"That folder doesnt exist!"
	end try
end clicked

A couple of things. First, you’re setting the_name to the result of display dialog which returns a record of the text and button returned (as well as gave up if appropriate) when what you really want is just the text returned. Second, when sending commands to a shell script, your commands are independent so changing the directory in one command has no bearing on subsequent commands. to get around this, you need to do it all in one with a semi-colon separating the commands. Finally, to change to the desktop, you should use the path “~/Desktop”. So, putting it all together:


[This script was automatically tagged for color coded syntax by Convert Script to Markup Code]

thanks a bajillion

i changed your delete code

on clicked theObject
	set the_name to the text returned of (display dialog "Which Folder do you want to delete?" default answer "" buttons {"Delete"} default button 1)
	set the_button to the button returned of (display dialog "Are you sure you want to delete this folder? everything in it will be lost forever." buttons {"Delete", "Wait"} default button 1)
		if the_button = "Wait" then
			display dialog "Deletion Aborted!" buttons {"Good!"}
			exit repeat
		else if the_button = "Delete" then
			do shell script "cd ~/Desktop; rmdir ." & the_name
		end if
		exit repeat
	end repeat
end clicked