Getting folders in a folder

Hey I’m wondering how to get some paths to folders in this folder

((path to home folder as Unicode text) & "Library:Application Support:DockX")

and if you can get it to only find folders with .dskin at the end

Hi,

something like this?


set DockXFolder to (path to application support from user domain as text) & "DockX:"
tell application "Finder" to set dskinFolders to folders of folder DockXFolder whose name ends with ".dskin"

I tried this and it is not working for me
how can i fix this

set applicationsupport to POSIX path of (path to application support from user domain as text) as POSIX file as alias
	tell application "Finder"
		if not (exists folder "DockX" of applicationsupport) then
			make new folder at applicationsupport with properties {name:"DockX"}
		end if
		set DockXFolder to (path to application support from user domain as text) & "DockX:"
		set dskinFolders to (folders of folder DockXFolder whose name ends with ".dskin") as POSIX file as list
	end tell
	repeat with i from 1 to the count of dskinFolders
		display dialog item i of dskinFolders
	end repeat

i get Can’t make {} into type «class psxf». (-1700)

Oh my god, this is a grave of coercions :wink:

set applicationsupport to POSIX path of (path to application support from user domain as text) as POSIX file as alias

you (try to) coerce an alias → text → POSIX path → POSIX file → alias

you want an alias, this is sufficient

set applicationsupport to path to application support from user domain

to get a string path

set applicationsupport to path to application support from user domain as text

or if you need a POSIX path

set applicationsupport to POSIX path of (path to application support from user domain)

try this


set applicationsupport to path to application support from user domain
tell application "Finder"
    if not (exists folder "DockX" of applicationsupport) then
        make new folder at applicationsupport with properties {name:"DockX"}
    end if
    set DockXFolder to (applicationsupport as text) & "DockX:"
    set dskinFolders to (folders of folder DockXFolder whose name ends with ".dskin")
end tell
repeat with i from 1 to the count of dskinFolders
    display dialog name of (info for (item i of dskinFolders as alias))
end repeat

Try something like this:

set appSupport to path to application support from user domain as Unicode text

tell application "Finder"
	try
		(appSupport & "DockX:") as alias
	on error
		make new folder at alias appSupport with properties {name:"DockX"}
	end try
	
	set dskinFolders to (folders of alias (appSupport & "DockX:") whose name ends with ".dskin") as alias list
end tell

Sorry I’m new to files and folders with applescript
And i found out that the finder treats the folders with an extension like files so i changed it from

set applicationsupport to path to application support from user domain
tell application "Finder"
	if not (exists folder "DockX" of applicationsupport) then
		make new folder at applicationsupport with properties {name:"DockX"}
	end if
	set DockXFolder to (applicationsupport as text) & "DockX:"
	set dskinFolders to (folders of folder DockXFolder whose name ends with ".dskin")
end tell
repeat with i from 1 to the count of dskinFolders
	display dialog name of (info for (item i of dskinFolders as alias))
end repeat

to

set applicationsupport to path to application support from user domain
tell application "Finder"
	if not (exists folder "DockX" of applicationsupport) then
		make new folder at applicationsupport with properties {name:"DockX"}
	end if
	set DockXFolder to (applicationsupport as text) & "DockX:"
	set dskinFolders to (files of folder DockXFolder whose name ends with ".dskin")
end tell
repeat with i from 1 to the count of dskinFolders
	display dialog name of (info for (item i of dskinFolders as alias))
end repeat

and it works thanks for your help