Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong Sublime Text Path #9

Closed
LeonardoGentile opened this issue Nov 7, 2013 · 6 comments
Closed

Wrong Sublime Text Path #9

LeonardoGentile opened this issue Nov 7, 2013 · 6 comments

Comments

@LeonardoGentile
Copy link

Hello, I've incorrectly chosen the SublimeText path (I chose iterm instead ) so now whenever I run the command "Open in Sublime Text" each file is opened in iterm. I've tried to reinstall the script but apparently the settings are kept because they are stored somewhere else.
Any hint?

This is a duplicate of this issue

@franzheidl
Copy link
Owner

When you say you've CHOSEN the incorrect path – did you see a dialog asking you where SublimeText was located?
Did you rename the SublimeText application?

@franzheidl
Copy link
Owner

Ok, think I got it:

In Alfred 2 Preferences, doubleclick the NS Applescript workflow item and uncheck the "cache compiled AppleScript" box.

Run the workflow again.

If this works and SublimeText is being used to open your documents, you might as well check the box again.

@LeonardoGentile
Copy link
Author

@franzheidl yes, the dialog showed up but for a mistake I chose the iterm path instead of Sublime Text and I did not renamed the Sublime Text application. I've tried your suggestion but it didn't work. I even tried to remove the workflow script and re-import it but it still targets iterm instead of Sublime Text. I have no idea where the path variable is stored..

@franzheidl
Copy link
Owner

There's no such thing as a path variable that is being stored, every time the script is run it asks the System for the path to SublimeText.

When you first run the workflow, for some odd reason* the script couldn't find SublimeText and displayed the dialog.

Once you've made your choice in the dialog, AppleScript actually changes the name of the application inside the script to whatever you chose.

Can you check/make sure that in the workflow's applescript module, the fifth line looks like this (highlighted):

open-with-sublime- 9-01

If it doesn't, change it so it does and save.

If it does, I could only imagine that the wrong application name was being saved to the cached and compiled script, hence my previous suggestion. The cached and compiled scripts are taken care of by Alfred, not by the workflow itself.

If the above didn't work and without any further investigation, the only quick fix for you would be to hardcode the path to SublimeText into the workflow script. Assuming your copy of Sublime resides in your Applications folder, change the line highlighted in the in the screenshot to:

set appPath to ":Applications:Sublime Text.app"

If SublimeText is somewhere else on your disk, enter its actual path (HFS or POSIX should both work). Don't forget to save :)

Let me know how you get along!

(*)Are you sure you are using the correct version of this workflow against version of SublimeText (2 or 3?) you're using? That might have caused the trouble (and the dialog to appear) in the first place…

If SublimeHQ would have been clever enough to keep naming their application consistent across versions, neither you nor I would have to go through all this :/

@LeonardoGentile
Copy link
Author

Thank you really much for your time!
I've replace the 5th line with the full application path and it worked. And then I've realized that I was using the wrong Sublime Text version! I'm using Sublime Text 2 but the script was referring to the 1st version. So I've downloaded the correct script and it worked!

@franzheidl
Copy link
Owner

Glad it's working for you now!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants