How to use Applescript to get VLC to open a mms stream - applescript

I tried
tell application "VLC" to open mms://mms_address
But it's not working. Can anyone enlighten me? Thanks

Try with OpenURL:
tell application "VLC"
OpenURL "mms://mms_address"
end tell

Related

Run Apple Script before application start?

Was wondering if there is any way to run a small piece of apple script when I launch an application on OS X?
I have a hard-drive which need to be mounted in order for the app to run right. I did this apple script already:
on run
try
do shell script "diskutil mountDisk disk2"
delay 3
tell application "Application"
run
end tell
on error
tell application "Application"
quit
end tell
set question to display dialog "Error." buttons {"OK"}
set answer to button returned of question
if answer is equal to "OK" then
close
end if
end try
end run
But even tho this works great and the hard-drive spins up before the app starts.
I would like to add the diskutil mountDisk disk2 and delay directly in front of the real application when its starting so I can double click files for that app say in my downloads folder. Which will run the script before it opens the clicked file in the app. So I wont have to start the application with another application each time i download a new file for it. Is this even possible?
Shortly:
It's not possible unless the application itself supports some inhook and outhook functionality.

Possible to create new playlist on Spotify through terminal?

Found out that I am able to control Spotify through terminal from here
http://www.instructables.com/id/RFID-Controls-for-Spotify-on-OSX-using-hacked-Mir/?ALLSTEPS
for example skipping to the next song, you would type this in the terminal:
osascript -e 'tell application "Spotify" to next track'
Just wanted to know if there was a way to create a new playlist on Spotify through the terminal .
Cheers.
No, creating playlists it's not possible using the desktop application's API.
Some useful resources:
The API reference can be found at /Applications/Spotify.app/Contents/Resources/Spotify.sdef
A shorter guide can be found at https://developer.spotify.com/applescript-api/

Why do other applications open, when I open a certain script on applescript?

Every time i open this specific script, other applications open with it and i haven't even clicked on run. Applications like Appstore and system information open, and they are only mentioned in the script once, halfway through:
tell application "Grab" to quit
tell application "Network Utility" to quit
tell application "System Information" to quit
tell application "Terminal" to quit
tell application "Keychain Access" to quit
tell application "Disk Utility" to quit
tell application "Bluetooth File Exchange" to quit
tell application "Boot Camp Assistant" to quit
tell application "AirPort Utility" to quit
tell application "Activity Monitor" to quit
tell application "App Store" to quit
tell application "iTunes" to quit
Why does this happen?
When you open the script in script editor, it will open all necessary apps in order to load their library terminology. It has always operated this way. It's especially annoying when you open someone's script that has tell blocks to apps that you don't have installed.
This does not answer the question because you already have the answer.
But, here's how to not open these applications when you want to edit the script.
Just put the application name in a variable.
set appNames to {"Grab", "Network Utility", "System Information", "Terminal", "Keychain Access", "Disk Utility", "Bluetooth File Exchange", "Boot Camp Assistant", "AirPort Utility", "Activity Monitor", "App Store", "iTunes"}
repeat with tName in appNames
quit application tName
end repeat
An AppleScript can’t tell an app to do something if that app is not running. So if a script includes a “tell” statement that targets a specific app, that app has to run along with the script. It’s the same as invoking a PHP library function in a PHP script. If you use a strpos function in a PHP script, then that PHP script can’t run without strpos also running.
This is by design because the purpose of AppleScript is to create workflows that include multiple apps working in concert on a specific task. AppleScript itself has almost no built-in functionality — your AppleScripts get their functionality from Mac apps, Unix apps, and network services.
In the script you’re working with, you can comment-out those lines (put two dashes in front of each line) if you know that those apps will not be running, because all it is doing there is telling those apps to Quit. That AppleScript is not using those apps for any real functionality.

AppleScript with iTunes on a remote machine

I have a Cocoa-AppleScript project in XCode where I'm trying to send some commands to iTunes on a local network computer. For some reason this works:
tell application "iTunes" of machine "eppc://user:pass#computer.local"
playpause
end tell
But this does not:
set remoteMachine to "eppc://user:pass#computer.local"
tell application "iTunes" of machine remoteMachine
playpause
end tell
I get the error "Can't find remote machine." Any ideas?
OK I figured it out, or at least one way to do it. You can specify the application itself on the remote machine, like:
set theRemoteApp to application "eppc://user:pass#computer.local/iTunes"
using terms from application "iTunes"
tell theRemoteApp
playpause
end tell
end using terms from
Try adding a named qualifier:
set remoteMachine to "eppc://user:pass#computer.local"
tell application "iTunes" of machine named remoteMachine
playpause
end tell

Applescript Remote Click

I'm trying to get remove mouse events working and I'm attempting to use this little script:
set machineB to "eppc://user:pw#myothermac.local"
tell application "Finder" of machine machineB
say "Hello This is so stupid"
end tell
tell application "System Events" of machine machineB
click at {100, 100}
end tell
The script say's fine, but throws the following error:
error "System Events got an error: Can’t continue click." number -1708
–1708 <reference> doesn’t understand the <commandName> message.
What am I doing wrong? I can use it to "click" on my own machine (at least it doesn't throw errors)?
[Edit]
this is related to my other question here.
You can't do this. Applescript and its tell blocks work in the context of the Mac running the application; you can send commands to the Finder on your home Mac because you are running it, but you can't send commands to the instance of Finder on a target Mac. If you are able to run an application located on the target machine from your home Mac, then the application will behave as if it is being run on the home Mac.
If you are looking to do complex remote actions, then I suggest Apple Remote Desktop or another similar method.

Resources