Advertisement

10.15.2008 at 03:22PM PDT, ID: 23818668
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

7.8

Help rebuilding this AppleScript

Asked by weirdturnedpro in AppleScript, Mac OS X

Tags:

I inherited a VERY convoluted AppleScript we using during our archiving procedures using an older OS X 10.3 machine with a VERY specific configuration. When I've tried to run this script on another machine - I received an error referencing a portion of the code that uses a function called <<WaynTkii>>. Through a little digging I discovered that this is an ACME Script Widgets tokenize function (I think). After trying to get ACME Script Widgets to run on a 10.5 and 10.4 machine - I gave up after receiving the same error.

Furthermore - I'm not 100% sure what the script does. I do know that it goes through each folder to be archived and removes an underscore and all text thereafter in the folder names, and seems to be moving some files/folders around within that folder, but nothing specifically.

Can anyone take a look at this and rewrite it will run without depending on ACME Script Widgets - and hopefully on OS X 10.5. Code to follow


Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
on open archive_root
	global folder_name, folder_num, job_num_list, job_name_list, other_folder_name, other_folder_num, old_job_number, this_job_number, folder_number
	set archive_root to archive_root as text
	with timeout of 600 seconds
		tell application "Finder"
			set folder_list to the name of every folder of folder archive_root as list
			set volume_name to (the first item in («event WaynTKii» archive_root given «class SEPl»:":")) as text
			try
				make new folder at disk volume_name with properties {name:"TEMP"}
			end try
			
			set folder_count to the count of items in folder_list
			
			set job_num_list to {}
			set job_name_list to {}
			
			repeat with this_folder from 1 to folder_count
				set folder_name to (item this_folder in folder_list) as text
				set this_job_number to (the first item in («event WaynTKii» folder_name given «class SEPl»:"_") as text) as text
				if (job_num_list contains this_job_number) then
					set list_offset to the «event WaynFINL» job_num_list given «class ForS»:this_job_number
					set other_folder_name to (item list_offset in job_name_list) as text
					activate
					beep 2
					display dialog ("The following folders are the same job #" & return & folder_name & return & other_folder_name) with icon 2
					display dialog "Name for folder" & return & folder_name default answer folder_name with icon 1
					set folder_num to the text returned of result as text
					display dialog "Name for folder" & return & other_folder_name default answer other_folder_name with icon 1
					set other_folder_num to the text returned of result as text
					set job_num_list to («event WaynRPLC» this_job_number given «class in  »:job_num_list, «class with»:other_folder_num) as list
					copy folder_num to the end of job_num_list
					copy folder_name to the end of job_name_list
				else
					copy this_job_number to the end of job_num_list
					copy folder_name to the end of job_name_list
				end if
			end repeat
			
			repeat with thiss_folder from 1 to folder_count
				set folder_name to (item thiss_folder in job_name_list) as text
				set folder_number to (item thiss_folder in job_num_list) as text
				set old_job_number to (the first item in («event WaynTKii» folder_name given «class SEPl»:"_") as text)
				try
					set the name of folder (archive_root & folder_name & ":" & (old_job_number & "_FONTS") as text) to (folder_number & "_FONTS")
				end try
				set the name of folder (archive_root & folder_name) to folder_number
			end repeat
			
			set folder_list to the name of every folder of folder archive_root as list
			set folder_count to the count of items in folder_list
			
			repeat with this_folder from 1 to folder_count
				set folder_name to (item this_folder in folder_list) as text
				set this_job_number to (the first item in («event WaynTKii» folder_name given «class SEPl»:"_") as text)
				try
					make new folder at folder (volume_name & ":TEMP:") with properties {name:folder_name}
				end try
				if folder (archive_root & folder_name & ":Control:") exists then
					move folder (archive_root & folder_name & ":Control:") to folder (volume_name & ":TEMP:" & folder_name & ":")
				end if
				if folder (archive_root & folder_name & ":Fonts:") exists then
					move folder (archive_root & folder_name & ":Fonts:") to folder (volume_name & ":TEMP:" & folder_name & ":")
				end if
				if folder (archive_root & folder_name & ":HotFolders:") exists then
					move folder (archive_root & folder_name & ":HotFolders:") to folder (volume_name & ":TEMP:" & folder_name & ":")
				end if
				if folder (archive_root & folder_name & ":System:") exists then
					move folder (archive_root & folder_name & ":System:") to folder (volume_name & ":TEMP:" & folder_name & ":")
				end if
				if folder (archive_root & folder_name & ":WebDownloads:") exists then
					move folder (archive_root & folder_name & ":WebDownloads:") to folder (volume_name & ":TEMP:" & folder_name & ":")
				end if
				if folder (archive_root & folder_name & ":WebUploads:") exists then
					move folder (archive_root & folder_name & ":WebUploads:") to folder (volume_name & ":TEMP:" & folder_name & ":")
				end if
				if folder (archive_root & folder_name & ":VPS-Sigs:") exists then
					move folder (archive_root & folder_name & ":VPS-Sigs:") to folder (volume_name & ":TEMP:" & folder_name & ":")
				end if
			end repeat
			beep 2
			display dialog "Folder Moves Completed" with icon 1
		end tell
	end timeout
end open
[+][-]10.16.2008 at 07:53AM PDT, ID: 22731705

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10.17.2008 at 03:31PM PDT, ID: 22745958

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: AppleScript, Mac OS X
Tags: AppleScript, ACME Script Widgets
Sign Up Now!
Solution Provided By: weirdturnedpro
Participating Experts: 2
Solution Grade: A
 
 
[+][-]10.30.2008 at 04:53AM PDT, ID: 22839756

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10.30.2008 at 07:24AM PDT, ID: 22841234

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10.30.2008 at 07:46AM PDT, ID: 22841486

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628