HI.
I have written an AS that connects to my local mySQL and constantly loops to check a new row hasn’t been added to the table. If it has, it breaks out, triggers a Javascript then starts looping again.
While this does work, it starts the fans going, and REALLY eats the Macs memory.
Is there a gentler way to monitor the table?
Here is my AS Code
with timeout of 86400 seconds
tell application "Finder"
repeat
set myCreateAdvertScript to "Macintosh HD:Users:atlasdemo:Documents:workspace:InDesign_Javascripts:Scripts Panel:Purple Ninja:Make Adverts 2.jsx"
set myString to "/usr/local/mysql/bin/mysql -uroot -p -Dadverts -h127.0.0.1 --default-character-set=utf8 -e \"SELECT id,built FROM adverts\""
set myResults to do shell script myString
set myControl to first word of last paragraph of myResults
set myNewControl to myControl
repeat while myNewControl = myControl
set myString to "/usr/local/mysql/bin/mysql -uroot -p -Dadverts -h127.0.0.1 --default-character-set=utf8 -e \"SELECT id,built FROM adverts\""
--display dialog myResults
set myResults to do shell script myString
set myNewControl to first word of last paragraph of myResults
end repeat
--display dialog "Change Found"
set myIDString to "app.insertLabel(\"dataRow\"," & "\"" & myNewControl & "\");"
tell application "Adobe InDesign CS5"
--display dialog "launching InDesign"
do script myIDString language javascript
do script alias myCreateAdvertScript language javascript
end tell
end repeat
end tell
end timeout
Model: MacBook
AppleScript: 2.1.2
Browser: Safari 535.7
Operating System: Mac OS X (10.7)