My Project File
Above is my project file for reference.
I am trying to make a simple GUI app to change two hidden dock preferences.
I have two buttons (in the project called HideApps and OpenApps) which ‘toggle’ the state of these two boolean preferences.
Here is my code for one of the button’s action handler:
[code] ProgressWheel1.Visible=true
OpenApps.Enabled=false
Dim s1 As Shell
s1 = New Shell
#If TargetMacOS Or TargetLinux Then
s1.Execute(“defaults read com.apple.dock single-app”)
#Endif
// MsgBox(s1.Result)
Label4.Text=("Current Value (Single-App): " + s1.Result)
App.SleepCurrentThread(300)
dim f as new shell
If Label4.Text = “Current Value (Single-App): 1” then
f.Execute (“defaults write com.apple.dock single-app -boolean false; killall Dock”)
elseif Label4.Text = “Current Value (Single-App): 0” then
f.Execute (“defaults write com.apple.dock single-app -boolean true; killall Dock”)
end if
App.SleepCurrentThread(300)
Dim s2 As Shell
s2 = New Shell
#If TargetMacOS Or TargetLinux Then
s2.Execute(“defaults read com.apple.dock single-app”)
#Endif
Label4.Text=("Current Value (Single-App): " + s2.Result)
OpenApps.Enabled=true
ProgressWheel1.Visible=false[/code]
For some reason, the middle block (which actually toggles the value) fails to disable it and only enables it.
Any ideas for some diff. code which works or something to fix in my code?