I am trying hard … :mad::mad::mad:
I simplified the file path, and placed the shell script in the first root level of my User (called “Nous”). There will be no accentuated characters (like «Ã©, è, etc …») to interfere with Terminal. The path to the shell script is now: Macintosh HD/Users/Nous/SwitchToUser508.sh. This is the content of the .sh file:
This is the content of my SwitchToUser508.sh file:
#!/bin/bash
idl=$“ioreg -c IOHIDSystem | awk '/HIDIdleTime/ {print int($NF/1000000000); exit}'
”
idletime=“5”
if [ $idl -gt $idletime ]; then
/System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -switchToUserID 508
/usr/bin/osascript <<EOT
delay 5
set password_ to “”
tell application “System Events”
delay 1
tell process “SecurityAgent” to set value of text field 1 of group 1 of window 1 to password_
click button “Log In” of window 1 of application process “SecurityAgent”
end tell
EOT
fi
Is it OK the put «“”» as the password since there is no password for the 508 user ?
I then runned the script below in Terminal:
chmod +x /Macintosh\ HD/Users/Nous/SwitchToUser508.sh
sleep 30
/Macintosh\ HD/Users/Nous/SwitchToUser508.sh
I got a «No such file or directory» message:
Nous:~ Nous$ chmod +x /Macintosh\ HD/Users/Nous/SwitchToUser508.sh
chmod: /Macintosh HD/Users/Nous/SwitchToUser508.sh: No such file or directory
Nous:~ Nous$ sleep 30
Since the system is localized in french, I also tested it with «Utilisateurs» instead of «Users», and got the same error message. I also tried to run the content of the SwitchToUser508.sh file directly in Terminal and got this result:
Nous:~ Nous$ #!/bin/bash
-bash: !/bin/bash: event not found
Nous:~ Nous$ idl=$“ioreg -c IOHIDSystem | awk '/HIDIdleTime/ {print int($NF/1000000000); exit}'
”
Nous:~ Nous$ idletime=“1200”
Nous:~ Nous$ if [ $idl -gt $idletime ]; then
/System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -switchToUserID 508
/usr/bin/osascript <<EOT
delay 5
set password_ to “”
tell application “System Events”
delay 1
tell process “SecurityAgent” to set value of text field 1 of group 1 of window 1 to password_
click button “Log In” of window 1 of application process “SecurityAgent”
end tell
EOT
fi
What is the problem ? Thanks again …
Browser: Safari 525.18
Operating System: Mac OS X (10.4)