Scripting

From kJams Wiki
Revision as of 23:45, 6 October 2009 by Dave (talk | contribs)
Jump to navigation Jump to search

You can use AppleScript to cause kJams Pro to export your songs to QuickTime format.

Here is an example script for kJams:

tell application "kJams Pro"
	-- returns the version of kJams that is running
	--version
	
	-- a test property, returns false if kJams is not crashed.  set this to true to make kJams crash
	--crash
	--set crash to true
	
	-- it is okay to add the same song twice from a script, it will only be added once
	-- it is also okay if the song is on a CD, it won't actually add to the library in that case
	-- must pass a POSIX path
	set songID to add to library "/Volumes/SGB0001 - Free Style Jazz Volume 1/7 The Lady Is A Tramp.aiff"
	
	if songID is not 0 then
		-- POSIX path for output folder, tilde is okay for user folder
		export songID encoder "QuickTime Movie" preset "Animation / AAC Best" folder "~/Desktop"
	end if

	-- get or set the volume of mics and speakers.  volume level goes from 0 to 100
	set kSpeakers to 0
	set kMicrophone_1 to 1
	
	set volume kSpeakers level 50
	get volume kMicrophone_1

	-- you can get the current time, the remaining time, or the absolute duration of the currently playing song.
	-- curT is in floating point seconds
	set kCurSongTime_DURATION to 0
	set kCurSongTime_CURRENT to 1
	set kCurSongTime_REMAINING to 2

	set curT to get time kCurSongTime_CURRENT

	-- you can get the current mode too (stopped, playing, paused)
	set kPlayModeType_STOPPED to 0
	set kPlayModeType_PLAYING to 1
	set kPlayModeType_PAUSED to 2

	set playMode to get mode
end tell

Hey! Here's the first application using scripting! The Crossfade Script!

or try this (For use with Remote Control software):

set kScriptCommand_PLAY_PAUSE to 1
set kScriptCommand_STOP to 2
set kScriptCommand_BACK_REWIND to 3
set kScriptCommand_NEXT to 4
set kScriptCommand_VOL_UP to 5
set kScriptCommand_VOL_DOWN to 6
set kScriptCommand_VOL_MUTE to 7
set kScriptCommand_PITCH_UP to 8
set kScriptCommand_PITCH_DOWN to 9
set kScriptCommand_PITCH_NORMAL to 10
set kScriptCommand_SAVE to 11
set kScriptCommand_TEMPO_UP to 12
set kScriptCommand_TEMPO_DOWN to 13
set kScriptCommand_TEMPO_NORMAL to 14
set kScriptCommand_FULL_SCREEN to 15
set kScriptCommand_CAM_POWER to 16
set kScriptCommand_CAM_SHOOT to 17

tell application "kJams Pro"
	docommand kScriptCommand_PLAY_PAUSE
end tell