Git Product home page Git Product logo

Comments (12)

Toxblh avatar Toxblh commented on May 30, 2024

Yes, now work only inline scripts.

from mtmr.

ReDetection avatar ReDetection commented on May 30, 2024

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.

Toxblh avatar Toxblh commented on May 30, 2024

Sorry, Is it my mistake. I see it as all in config. Yes, files should be work correct

from mtmr.

PierreBrisorgueil avatar PierreBrisorgueil commented on May 30, 2024

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 

screen shot 2018-05-31 at 13 52 15

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
screen shot 2018-05-31 at 13 57 37

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.

ReDetection avatar ReDetection commented on May 30, 2024

"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.

PierreBrisorgueil avatar PierreBrisorgueil commented on May 30, 2024

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"
  },

screen shot 2018-05-31 at 16 33 51

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"
  },

screen shot 2018-05-31 at 16 37 28

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.

my scpt save :
screen shot 2018-05-31 at 16 43 41

my applescript save :
screen shot 2018-05-31 at 16 43 54

from mtmr.

ReDetection avatar ReDetection commented on May 30, 2024

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.

PierreBrisorgueil avatar PierreBrisorgueil commented on May 30, 2024

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.

ReDetection avatar ReDetection commented on May 30, 2024

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.
touch bar shot 2018-06-01 at 09 05 59
If you try to build from sources, I'm definitely interested in a result.

from mtmr.

ad avatar ad commented on May 30, 2024

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.

ReDetection avatar ReDetection commented on May 30, 2024

Oh, yeah. It seems to be an encoding issue. I expected utf8, while script editor emits ISO-8859 encoding

from mtmr.

PierreBrisorgueil avatar PierreBrisorgueil commented on May 30, 2024

@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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.