trying to create a folder on desktop

Hello,
I am trying to write a script that will create a folder called Babs JPEG Folder on my desktop, if it doesn’t exist…
This is what I have so far, but it doesn’t create the folder. It is part of a bigger project I am trying to figure out, one step at a time.

Can someone look at this and tell me what I am doing wrong?

property Babs_jpeg : "Babs JPEG Folder"
global deskPath2
global PathToFolder
global PathToFolder3
global temppdfs


on open thefiles
	tell application "Finder"
		activate
		set temppdfs to (every item of (get selection)) -- MUST GET BEFORE MAKING FOLDERS
		if not (exists folder Babs_jpeg) then make new folder with properties {name:Babs_jpeg}
		set deskPath to desktop as text
		
		
		set PathToFolder to POSIX path of (deskPath & Babs_jpeg)
		set PathToFolder3 to deskPath2 & Babs_Folder & ":"
	end tell
	my openfiles()
	say "Finished"
end open

thanks
babs

Hi,

the syntax to create the folder on desktop is absolutely correct and works

But the script
¢ doesn’t consider the dropped files
¢ doesn’t define the variable deskPath2
¢ mixes up HFS and POSIX paths

Hi Stefen!!!

I actually just got this far…and it makes the folder :wink:
Now I am trying to get Acrobat to open the PDF’s and save as jpegs.
I am plugging away here…

property Babs_jpeg : "Babs JPEG Folder"
global deskPath
global PathToFolder
global PathToFolder3
global temppdfs


on open thefiles
	tell application "Finder"
		activate
		set temppdfs to (every item of (get selection)) -- MUST GET BEFORE MAKING FOLDERS
		if not (exists folder Babs_jpeg) then make new folder with properties {name:Babs_jpeg}
		set deskPath to desktop as text
		
		
		set PathToFolder to POSIX path of (deskPath & Babs_jpeg)
		set PathToFolder3 to deskPath & Babs_jpeg & ":"
	end tell
	my openfiles()
	tell application "Adobe Acrobat Professional"
		activate
	end tell
	say "Finished"
end open

why don’t you use Martin’s script in Code Exchange ? it’s probably more comfortable and faster than Acrobat.

PS: If you still keep on misspelling my name I won’t respond any more ;):wink:

Dear Stefan!!! forgive me…I am not worthy of your services ;-(

I probably will end up using that one. It’s really cool, especially how it asks you for the resolution :wink:

I am just trying to string the two scripts into one process…it’s a good practice project for me, but that will work just fine!!

Thank you Stefan Stefan Stefan and Sir Stefan :wink:

HI Stefan!

Oh-I know why I can’t use that script as is…Right now, it saves the jpegs in the same folder and adds a “-0” , actually a sequential number based on the number of pages in the pdf file…My PDF’s would always be single page adds., and I want them to go into the “Babs jpeg folder” on the desktop, not add anything to the name. Also, being able to drag the entire folder onto that droplet, rather than, have to open it up and select the files, would also be a plus…

So, I will keep looking at that one and try to modify…

Thank you!!!
babs

as mentioned above, the on open handler is triggered when files are dropped onto its icon.
To process the selected files use the on run handler.
This is an example to use run and open handler in one script


on run
	tell application "Finder" to set theSelection to (get selection)
	processFiles(theSelection)
end run

on open theItems
	repeat with oneItem in theItems
		tell application "Finder"
			if class of oneItem is folder then
				set theFiles to files of oneItem
				my processFiles(theFiles)
			end if
		end tell
	end repeat
end open


on processFiles(allFiles)
	repeat with aFile in allFiles
		-- do something
	end repeat
end processFiles