Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

AmazingHenry

macrumors 65816
Original poster
Jul 6, 2015
1,285
534
Central Michigan
EDIT: Made a Spotlight script with the help of @eyoungren and @Intell. Thanks for your help!
Before reading: This isn't specifically PowerPC related but these only work on PowerPC, and they're made to help out with PowerPC projects, so I'll post them here. Anyway, on to the main post!

So, I've made a little collection of AppleScript applications for PPC (yes, I know and love AppleScript). I have no idea what they'll be used for but I think they might help with things like the Sierra theme or the Ultimate Leopard DVD. They also might help speed up your Mac. Anyway, there are AppleScripts for disabling/enabling these things:
-2D Dock
-Hidden files in Finder
-Dashboard
-Spotlight

All of these have been tested and are working perfectly. That said, if something does go wrong and you hose your system, I'm not responsible. EDIT: The Spotlight one is untested.

Anyway, these all run Terminal commands and a graphical interface is often easier than typing a command into Terminal.

Also, I was trying to do a Spotlight one but that Terminal command requires a password (it uses sudo) so my AppleScript gives an error. And the "with administrator privileges" command doesn't work on Leopard as far as I can tell. Could an AppleScript expert perhaps help out? Thanks. EDIT: As said above, Intell and eyoungren have assisted me in making a Spotlight script.

Anyway, I hope you enjoy these and I hope they make your life easier. I'll update the post and the download over time with new scripts, hopefully. Thanks for reading this!
 

Attachments

  • AppleScripts.zip
    72.4 KB · Views: 401
Last edited:

eyoungren

macrumors Penryn
Aug 31, 2011
29,658
28,433
For shell scripts with passwords, do this:

Code:
do shell script "your command" password "your password" with administrator privileges

Where 'your command' is the command you are executing and 'your password' is the password of the current logged in account (assuming it's an admin account). The downside to this is that if you aren't careful passing the script around you can reveal your password to others.

If that doesn't work, let me know. It's part of an old script. I'm at home right now but I use shell scripts for things at work all the time. So, I'll grab copy from there if this does not work.

PS. One of those G4s in the recent pics I posted is an Applescript server. Bunch of scripts that go off to process editorial photos and move files around the server depending on where they need to go. My photo processing script calls Growl and Graphic Converter which processes all photos silently (never visible on screen).

I have older scripts that can open PDFs inside Acrobat and save them out as EPS files (silently, you never see the open file on screen) as well as some other stuff.

One script I use daily relies on Quicksilver (the quick launcher) to trigger a script that copies ad proofs to our sales server.
 
  • Like
Reactions: AmazingHenry

Intell

macrumors P6
Jan 24, 2010
18,955
509
Inside
You can leave out the "password "your password" part and it'll prompt you for your password in a standard OS X password prompt.
 
  • Like
Reactions: AmazingHenry

AmazingHenry

macrumors 65816
Original poster
Jul 6, 2015
1,285
534
Central Michigan
Wow, putting "with administrator privileges after the command worked. I thought it had to look like this:

with administrator privileges
do shell script "script goes here"

But I actually had to do this:

do shell script "script goes here" with administrator privileges

Now it prompts me for a password with the standard OS X password prompt, as @Intell said above. Thanks! I'll have a Spotlight script added soon!
 
  • Like
Reactions: eyoungren

eyoungren

macrumors Penryn
Aug 31, 2011
29,658
28,433
Forgot about this until today. Wanted to get back to it with the code for the script I use to convert images.

Below is the code, but before I paste it in I'll explain it a little.

The script calls three apps. First off, it calls Play Sound, which is simply an app that plays a specified sound when the script is triggered. Since the G4 this script runs on is headless and I am not always looking at Chicken of the VNC this audio cue is important. It alerts me that images are being processed.

Second, the script calls Growl to display a VISUAL onscreen notification. That takes a slight second to come up so I can usually verify that this is indeed what is happening by looking at CotVNC after I heard the sound.

Finally, the script calls Graphic Converter which does the actual work. It tells GC to process all images in the folder the script is attached to using a batch file that has been precreated.

That's pretty much it. There is an error routine in there I believe, but it's been a while since I actually looked at the code.

PS. The script does this all quietly in the background too. Nothing shows on the screen.

Code:
-- property trig_folder : "Pueblo3:Users:erik.youngren:Desktop:Folder Action Scripts:" as alias
property source_folder : "PHOTO (ppsbsserver):CMYK_IN:" as alias
property dest_folder : "EDITORIAL (ppsbsserver):CCX_DO NOT DELETE" as alias
property error_folder : "PHOTO (ppsbsserver):ERROR:CMYK:" as alias
property batch_file : "Pueblo3:Users:erikyoungren:Library:Application Support:GraphicConverter:Actions:CMYK" as alias

on adding folder items to this_folder after receiving added_items
	tell application "Play Sound"
		play "Pueblo3:System:Library:Sounds:Glass.aiff"
	end tell
	growlAlert()
	convertIt(source_folder)
end adding folder items to

on growlAlert()
	tell application "GrowlHelperApp"
		-- Make a list of all the notification types 
		-- that this script will ever send:
		set the allNotificationsList to ¬
			{"Photo Server"}
		
		-- Make a list of the notifications 
		-- that will be enabled by default.      
		-- Those not enabled by default can be enabled later 
		-- in the 'Applications' tab of the growl prefpane.
		set the enabledNotificationsList to ¬
			{"Photo Server"}
		
		-- Register our script with growl.
		-- You can optionally (as here) set a default icon 
		-- for this script's notifications.
		register as application ¬
			"Growl Photo Server" all notifications allNotificationsList ¬
			default notifications enabledNotificationsList ¬
			icon of application "Script Editor"
		
		--	Send a Notification...
		notify with name ¬
			"Photo Server" title ¬
			"Photo Server" description ¬
			"Photos are now being processed" application name "Growl Photo Server"
		
	end tell
end growlAlert

on convertIt(fda)
	-- tell application "Finder"
	--	open file "Trigger Photo.app" of trig_folder
	-- end tell
	tell application "Finder"
		activate
		set this_item to every file of fda
		repeat with one_item in this_item
			try
				tell application "GraphicConverter"
					convert file (one_item as file specification) using batch (batch_file as file specification) to folder (dest_folder as file specification)
				end tell
			on error the error_message number the error_number
				set the error_text to "Error: " & the error_number & ". " & the error_message
				-- the following line evokes the sub-routine to write the error into an error log created on the desktop
				-- if the file "Script Error Log.txt" already exists, it will add one line to the log
				my write_error_log(the error_text)
				move it to error_folder with replacing
			end try
		end repeat
	end tell
end convertIt

on write_error_log(this_error)
	set the error_log to ((errorFolder) as text) & "Script Error Log.txt"
	try
		open for access file the error_log with write permission
		write (this_error & return) to file the error_log starting at eof
		close access file the error_log
	on error
		try
			close access file the error_log
		end try
	end try
end write_error_log
[doublepost=1481239410][/doublepost]Oh yeah!

I suppose I should mention that some of the commands in the script reference an Applescript addon called Jon's Commands.

Jon's Commands works on both OS9 and OS X. I use these commands because the standard method of copying, moving and deleting files under Applescript assumes that you are NOT operating over a network and therefore do not have to deal with delete confirmation boxes - which kill the script.

Jon's Commands enables you to delete files directly with no confirmation on network shares. Including over SMB on files stored on an NTFS formatted hard drive.

I have found it to be an excellent tool.

Documentation here: http://www.seanet.com/~jonpugh/JonsCommandsDocs.html
 
Last edited:

MysticCow

macrumors 68000
May 27, 2013
1,564
1,760
Now, no AppleScript collection is complete without Damned, The AppleScript From Hell. PM me for the copy and explanation.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.