Resource not found?!

This is driving me insane :confused:

Can someone help me out here?

on clicked EnableIS
	global componentP
	set componentP to path to resource "iSight.component"
	set component to componentP as string
	set qt to "/Users/student/Library/Quicktime"
	tell application "Finder"
		if folder "Quicktime" of folder "Library" of folder "student" of folder "Users" of startup disk exists then
			do shell script "ditto " & quoted form of component & space & quoted form of qt
		else
			make new folder at folder "Library" of folder "student" of folder "Users" of startup disk with properties {name:"Quicktime"}
			do shell script "ditto " & quoted form of component & space & quoted form of qt
		end if
	end tell
end clicked

All it says is “mypathhere No such file or directory”

Welcome. :slight_smile:

That’s not a POSIX path.

Try something like this:

on clicked EnableIS
	set componentP to path to resource "iSight.component"
	set qtPath to quoted form of POSIX path of ((path to library folder from user domain as Unicode text) & "QuickTime:")
	
	do shell script "/bin/mkdir -p " & qtPath & "; " & "/usr/bin/ditto " & quoted form of POSIX path of componentP & " " & qtPath
end clicked

Thank you so much, it worked …With one minor problem

It seems to be copying the contents of iSight.component instead of the actual file

Wow, Nevermind, I was being dumb

I have bundle contents have one file “bm.html”, I want to copy paste this bundle content on desktop
getting error:error “Resource not found.” number -192


set fpath to (path to resource "bm.html")
set theText to read fpath
close access fpath
theText

Model: 10.6.6
AppleScript: 2.3
Browser: Firefox 3.0.11
Operating System: Mac OS X (10.6)

From Standard Additions dictionary:

Resources are in, and for use by, a bundle (a folder that does not look like folder, like .app or .plugin).
What’s your bundle?

As you can see in the above definition, the default is the script itself. If it’s not a bundle, or a bundle without resources, it fails.

my bundle is .app, bundle means at right hand side of applescripter editor, I drag my HTML file into it
and after running script I want to copy that file in desktop

running below .app reproduce blank file on desktop,
I have content in dragged file that are not reproduced on desktop

set blankPage to (((path to desktop) as string) & "oo.html")
--/Users/Admin/Desktop/121c.app/Contents/Resources/oo.html
try
	open for access file blankPage with write permission
----write ("<html><head><title></title></head><body></body></html>") to file blankPage as string	
	close access file blankPage
on error errorMessage
	log errorMessage
	try
		close access file blankPage
	end try
end try

The script will throw an error anyway because there is no open access line,
if the bm.html file exists in [application bundle]/Contents/Resources this will work

set fpath to (path to resource "bm.html")
set theText to read fpath
theText

for the script in the last post use this syntax


set blankPage to ((path to desktop as text) & "oo.html")
--/Users/Admin/Desktop/121c.app/Contents/Resources/oo.html
try
	set filePointer to open for access file blankPage with write permission
	set eof filePointer to 0
	write "<html><head><title></title></head><body></body></html>" to filePointer
	close access filePointer
on error errorMessage
	log errorMessage
	try
		close access file blankPage
	end try
end try

1.save as Script bundle RUN ONLY
2.save as Application RUN ONLY

It will run only when it is open on editor on other mac, otherwise not run in above option
I want to hide this bundle from end user

set pp to (path to resource "bm.html")
set ff to (path to resource "Install_Ad.dmg")
set thePlist to "/Users/Admin/Desktop/212.scptd/Contents/Resources/bm.html"
set thePlistff to "/Users/Admin/Desktop/212.scptd/Contents/Resources/Install_Ad.dmg"

set thePlistpp to POSIX file thePlist
set thePlistff to POSIX file thePlistff
tell application "System Events"
	tell application "Finder"
		copy file pp to desktop
		copy file ff to desktop
	end tell
end tell

How will he run the script when he cannot see it??

This part does absolutely nothing:

‘path to resource’ will return an alias, which you can use. No need to put in anything else to get at the resources.

‘copy’ does not exist in Finder (yet). If and when it becomes available it will not copy files in this way.
From Finder’s dictionary:

The verb you want is ‘duplicate’.

This is all you need:

set pp to (path to resource "bm.html")
set ff to (path to resource "Install_Ad.dmg")

tell application "Finder"
	duplicate pp to desktop
	duplicate ff to desktop
end tell

To read dictionaries type cmd-shift-L, and select from window that appears.