Skip to content

Commit ad1ae2c

Browse files
committed
Doesn't rely on external library
1 parent 1fe8649 commit ad1ae2c

1 file changed

Lines changed: 17 additions & 16 deletions

File tree

open-stage-control-module/Get-IDs.applescript

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,26 +8,13 @@
88
-- Store this script in the directory you will be running the Open Stage Control custom module from, on that computer
99
-- Using remote file accesss over the network, open and run the script in script editor on your Main and Backup Qlab macs
1010
-- Ensure QLab is open, and the current cue list is the one you wish to monitor
11-
-- It will write to a config file to the root location
11+
-- It will write to a config file in the root location
1212
-- @separateprocess TRUE
1313

1414
-- @changelog
1515
-- v2.0 + writes config automatically
1616

1717

18-
-- USER DEFINED VARIABLES -----------------
19-
20-
---------- END OF USER DEFINED VARIABLES --
21-
22-
23-
-- VARIABLES FROM QLAB NOTES --------------
24-
25-
------------------ END OF QLAB VARIABLES --
26-
27-
28-
property util : script "Applescript Utilities"
29-
30-
3118
---- RUN SCRIPT ---------------------------
3219

3320
-- determine if this computer is MAIN or BACKUP
@@ -75,6 +62,7 @@ end if
7562
-- write to config file
7663
writeToConfig(jsonString)
7764

65+
7866
-- FUNCTIONS ------------------------------
7967

8068
on getRootFolder()
@@ -88,7 +76,7 @@ end getRootFolder
8876
on getIP()
8977
try
9078
set theReturned to (do shell script "ifconfig | grep inet | grep -v inet6 | cut -d\" \" -f2")
91-
set theIPs to util's splitString(theReturned, "")
79+
set theIPs to splitString(theReturned, "")
9280
on error
9381
set theIPs to {"Can't get Local IP"}
9482
end try
@@ -152,4 +140,17 @@ on readFile(theFile)
152140
on error
153141
return "error"
154142
end try
155-
end readFile
143+
end readFile
144+
145+
on splitString(theString, theDelimiter)
146+
-- save delimiters to restore old settings
147+
set oldDelimiters to AppleScript's text item delimiters
148+
-- set delimiters to delimiter to be used
149+
set AppleScript's text item delimiters to theDelimiter
150+
-- create the array
151+
set theArray to every text item of theString
152+
-- restore old setting
153+
set AppleScript's text item delimiters to oldDelimiters
154+
-- return the array
155+
return theArray
156+
end splitString

0 commit comments

Comments
 (0)