Finder got an error: Can’t get folder err -1728

tell application "Finder"
	if exists POSIX file "/Applications/firefox.app" then
		set t to POSIX path of (path to applications folder) & "Firefox.app"
		do shell script "rm -R " & quoted form of t
		
		set spath_Firefox to do shell script "echo ~/Library/Application Support/Firefox"
		set ppath_Firefox to POSIX path of spath_Firefox
		set spath_Mozilla to do shell script "echo ~/Library/Application Support/Mozilla"
		set ppath_Mozilla to POSIX path of spath_Mozilla
		tell application "Finder"
			activate
			delete (every item of folder ppath_Mozilla)
			delete (every item of folder ppath_Firefox)
		end tell
	end if
end tell

Hi,

too much confusion with echo and POSIX paths, try this


set fireFoxPath to (path to applications folder as text) & "Firefox.app"
set applicationSupportFolder to (path to application support folder from user domain as text)
tell application "Finder"
	if exists file fireFoxPath then
		do shell script "rm -R " & quoted form of POSIX path of fireFoxPath
		delete (every item of folder (applicationSupportFolder & "Mozilla:"))
		delete (every item of folder (applicationSupportFolder & "Firefox:"))
	end if
end tell

it is still going in if loop and not getting "do shell script “rm -R " & quoted form of POSIX path of fireFoxPath”
if he is not getting above path then not going in else loop

logic is simple if firefox 3.0.11 is exsist in app folder then close it , delete it and install from web path
or
if firefox 3.0.11 is not exsist at all , install from web path

err:Finder got an error: rm: /Applications/Firefox.app: No such file or directory

--Remove Firefox icon from Dock
--Remove Firefox application from Application Folder
--Empty folder AdWatchEX,Mozilla,Firefox
--Reinstall Firefox 3.0.11 from safari browser
--Script done by himanshuk@affinityexpress.com
--enable GUI to remove icon from dock
--GUIScripting_status()
enable_GUI_scripting()
delay 3.0
--remove icon from dock
RemoveIcon()
--remove application from application folder
Deleter()
delay 1.0
--delete folders mozilla, Firefix and profiles
on RemoveIcon()
	--tell application "XPInstall" to quit
	--delay 0.5 -- adjust if necessary
	tell application "System Events" to tell UI element "Firefox" of list 1 of process "Dock"
		if not (exists) then return
		perform action "AXShowMenu"
		click menu item "quit" of menu 1
		--click menu item "Options" of menu 1
		--click menu item "Remove from Dock" of menu 1 of menu item "Options" of menu 1
	end tell
end RemoveIcon
--Deleter()
--/Volumes/Firefox 1/Firefox.app
on Deleter()
	set msg to "no"
	set fireFoxPath to (path to applications folder as text) & "Firefox.app"
	set applicationSupportFolder to (path to application support folder from user domain as text)
	tell application "Finder"
		--tell application "Finder"
		if exists file fireFoxPath then
			do shell script "rm -R " & quoted form of POSIX path of fireFoxPath
			delete (every item of folder (applicationSupportFolder & "Mozilla:"))
			delete (every item of folder (applicationSupportFolder & "Firefox:"))
			--end tell
		else
			set urlList to {"http://www.apple.com/startpage/", "http://mac.oldapps.com/firefox.php?old_firefox=54?download"}
			set numURLs to (count urlList)
			tell application "Safari"
				activate
				-- create all the tabs that are needed
				tell application "System Events"
					-- enter the url in the open window
					keystroke (item 1 of urlList)
					key code 36
					repeat with i from 2 to (numURLs)
						-- for each additional url, first create a tab
						tell process "Safari"
							click menu item "New Tab" of menu "File" of menu bar 1
						end tell
						-- now enter the url
						keystroke (item i of urlList)
						key code 36
					end repeat
				end tell
			end tell
		end if
	end tell
end Deleter

on enable_GUI_scripting()
	try
		if (system attribute "sysv") < 4138 then display dialog "This script requires the installation of Mac OS X 10.3 or higher." buttons {"Cancel"} default button 1 with icon 2
		tell application "System Events" to if not UI elements enabled then
			tell me
				activate
				display dialog "This script requires the built-in Graphic User Interface Scripting architecture of Mac OS X, which is currently disabled." & return & return & "Enable GUI Scripting now? (You may be asked to enter your password.)" buttons {"Cancel", "Enable"} default button 2 with icon 2
			end tell
			set UI elements enabled to true
			if not UI elements enabled then error number -128
		end if
		return "yes"
	on error
		return "no"
	end try
end enable_GUI_scripting

on GUIScripting_status()
	
	-- check to see if assistive devices is enabled
	tell application "System Events"
		set UI_enabled to UI elements enabled
	end tell
	if UI_enabled is false then
		tell application "System Preferences"
			activate
			set current pane to pane id "com.apple.preference.universalaccess"
			display dialog "This script utilizes the built-in Graphic User Interface Scripting architecture of Mac OS x which is currently disabled." & return & return & "You can activate GUI Scripting by selecting the checkbox \"Enable access for assistive devices\" in the Universal Access preference pane." with icon 1 buttons {"Please Enable access for assistive devices, do it manually"} default button 1
		end tell
	end if
end GUIScripting_status