# MP3Tool Cyclic Channel Send Style. Created by Cruise Nov 14, 1998.
#
# This will rotate through all of your styles.
# It is also a good example of how you can use tcl code to do some
# interesting things with channel styles. This example forces inclusion
# for the tcl_platform variable so that this style will work on both
# windows and UNIX platforms. If you are writing a style to traverse
# directories, Please use this as an example and create your style to work
# cross platform.

global tcl_platform

# Fucking Windows!
set platform [array get tcl_platform platform]
set od [pwd]
if {$platform == "platform unix"} {
	cd $mp3tool(dir)/styles
} else {
	set drive [string range $mp3tool(dir) 0 1]
	set folder "[string range $mp3tool(dir) 2 end]/styles"
	cd $drive
	cd $folder
}
set count 0
foreach style [glob -nocomplain *] {
	if {$style != "Cycle"} {
		set rotate_styles($count) $style
		incr count
	}
}

if {$uservar(0) == $count} {
	source $rotate_styles(0)
	set uservar(0) 1
} else {
	source $rotate_styles($uservar(0))
	incr uservar(0)
}

if {$platform == "platform unix"} {
	cd $od
} else {
	set drive [string range $od 0 1]
	set folder [string range $od 2 end]
	cd $drive
	cd $folder
}

