New topic: 

Mac clipboard & program timing problem

<http://forums.realsoftware.com/viewtopic.php?t=47473>

         Page 1 of 1
   [ 1 post ]                 Previous topic | Next topic          Author  
Message        Nicolas          Post subject: Mac clipboard & program timing 
problemPosted: Tue Apr 02, 2013 2:43 am                         
Joined: Sat Mar 30, 2013 6:02 am
Posts: 2                Hi,
I’m looking to capture the clipboard when cmd + c keystrokes are pressed and 
then to append some text in the clipboard.

Cmd + c on the string: “Hello”
Cmd + v result: “Hello –> added text”

This is my code, but I cannot make it work. I think it may be something to do 
with the copy in clipboard on Mac timing and my program.

// Global variables: cmdDown & cDown
// Controls: TextField1 & Timer1
// Timer1 period: 10
// ----------------------------------

// Code in Timer:

// Test for the cmd down
if Keyboard.AsyncCommandKey And cmdDown = False Then
  cmdDown  = True
ElseIf Keyboard.AsyncCommandKey = False And cmdDown = True Then
  cmdDown  = False
end if

// Test for the cmd + c key down
if Keyboard.AsyncKeyDown(08) And cDown = False And cmdDown  = True Then
  //TextField1.AppendText( "cmd + c key down" + EndOfLine)
  cDown = True
  
  // --> I guess I need a way to test here if the Mac Copy in Clipboard is 
finished before replacing it with the following:
  
  // Get the clipboard
  Dim clipboard As New Clipboard
  If clipboard.TextAvailable Then
  TextField1.AppendText( "BEFORE: " + clipboard.Text + EndOfLine)
  clipboard.SetText(clipboard.Text + " --> added some text")
  TextField1.AppendText( "AFTER: " + clipboard.Text + EndOfLine)
  End if
  clipboard.Close
  
ElseIf  Keyboard.AsyncKeyDown(08) = False And cDown = True Then
  cDown = False
end if


Thanks,
Nicolas   
                             Top             Display posts from previous: All 
posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost 
timeSubject AscendingDescending          Page 1 of 1
   [ 1 post ]      
-- 
Over 1500 classes with 29000 functions in one REALbasic plug-in collection. 
The Monkeybread Software Realbasic Plugin v9.3. 
http://www.monkeybreadsoftware.de/realbasic/plugins.shtml

[email protected]

Reply via email to