Notices
Computer & Technology Related Post here for help and discussion of computing and related technology. Internet, TVs, phones, consoles, computers, tablets and any other gadgets.

One significant reason I love OSX

Thread Tools
 
Search this Thread
 
Old 30 March 2012, 08:26 AM
  #1  
ChefDude
Scooby Regular
Thread Starter
 
ChefDude's Avatar
 
Join Date: Aug 2005
Posts: 4,290
Likes: 0
Received 0 Likes on 0 Posts
Default One significant reason I love OSX

OSX, being a proper certified UNIX variant, is structured so that all the functionality of the OS is exposed to the GUI and via the shell. Anything you can do in the GUI you can access and execute from shell script and apple script. I'm not too familiar with win7 and 8, but you certainly couldn't as comprehensively as OSX allows in Vista or before. You can't hoodwink me, i was a c++ dev for a long time

I wrote my first apple/shell script yesterday and I'm chuffed anyone can do this with their standard version of OSX

This little ditty will suffix a string token onto all square 1:1 ratio jpeg images so you can easily spotlight search for them. For the record, you can search for width=[no. of pixels] and same for height, but not width=height



I set this up as a service so I can just select the images, 5000 in my case, and execute this.

Brilliant
Old 30 March 2012, 10:25 AM
  #2  
Iain Young
Scooby Regular
 
Iain Young's Avatar
 
Join Date: Sep 1999
Location: Swindon, Wiltshire Xbox Gamertag: Gutgouger
Posts: 6,956
Likes: 0
Received 0 Likes on 0 Posts
Default

You can achieve the same thing fairly easily in Windows using vbscript
Old 30 March 2012, 10:36 AM
  #3  
Hanley
Scooby Regular
 
Hanley's Avatar
 
Join Date: May 2002
Location: Liverpool
Posts: 3,229
Likes: 0
Received 0 Likes on 0 Posts
Default

Yeah but can it run in the background Iain?
Old 30 March 2012, 10:42 AM
  #4  
Ant
Scooby Regular
 
Ant's Avatar
 
Join Date: Jun 2008
Location: Notts
Posts: 9,243
Likes: 0
Received 0 Likes on 0 Posts
Default

Originally Posted by Hanley
Yeah but can it run in the background Iain?
Old 30 March 2012, 10:44 AM
  #5  
Iain Young
Scooby Regular
 
Iain Young's Avatar
 
Join Date: Sep 1999
Location: Swindon, Wiltshire Xbox Gamertag: Gutgouger
Posts: 6,956
Likes: 0
Received 0 Likes on 0 Posts
Default

Yes
Old 30 March 2012, 10:46 AM
  #6  
ChefDude
Scooby Regular
Thread Starter
 
ChefDude's Avatar
 
Join Date: Aug 2005
Posts: 4,290
Likes: 0
Received 0 Likes on 0 Posts
Default

Binding in dlls to a vb script and shoe honing them into a service or such like?! Accessible, my ar$e lol
Old 30 March 2012, 11:02 AM
  #7  
JackClark
Scooby Senior
 
JackClark's Avatar
 
Join Date: Dec 2000
Location: Overdosed on LCD
Posts: 20,853
Received 51 Likes on 34 Posts
Default

Automator for me, handles lots of simple yet tedious duties for me. I'd quit my job without it.
Old 30 March 2012, 12:33 PM
  #8  
jonc
Scooby Regular
 
jonc's Avatar
 
Join Date: Apr 2002
Posts: 7,635
Likes: 0
Received 18 Likes on 13 Posts
Default

Originally Posted by ChefDude
Binding in dlls to a vb script and shoe honing them into a service or such like?! Accessible, my ar$e lol
It's quite possible in Windows 7 using Powershell.
Old 30 March 2012, 12:58 PM
  #9  
Markus
Scooby Regular
 
Markus's Avatar
 
Join Date: Mar 1999
Location: The Great White North
Posts: 25,080
Likes: 0
Received 0 Likes on 0 Posts
Default

Big fan of Applescript. Used it for many, many years. It is very handy. If you really like it, look at ScriptDebugger a very nice alternative to Apple's Script Editor.

You can, or at least could, use Xcode as well, used to be called Applescript Studio, the idea being that you have your AS code and can use the interface editor in Xcode to create complicated windows and dialogs, as AS only offers very basic dialogs.

I've written very simple to very complex scripts (automation testing of an iOS application - Apple does not provide true unattended automation )


As for your script, you could do this:

Code:
on open (droppediems)
	
	maincode(droppediems)
	
end open

-----------------------------------------------------

on run
	
	set theselectedfiles to choose file with prompt "Select your files" with multiple selections allowed
	maincode(theselectedfiles)
	
end run

-----------------------------------------------------


on maincode(theselecteditems)
	
	repeat with anitem in theselecteditems
		
		-- Per item code
		
	end repeat
	
end maincode
You would whack the code you want to execute on each file in the --Per item code section. The idea being, you select a bunch of files and drag and drop them on the script, or you run the script and select the files you want to perform the action on.

If you want some code to handle iterating through folders and processing the files that are found, just shout.
Old 30 March 2012, 01:03 PM
  #10  
ramdor
Scooby Regular
iTrader: (2)
 
ramdor's Avatar
 
Join Date: Feb 2003
Posts: 700
Likes: 0
Received 0 Likes on 0 Posts
Default



sliced bread eat your heart out
Old 30 March 2012, 01:27 PM
  #11  
ChefDude
Scooby Regular
Thread Starter
 
ChefDude's Avatar
 
Join Date: Aug 2005
Posts: 4,290
Likes: 0
Received 0 Likes on 0 Posts
Default

Originally Posted by Markus
Big fan of Applescript. Used it for many, many years. It is very handy. If you really like it, look at ScriptDebugger a very nice alternative to Apple's Script Editor.

You can, or at least could, use Xcode as well, used to be called Applescript Studio, the idea being that you have your AS code and can use the interface editor in Xcode to create complicated windows and dialogs, as AS only offers very basic dialogs.

I've written very simple to very complex scripts (automation testing of an iOS application - Apple does not provide true unattended automation )


As for your script, you could do this:

Code:
on open (droppediems)
	
	maincode(droppediems)
	
end open

-----------------------------------------------------

on run
	
	set theselectedfiles to choose file with prompt "Select your files" with multiple selections allowed
	maincode(theselectedfiles)
	
end run

-----------------------------------------------------


on maincode(theselecteditems)
	
	repeat with anitem in theselecteditems
		
		-- Per item code
		
	end repeat
	
end maincode
You would whack the code you want to execute on each file in the --Per item code section. The idea being, you select a bunch of files and drag and drop them on the script, or you run the script and select the files you want to perform the action on.

If you want some code to handle iterating through folders and processing the files that are found, just shout.
Thanks
Old 30 March 2012, 02:09 PM
  #12  
Iain Young
Scooby Regular
 
Iain Young's Avatar
 
Join Date: Sep 1999
Location: Swindon, Wiltshire Xbox Gamertag: Gutgouger
Posts: 6,956
Likes: 0
Received 0 Likes on 0 Posts
Default

Originally Posted by jonc
It's quite possible in Windows 7 using Powershell.
Beat me to it. It's quite easy really
Old 31 March 2012, 11:32 AM
  #13  
rabbos
Scooby Regular
 
rabbos's Avatar
 
Join Date: Nov 2005
Posts: 458
Likes: 0
Received 0 Likes on 0 Posts
Default

Originally Posted by JackClark
Automator for me, handles lots of simple yet tedious duties for me. I'd quit my job without it.
Ah, so that accounts for your posts then
Related Topics
Thread
Thread Starter
Forum
Replies
Last Post
SilverM3
ScoobyNet General
8
24 February 2021 01:03 PM
blackieblob
ScoobyNet General
2
02 October 2015 05:34 PM
Ganz1983
Subaru
5
02 October 2015 09:22 AM
Benrowe727
ScoobyNet General
7
28 September 2015 07:05 AM



Quick Reply: One significant reason I love OSX



All times are GMT +1. The time now is 08:13 AM.