Comments (12)
Yes, now work only inline scripts.
from mtmr.
what? I have them working, two of my apple script widgets are running like that right now.
@PierreBrisorgueil can you please check if your file is really there and full path is correct? It's a common case to have case-sensitive filesystem and a small mistake in the path
ls -la /Users/xxxx/Documents/appleScript/vox.applescript
from mtmr.
Sorry, Is it my mistake. I see it as all in config. Yes, files should be work correct
from mtmr.
Not ok for me, script works fine for my buttons "action": "appleScript"
But for appleScriptTitledButton, when the script must return the string value :
With my Apple Script : KO
(but the apple script seems to work fine in apple editor)
{
"type": "appleScriptTitledButton",
"source": {
"filePath": "/Users/xxxx/Documents/Dev/appleScript/vox.applescript",
},
"action": "appleScript",
"actionAppleScript": {
"inline":
"if application \"VOX\" is running then\rtell application \"VOX\"\rif player state is 1 then\rnext\rend if\rend tell\rend if\r"
},
"refreshInterval": 1,
"align": "left"
},
if application "VOX" is running then
tell application "VOX"
if player state is 1 then
if length of (get artist) is less than 15 then
set myArtist to (get artist)
else
set myArtist to text 1 thru 15 of (get artist)
set myArtist to (myArtist & " ..")
end if
if length of (get track) is less than 10 then
set myTrack to (get track)
else
set myTrack to text 1 thru 10 of (get track)
set myTrack to (myTrack & " ..")
end if
return myArtist & " – " & myTrack
else
return ""
end if
end tell
end if
return by mt = no script
With a simple Apple Script : OK
{
"type": "appleScriptTitledButton",
"source": {
"filePath": "/Users/xxxx/Documents/Dev/appleScript/vox.applescript",
},
"action": "appleScript",
"actionAppleScript": {
"inline":
"if application \"VOX\" is running then\rtell application \"VOX\"\rif player state is 1 then\rnext\rend if\rend tell\rend if\r"
},
"refreshInterval": 1,
"align": "left"
},
return "test"
return = test
With my Apple Script inline : OK
{
"type": "appleScriptTitledButton",
"source": {
"inline":
"if application \"VOX\" is running then\rtell application \"VOX\"\rif player state is 1 then\rif length of (get artist) is less than 15 then\rset myArtist to (get artist)\relse\rset myArtist to text 1 thru 15 of (get artist)\rset myArtist to (myArtist & \" ..\")\rend if\rif length of (get track) is less than 10 then\rset myTrack to (get track)\relse\rset myTrack to text 1 thru 10 of (get track)\rset myTrack to (myTrack & \" ..\")\rend if\rreturn myArtist & \" – \" & myTrack\relse\rreturn \"\"\rend if\rend tell\rend if"
},
"action": "appleScript",
"actionAppleScript": {
"inline":
"if application \"VOX\" is running then\rtell application \"VOX\"\rif player state is 1 then\rnext\rend if\rend tell\rend if\r"
},
"refreshInterval": 1,
"align": "left"
},
the only one idea I have for the moment is the return :
1/ when i'm on inline, the text seems to be ok :
"Dennis Kruissen .. – Don't Thi .."
2/ when i use my script : we have this "Dennis Kruissen .. – **"**Don't Thi .."
I was wondering if the problem is not this "
3/ but when I try to do this in apple script
it works, and when I call this from mt, this loops the next script called in the configuration
that's seem to be normal .. but maybe we can escape the string return by apple script by default to protect mt from that ?
(in my case this the next script open some connexions, I almost ban myself myself x, a little bit dangerous :p ..)
and that doesn't explain my problem for the moment "no script"
maybe I'm missing something
from mtmr.
"no script" error occurs only when failed to load script from disk, this happens even before trying to compile script, so I'm pretty sure script itself is fine and error is somewhere else, my guess is wrong path. Please double check it. In latest message you have Dev
path component which was missing before.
If you sure that file is there and ls
command shows no error, then we have to check some basics first: which version of MTMR you are running? Did you download it from releases section as dmg image, zip archive, or you checked out the source code and built by yourself? Do you have spaces in your home folder or any other symbol that you have to escape in bash? (In MTMR config only regular JSON escaping should be applied, not bash escaping needed)
from mtmr.
it's not the path :
script simple
{
"type": "appleScriptTitledButton",
"source": {
"filePath": "/Users/pierrebrisorgueil/Documents/Dev/appleScript/test.applescript",
},
"action": "appleScript",
"actionAppleScript": {
"inline":
"if application \"VOX\" is running then\rtell application \"VOX\"\rif player state is 1 then\rnext\rend if\rend tell\rend if\r"
},
"refreshInterval": 1,
"align": "left"
},
Text button is : "test"
my script
{
"type": "appleScriptTitledButton",
"source": {
"filePath": "/Users/pierrebrisorgueil/Documents/Dev/appleScript/vox.applescript",
},
"action": "appleScript",
"actionAppleScript": {
"inline":
"if application \"VOX\" is running then\rtell application \"VOX\"\rif player state is 1 then\rnext\rend if\rend tell\rend if\r"
},
"refreshInterval": 1,
"align": "left"
},
Text button is : "no script"
Path seems to be good.
Does anyone can test my script quickly ? downloaded from releases section as dmg image 0.16, no escape, no space.
i call the .applescript because the .scpt does not seem to work with mt for me.
Done with Apple script editor, export in text format.
from mtmr.
I tried yours and I got empty button as I don't have VOX player. I didn't got any "no script". I understand your struggle, but I'm still convinced there is some problem with file loading. You told me you got test script working. Can you please copy-paste vox script content to the test script and restart MTMR please? If this doesn't help then I have no ideas what's going on
from mtmr.
Already tried and same result :/
hum, can you try this for iTunes ?
if application "iTunes" is running then
tell application "iTunes"
if player state is playing then
if length of (get artist of current track) is less than 15 then
set myArtist to (get artist of current track)
else
set myArtist to text 1 thru 15 of (get artist of current track)
set myArtist to (myArtist & " ..")
end if
if length of (get name of current track) is less than 10 then
set myTrack to (get name of current track)
else
set myTrack to text 1 thru 10 of (get name of current track)
set myTrack to (myTrack & " ..")
end if
return myArtist & " – " & myTrack
else
return ""
end if
end tell
end if
I have the same result.
if this work on iTunes for you, do you use Script Editor ? or juste classic editor to create the script ? how do you save it ? .applescript or .scpt ?
if we find nothing with this last test I will not bother you anymore and I'll do a build at home to understand :)
(but I think we shouldn't forget about the looping script I mentioned above, in case of a string with one " return)
from mtmr.
I use Sublime text editor, I save as .scpt
, but as long as this is just a text file, file extension doesn't matter. I get normal output from iTunes playing Billy Talent.
If you try to build from sources, I'm definitely interested in a result.
from mtmr.
Please check the line "return myArtist & " – " & myTrack" in result file (open it in alternative text editor). Script Editor replaced "dash" with symbol in alternative encoding.
from mtmr.
Oh, yeah. It seems to be an encoding issue. I expected utf8, while script editor emits ISO-8859 encoding
from mtmr.
@ad 👍 perfect :)
in sublime :
return myArtist & " Ð " & myTrack
Testing the apple script for the first time I did not expect it.
@ReDetection thx for fix :)
if someone have time I think we can test this again :
Check if the infinite loop is still relevant, it broke the JSON file and triggered the next script in a loop. This can be dangerous depending on the contents of the following script.
from mtmr.
Related Issues (20)
- how to only show activated app in dock
- Weather not working?
- Is this project abandoned? HOT 2
- Fix for spotify song info for zsh users
- Input source widget not showing on latest Monterey HOT 3
- New features
- Script to do the "exitTouchbar" command
- Could you add release for Apple silicon?
- MultiKey
- Doesnt work image... HOT 4
- Applications app add to Touchbar. HOT 1
- Brightness slide not working...
- YouTube 'now playing' in Safari change to Firefox
- Selecting Preferences Opens After Effects
- [URGENT] Openweathermap API keys uploaded with public release HOT 1
- copy and paste button HOT 1
- Feature req: sub-layout loading
- spotify music can't worked
- Video and music timeline
- Play animation
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mtmr.