Two problems, MacOS X and Text Edit Plus
Two problems, MacOS X and Text Edit Plus
- Subject: Two problems, MacOS X and Text Edit Plus
- From: Peter Mathiessen <email@hidden>
- Date: Mon, 15 Apr 2002 09:39:14 +0200
Hi all...again,
I still have some problems with Text Edit plus and MacOS X...
Two questions.
1.
The script below (only a part of it) works fine in MacOS 9 and Text Edit
plus, but in MacOS X and the Carbon Text Edit Plus strange things happens.
Instead of replacing the "filename1" with the filename that comes from the
script "PH_1.2_9812042 it uses "PH_1.2_981204cxx<caron><breve>G`p$d". So,
where does "cxx<caron><breve>G`p$d" come from?
Then looking in the Apple event log the filename is OK - "PH_1.2_981204",
is this some kind of UNIX gibberish?
copy "Macintosh HD:Script_folder:Photo_and_illu_html_files:" as text to
the_vol
set searchFolder to (the_vol & "temp_folder:")
set myList to list folder alias searchFolder without invisibles
repeat with myfilename in every item of myList
tell application "Tex-Edit Plus"
tell window 1
replace looking for "filename1" replacing with
myfilename
end tell
end tell
end repeat
The purpose of this script is to open an master text edit plus document and
search for "filename1" etc. and replace the text with the filenames in
different folders.
One solution I have come up with is, but not very nice:
tell application "Tex-Edit Plus"
tell window 1
try
search looking for "filename1"
cut result
set x to the insertion point of window 1
copy (myfilename_2) & "" to after character x of window 1
end try
try
end tell
end tell
Anyone out there who knows how to solve this?
2.
Second, how do I script a foldercount?
I only want to count a folder to see if there is any files, if yes, the
script should continue. If not it should stop.
copy "Macintosh HD:Photo_and_illu_html_files:" as text to the_vol
set countfolder to (the_vol & "files_in:")
set foldercount to the count of every item of countfolder without invisibles
if foldercount > 0 then
display dialog "Count: " & foldercount
end if
The result I get is "48", even if the folder is empty or not.
Best regards
Peter
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.