AppleScript keystroke in cocoa / obj-c application?

Up vote 0 down vote favorite share g+ share fb share tw.

I create this applescript (logout. Scpt) which close active user session : tell application "System Events" to keystroke "q" using {command down, option down, shift down} In my cocoa app, I have a logout button and an IBAction link this button. With an NSLog in this IBAction and when I click on my button, NSLog work.

But, if I put this code in my IBAction, nothing appends : NSTask *logout = NSTask alloc init; logout setLaunchPath:@"/usr/sbin/logoutkill"; logout launch; Content of logoutkill bash script: #! /bin/bash /usr/bin/osascript /usr/sbin/logout. Scpt If I launch this bash script in a terminal with the same user, it's work and session close.

Why my code doesn't work? Xcode cocoa applescript nstask keystroke link|improve this question edited Jan 26 at 13:15VJovic14.7k51846 asked Jan 21 at 14:51user115026661.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions