Skip to content

Commit 9974992

Browse files
author
James Brundage
committed
Updating README.ps1.md
Mentioning effect and linking to references
1 parent af24cae commit 9974992

1 file changed

Lines changed: 101 additions & 49 deletions

File tree

README.ps1.md

Lines changed: 101 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -15,22 +15,115 @@ Install-Module obs-powershell -Scope CurrentUser -Force
1515
Import-Module obs-powershell -PassThru -Force
1616
~~~
1717

18+
### Getting Connected
19+
20+
Before you can use obs-powershell, you'll need to Connect-OBS.
21+
22+
You should only need to do this once: obs-powershell will cache this information.
23+
24+
You can find your WebSocketToken in obs studio in Tools -> WebSocket Server Settings -> Show Connect Info.
25+
26+
Copy the Server Password and set it into a variable, $myToken
27+
28+
~~~PowerShell
29+
Connect-OBS -WebSocketToken $myToken
30+
~~~
31+
32+
After you've done this once, obs-powershell will attempt to connect every time the module is loaded.
33+
34+
### A Quick Example
35+
36+
Once you're connected, check out this nifty short sample of what you can do:
37+
38+
~~~PowerShell
39+
# Show-OBS lets you show all sorts of things.
40+
# It will return a scene item.
41+
$Stars = Show-OBS -Uri "https://pssvg.start-automating.com/Examples/Stars.svg"
42+
Start-Sleep -Milliseconds 50
43+
# We can .Hide/.Disable scene items
44+
$Stars.Hide()
45+
Start-Sleep -Milliseconds 50
46+
# We can .Show/.Enable scene items
47+
$Stars.Show()
48+
Start-Sleep -Milliseconds 50
49+
# We can make an item small
50+
$Stars.Scale(0.1)
51+
Start-Sleep -Milliseconds 50
52+
# We can fit it to the screen
53+
$stars.FitToScreen()
54+
Start-Sleep -Milliseconds 50
55+
# and we can make it big again, with an animation
56+
$Stars.Scale("1%","100%","00:00:01")
57+
Start-Sleep -Seconds 1
58+
59+
# We can do even more broad animations, like moving things across the screen.
60+
$Stars.Animate(@{
61+
X = "-25%"
62+
Y = "50%"
63+
Scale = "20%"
64+
}, @{
65+
X = "125%"
66+
Y = "50%"
67+
Scale = "50%"
68+
Rotation = 180
69+
}, "00:00:05")
70+
Start-Sleep -Seconds 1
71+
72+
# To see what any object can do in obs-powershell, run Get-Member.
73+
$stars | Get-Member
74+
~~~
75+
76+
## OBS-PowerShell Effects
77+
78+
obs-powershell gives you the ability to store and create effects that run over time.
79+
80+
For instance, we can FadeIn our stars
81+
82+
~~~PowerShell
83+
# Start the FadeIn effect on 'Stars.svg'
84+
$Stars | Start-OBSEffect -EffectName "FadeIn"
85+
Start-sleep -seconds 1
86+
87+
# Start the FadeOut effect on 'Stars.svg'
88+
$Stars | Start-OBSEffect -EffectName "FadeOut"
89+
Start-sleep -seconds 1
90+
91+
# Start the Colorloop effect on 'Stars.svg'
92+
$Stars | Start-OBSEffect -EffectName "ColorLoop"
93+
Start-sleep -seconds 1
94+
95+
# You can get all loaded effects with Get-OBSEffect
96+
Get-OBSEffect
97+
~~~
98+
1899
## Examples
19100

20-
### Getting all monitors
101+
### Getting all scenes
21102

22103
~~~PowerShell
23-
Get-OBSMonitor
104+
Get-OBSScene
105+
~~~
106+
107+
### Getting all inputs
108+
109+
~~~PowerShell
110+
Get-OBSInput
111+
~~~
112+
113+
### Getting OBS Stats
114+
~~~PowerShell
115+
Get-OBSStats
24116
~~~
25117

26118
### Getting all kinds of available inputs
27119
~~~PowerShell
28120
Get-OBSInputKind
29121
~~~
30122

31-
### Getting OBS Starts
123+
### Getting all monitors
124+
32125
~~~PowerShell
33-
Get-OBSStats
126+
Get-OBSMonitor
34127
~~~
35128

36129
### Getting Recording Status
@@ -40,12 +133,12 @@ Get-OBSRecordStatus
40133

41134
### Starting Recording
42135
~~~PowerShell
43-
Start-OBSRecord
136+
Start-Recording # an alias to Start-OBSRecord
44137
~~~
45138

46139
### Stopping Recording
47140
~~~PowerShell
48-
Stop-OBSRecord
141+
Stop-Recording # an alias to Stop-OBSRecord
49142
~~~
50143

51144
### Start Recording, Wait 5 seconds, Stop Recording, and Play the Recording.
@@ -58,12 +151,6 @@ Stop-OBSRecord |
58151
Invoke-Item
59152
~~~
60153

61-
### Listing scenes
62-
63-
~~~Powershell
64-
Get-OBSScene
65-
~~~
66-
67154
### Enabling all sources in all scenes
68155
~~~PowerShell
69156
Get-OBSScene |
@@ -80,18 +167,6 @@ Get-OBSScene |
80167
Set-OBSSceneItemEnabled -sceneItemEnabled:$false
81168
~~~
82169

83-
### Adding a Browser Input to all scenes
84-
~~~PowerShell
85-
Get-OBSScene |
86-
Add-OBSInput -inputName "Browser Input 2" -inputKind browser_source -inputSettings @{
87-
width=1920
88-
height=1080
89-
url='https://pssvg.start-automating.com/Examples/SpinningSpiral901.svg'
90-
}
91-
~~~
92-
93-
94-
95170
## How it Works
96171

97172
obs-powershell communicates with OBS with the obs websocket.
@@ -100,28 +175,5 @@ obs-powershell has a command for every websocket request.
100175

101176
Because the obs-websocket cleanly documents it's protocol, most commands in obs-powershell are automatically generated with [PipeScript](https://github.com/StartAutomating/PipeScript).
102177

103-
### obs-powershell websocket commands
104-
105-
~~~PipeScript {
106-
$importedModule = Import-Module .\obs-powershell.psd1 -Passthru
107-
$exportedCmds = $importedModule.ExportedCommands.Values |
108-
Where-Object {
109-
$_.ScriptBlock.Attributes.Key -eq 'OBS.WebSocket.RequestType'
110-
}
111-
[PSCustomObject]@{
112-
Table = $exportedCmds |
113-
.Name {
114-
"[$($_.Name)]($("docs/$($_.Name).md"))"
115-
} .RequestType {
116-
$cmd = $_
117-
foreach ($attr in $cmd.ScriptBlock.Attributes) {
118-
if ($attr.Key -eq 'OBS.WebSocket.RequestType') {
119-
"[$($attr.Value)](https://github.com/obsproject/obs-websocket/blob/master/docs/generated/protocol.md#$($attr.Value.ToLower()))"
120-
}
121-
}
122-
}
123-
}
124-
}
125-
~~~
126-
127-
178+
* [Full List Of Commands](docs/obs-powershell-commands.md)
179+
* [Full list of websocket commands](docs/obs-powershell-websocket-commands.md)

0 commit comments

Comments
 (0)