Serato Video General Discussion

Talk about Serato Video and Video-SL.

How to automatically create an ad-hoc network on startup (Mac Mountain Lion)

DJMark 2:03 AM - 21 June, 2013
If you're using Lemur and/or some other wireless functionality like a live camera feed that works best with an ad-hoc network, you may find this useful:


Launch Applescript Editor (in Utilities)

Copy/paste the following (everything that's within the dashed lines):

------------------------------------------------

property CreateMenuName : "Create Network…"
property NetworkName : "MyAdHocNetwork"
property NetworkPassword : "12345"

tell application "System Events"

tell process "SystemUIServer"

tell menu bar 1

set menu_extras to value of attribute "AXDescription" of menu bar items

repeat with the_menu from 1 to the count of menu_extras

if item the_menu of menu_extras contains "Wi-Fi" then exit repeat

end repeat

tell menu bar item the_menu

perform action "AXPress"

delay 0.2

perform action "AXPress" of menu item CreateMenuName of menu 1

end tell

end tell

repeat until exists window 1

delay 0.5

end repeat

tell window 1

set value of text field 1 to NetworkName

delay 0.5

click pop up button 1

delay 0.5

click menu item 10 of menu 1 of pop up button 1

delay 0.5

click pop up button 2

delay 0.5

click menu item 3 of menu 1 of pop up button 2

delay 0.5

set value of text field 2 to NetworkPassword

delay 0.5

set focused of text field 3 to true

set value of text field 3 to NetworkPassword

click button 1

end tell

end tell

end tell

------------------------------------------------

Adjust the network name and password in lines 2 and 3 to whatever you want (password has to be exactly five alphanumeric characters, make sure both are inside the quotes).

Save the script as a logically-named ***application*** (has to be saved as application), place it somewhere (like the Applications folder itself) where it won't get moved or deleted accidentally.

Test the script to make sure it works as you would expect. Should create an ad-hoc network on channel 10. With a little tweaking (the line where it says "menu item 10") it's pretty simple to change your channel selection.

After confirming it works:

Open System Preferences/Users & Groups, go to "Login Items".

Click on the "+" button below, navigate to where your newly-created application is and select it.

Now whenever you start up your Mac it will create an ad-hoc network for you, saving the need to do it manually every time.
Code:E 8:30 AM - 21 June, 2013
Quote:
Now whenever you start up your Mac it will create an ad-hoc network for you, saving the need to do it manually every time.

Is there a way to make an application you just run that changes your setting to what you have setup in this script? I don't want my MBP to do this every time I restart it but when I'm getting to a gig and launch my apps I would love for one of the apps to lunch be this. Also kinda on the same topic is there a way to set the IP address that is use by the computer, so its the same every time. I use touch OSC and MIDI doesn't play well with resolume all the time so i have to send OSC commands. And finding the IP address and changing it every time is a pain i would like to eliminate. Also on the same topic anyway to force the my iPad to take the same IP every time it connect to the adhoc?
Code:E 8:38 AM - 21 June, 2013
Well I should have just tried it before writing that long post, It took less time to try that to write the 1st post. I got it work exactly like how I want it to. Its is odd to watch everything pop up and fill in the boxes automatically but it works great.

Thank you very much DJMark. I hope I can teach you something in return.
DJMark 10:33 AM - 21 June, 2013
Quote:
Also kinda on the same topic is there a way to set the IP address that is use by the computer, so its the same every time.


Yes, it's pretty easy to do that.

If you sometimes use wifi normally, you probably want to set up a separate network "location" in System Preferences/Network, and give the static-ip location some logical name you'll remember.

I'm going to guess that if you dig into the Network system preference, you'll probably figure it all out pretty easily. (Plus at 3:33 am I'm feeling way too lazy to tediously type it all out).

Using the "locations" is a great way to experiment with networking without messing up your main settings.
Code:E 6:05 PM - 21 June, 2013
thank you :) playing with it now.
Mahandry 10:05 AM - 6 September, 2014
And how to run it in background mode?
DJMark 8:26 PM - 8 September, 2014
Quote:
And how to run it in background mode?


I don't understand what you're asking.

The script should automatically quit after it sets up the ad-hoc network.
Mahandry 8:11 AM - 9 September, 2014
Ok.. Thanks DJMark
JayvR 2:24 PM - 4 October, 2014
This script doesn't work when no monitor is connected. I get this error:

can't get <<class menE>> of <<class mbri>> 5 of <<class mbar>> 1 of <<class prcs>> "SystemUIServer" of application "System Events". Invalid index.

I want to use my iPad as the only monitor for my mac mini. Is this possible in any way?
DJMark 11:09 PM - 20 October, 2014
Just a note that Mac OS 10.10 "Yosemite" seems to have broken functionality for this script. At first glance, it looks like Yosemite has changed the way ad hoc networks are created (I no longer see any way to set a password).

Ad hoc networking itself seems to work okay with Yosemite, as does Lemur after doing the updates that were released in the last few days.
DJMark 12:18 AM - 26 October, 2014
It looks like Yosemite has actually removed the ability to encrypt ad-hoc wi-fi connections, so the only way to set it up is with no password at all.

Also iOS8 doesn't seem capable of connecting to ad-hoc networks on channels 36-48. It does connect to a password-protected ad-hoc network originating from a Mac running Mavericks, using channel 11.

This is all rather annoying, and ironically-sad...Lemur finally seems to have squashed the "comes disconnected" bug that would cause you to lose connectivity at random times (you'd see the MIDI target listed in red). Since updating to the new version I haven't had a single disconnection problem.

Since obviously Yosemite and iOS8 are the future, it looks like ditching ad-hoc Lemur connections in favor of either a "wired" solution like the iConnectMIDI2+, or setting up a "private" wi-fi router for this use, is the way to go...unless either Apple puts back the ad-hoc encryption functionality, or someone else comes up with a different way to create an encrypted ad-hoc network.

tidbits.com

"Yosemite kills WEP once and for all. Ad hoc networking only offers unencrypted connections, which I can recommend only if there are no other computer users in your vicinity. There is now no way to prevent someone from joining an ad hoc network or sniffing the traffic passing by."
the SOUNDINSURGENT 3:48 PM - 26 October, 2014
Mark do you think the iConnect is really worth the hundred bucks??
DJMark 1:08 AM - 27 October, 2014
I just got one to test today. I wanted a MIDI interface for my iPad anyway, so it won't be going to waste.

For Lemur it works (obviously you have to change MIDI settings in Lemur)...unfortunately it doesn't power the iPad unless you add an AC adapter.

So you're adding in a little box and two USB cables...one of them lightning-to-USB that has a little "lump" in it that leads me to believe it's got some active electronics inside, so can't lose that one. And you need a power adapter if you want to have the iPad powered (probably not an issue unless you're doing very long gigs).

If this new, debased ad-hoc network thing in Mac OS is The Way It's Going To Be from now on, I'm guessing a more practical solution for most DJ's is to carry around a wifi access point. Less messy setup, and you're not losing a USB port.
popnwave 9:37 PM - 27 October, 2014
Question, are you really worried about someone sniffing midi controls?
froggymaster 11:59 AM - 6 March, 2015
Thank you a lot for your script.
As I found it with google and it doesn't work for german MacOS, I'll add my modified version. Works at MacOS X 10.9.5 german.

Script (funktioniert mit deutschem MaOS 10.9.5):

------------------------------

property CreateMenuName : "Netzwerk anlegen …"
property NetworkName : "MeinAdHocNetzwerk"
property NetworkPassword : "12345"

tell application "System Events"

tell process "SystemUIServer"

tell menu bar 1

set menu_extras to value of attribute "AXDescription" of menu bar items

repeat with the_menu from 1 to the count of menu_extras

if item the_menu of menu_extras contains "WLAN" then exit repeat

end repeat

tell menu bar item the_menu

perform action "AXPress"

delay 0.2

perform action "AXPress" of menu item CreateMenuName of menu 1

end tell

end tell

repeat until exists window 1

delay 0.5

end repeat

tell window 1

set value of text field 1 to NetworkName

delay 0.5

click pop up button 1

delay 0.5

click menu item 10 of menu 1 of pop up button 1

delay 0.5

click pop up button 2

delay 0.5

click menu item 3 of menu 1 of pop up button 2

delay 0.5

set value of text field 2 to NetworkPassword

delay 0.5

set focused of text field 3 to true

set value of text field 3 to NetworkPassword

click button 1

end tell

end tell

end tell
ASoveral 7:56 PM - 12 March, 2015
I have just try to run this script but I get the following message:

System Events got an error: Can’t get pop up button 2 of window 1 of process "SystemUIServer". Invalid index.

And then I have to click on the Create button to continue with the script.

After the creation of the network the Script editor does not close.
DJMark 11:52 PM - 12 March, 2015
Quote:
I have just try to run this script but I get the following message:

System Events got an error: Can’t get pop up button 2 of window 1 of process "SystemUIServer". Invalid index.

And then I have to click on the Create button to continue with the script.

After the creation of the network the Script editor does not close.


What OS version?
ASoveral 4:37 PM - 13 March, 2015
The last one. OS X YOSEMITE
DJMark 10:14 PM - 13 March, 2015
Quote:
The last one. OS X YOSEMITE


It won't work then. Apple changed ad-hoc networking in Yosemite. As far as I can see, no ability to create a password-protected ad-hoc network any more.
Dambr7 3:05 PM - 11 March, 2016
Quote:
Quote:
I have just try to run this script but I get the following message:

System Events got an error: Can’t get pop up button 2 of window 1 of process "SystemUIServer". Invalid index.

And then I have to click on the Create button to continue with the script.

After the creation of the network the Script editor does not close.


What OS version?

Quote:
Quote:
The last one. OS X YOSEMITE


It won't work then. Apple changed ad-hoc networking in Yosemite. As far as I can see, no ability to create a password-protected ad-hoc network any more.



It will work you just have to remove the correct lines of code. Try this it works for me on Yosemite and up.

property CreateMenuName : "Create Network…"
property NetworkName : "YourAdHocName"

tell application "System Events"

tell process "SystemUIServer"

tell menu bar 1

set menu_extras to value of attribute "AXDescription" of menu bar items

repeat with the_menu from 1 to the count of menu_extras

if item the_menu of menu_extras contains "Wi-Fi" then exit repeat

end repeat

tell menu bar item the_menu

perform action "AXPress"

delay 0.2

perform action "AXPress" of menu item CreateMenuName of menu 1

end tell

end tell

repeat until exists window 1

delay 0.5

end repeat

tell window 1

set value of text field 1 to NetworkName

delay 0.5

click pop up button 1

delay 0.5

click menu item 10 of menu 1 of pop up button 1

click button 1

end tell

end tell

end tell