[b]NOTES: I’ve obviously changed the real usernames into just “username” and I have set the passwords as “oldpassword” and “newpassword” for the sake of demonsration.
sh: line 2: spawn: command not found
couldn’t read file “Password:”: no such file or directory
sh: line 6: send: command not found
couldn’t read file “eof”: no such file or directory
So looks like it doesn’t like it …
If I Put it all into 1 line it I don’t get any compile errors but the script still doesn’t work …
set TheExpect to do shell script "#!/usr/bin/expect --" & return & "spawn pwpolicy -a username -u username -setpassword newpassword" & return & return & "expect Password:" & return & "send \"oldpassword" & return & "\"" & return & "expect eof"
Those errors are look like the problem is in the Shell script its self.
Does you shell script Actually work when you run it as an executable??
**edit
As an example to show the script should work in this form if there is now problem with the shell script.
run the script below. it will wait 10 seconds and then pop up your login window. (don’t worry it will not log you out, just it hit the cancel in the login window"
set t to do shell script "sleep 10
idl=$\"`ioreg -c IOHIDSystem | awk '/HIDIdleTime/ {print int($NF/1000000000); exit}'`\"
idletime=\"8\"
if [ $idl -gt $idletime ]; then
echo $idl,$idletime
/System/Library/CoreServices/Menu\\ Extras/User.menu/Contents/Resources/CGSession -switchToUserID 502
fi"
As you did not explain that,
I assumed you where using the script on your G4 ‘10.4’ ( looked at a previous post of yours to see what you had)
It may be a good idea to put “I’m running OS X Server 10.4.11” and any other info that can get the right person and help for your request.