Execute the following ruby code over and over again,the totalspace2 would be crashed often, it’s occurred 5 times today ;
require ‘totalspaces2’
current_spaces = TotalSpaces2.current_space
windows = TotalSpaces2.window_list
if current_spaces > 1
dest_space = current_spaces - 1
else
dest_space = 4
end
if !windows.empty?
current_space_windows = windows.select {
|window| window[:space_number] == current_spaces
}
end
if current_space_windows[0]
win_pra = (current_space_windows[0][:frame].delete"{} ").split(’,’)
xpos = win_pra[0].to_i
ypos = win_pra[1].to_i
off = (1440 - win_pra[0].to_i)
0.step(off,3){|n| TotalSpaces2.move_window(
current_space_windows[0][:window_id],xpos-n,ypos)
}
TotalSpaces2.move_window_to_space(
current_space_windows[0][:window_id],dest_space)
if current_space_windows[1]
TotalSpaces2.set_front_window(current_space_windows[1][:window_id])
end
2.times{TotalSpaces2.move_window(
current_space_windows[0][:window_id],xpos, ypos)
sleep 0.1}
end
and Alfred output:
22:59:22.881] Logging Started…
[23:01:29.577] ERROR: Move windows[Run Script] -e:17:in <main>': undefined method
[]’ for nil:NilClass (NoMethodError)
[23:01:30.527] ERROR: Move windows[Run Script] -e:17:in <main>': undefined method
[]’ for nil:NilClass (NoMethodError)
[23:03:48.477] ERROR: Move windows[Run Script] -e:17:in <main>': undefined method
[]’ for nil:NilClass (NoMethodError)
[23:03:48.977] ERROR: Move windows[Run Script] -e:17:in <main>': undefined method
[]’ for nil:NilClass (NoMethodError)
[23:03:49.296] ERROR: Move windows[Run Script] -e:17:in <main>': undefined method
[]’ for nil:NilClass (NoMethodError)
[23:03:49.493] ERROR: Move windows[Run Script] -e:17:in <main>': undefined method
[]’ for nil:NilClass (NoMethodError)
[23:04:06.040] ERROR: Move windows[Run Script] 2019-08-10 23:04:05.970 ruby[1451:295061] Could not create connection to TotalSpaces
-e:17:in <main>': undefined method
[]’ for nil:NilClass (NoMethodError)