Hi,
I’m having another problem with my project … I need to know when a new track has started in iTunes and then check if track’s name equals to the one already written into a file. Well, I got it working quite nicely, but it made the game lag. I think you need to know about the project itself, because it might be confusing at the moment. The project is about this: player launches my application, then minimizes it, launches quake 3 and when he/she presses a button, it will tell the current song. The current song data is saved in a .cfg file, which will be executed when he/she presses a button. Everything works well, except it lags like hell. It skips. I tried very many different ways of doing it. The most lag-free solution was this:
set trackChecked to false
set writeIntoFile to false
if trackChecked is not equal to true then
set trackComparison to do shell script "cat " & outputFileLocation
if trackComparison is not equal to finalSyntax then
set writeIntoFile to true
else
set trackChecked to false
set writeIntoFile to false
end if
end if
if writeIntoFile is equal to true then
do shell script "cat /dev/null > " & outputFileLocation
do shell script "echo " & quoted form of finalSyntax & " > " & outputFileLocation
set writeIntoFile to false
set trackChecked to true
end if
I guess the do shell script is the problem, to be more specific, I think this:
set trackComparison to do shell script "cat " & outputFileLocation
is a problem, since it keeps comparing the contents of a .cfg file to a string over and over again, but I’m not sure. I didn’t find any other way to compare the files content to a string.
I hope you can help me out!
Thanks,
dr4cula