Clipboard Anomally [BUG]?

Kay C Lan lan.kc.macmail at gmail.com
Thu Nov 9 01:47:40 CST 2006


Well folks with the opportunity to spend all yesterday scripting, what
did I do. I went bug hunting. I've never submitted a bug into Bugzilla
but I felt it was time I stepped up and gave it a shot so I went after
the 'IDE anomaly' that irks me most.

The occasional failure of the IDE to paste the contents of the clipboard.

Here is my recipe. Sorry this is Mac specific as it uses Automator - I
guess there is some Windows equivalent of Automator which might
produce a similar result.

Basically when you run this script nothing ends up in field "Text",
nothing in the msg box, but if you select any other application that
handles text and select 'Paste' or the keyboard shortcut, the contents
of your file will be pasted. Going back to Rev and using either the
keyboard or the menu will NOT paste anything into field "Text".

TextEdit Test
Step 1: Start TextEdit, create a new document and enter some text.
>From the 'Format' menu select "Make Plain Text" and save to your
desktop with a useful name like 'Input.txt' I left the Encoding as
'Western (Mac OS Roman)'

Step 2: If you are familiar with Automator:
	i) Finder action to "Ask For Finder Items"
	ii) Finder action to "Open Finder Item" Open with "TextEdit"
	iii) TextEdit action to "Get Contents of TextEdit Document"
	iv) System action to "Copy to Clipboard"
	v) TextEdit action to "New Text File" Save as "Output.txt" to 'Desktop'
	
	
If you are not familiar with Automator:
	a) Select 'New' from the 'File' menu.
	b) Choose 'Finder' in Library column, Applications folder.
	c) Select from the 'Action' Column: "Ask for Finder Items"
The defaults should be: Type: Files, Start at: Desktop, Allow Multiple: No
	d) Select from the 'Action' Column: "Open Finder Items"
Change "Open with:" from the Default Application to "TextEdit"
	e) Choose 'TextEdit' in the Library column
	f) Drag "Get Contents of TextEdit Document" from the Action column to
the Automator window.
	g) Drag "Copy to Clipboard" from the Action column to the Automator window.
	h) Choose 'TextEdit' from the Library column.
	i) Drag "New Text File" from the Action column to the Automator window.
Set 'Save as' to "Output.txt" and 'Where' to "Desktop"


Step 3: Save as... "Text to CB TextEdit" as an application. The name
must be the same as used in the Rev script.

Step 4: Click the Automator 'Run' button to confirm that it operates
as expected (delete the Output.txt file created on your desktop)

Step 5: In Rev create a new stack with one button "Start" and one field "Text"
Step 6: In the button place the following script:

Be careful of line breaks, line numbers are commented at the end.

on mouseUP  --1
set the clipboardData["text"] to empty  --2
	do "tell application" & quote & "Text to CB TextEdit" & quote &
return & "run" & return & "end tell" & return & "tell application" &
quote & "Revolution" & quote & return & "activate" & return & "end
tell" as AppleScript  --3
    --do "tell application" & quote & "Text to CB BBEdit" & quote &
return & "run" & return & "end tell" & return & "tell application" &
quote & "Revolution" & quote & return & "activate" & return & "end
tell" as AppleScript  --4
    wait 10 seconds  --gives Automator time to do it's thing  --5
    select text of field "Text"  --6
    paste  --7
    --the breakpoint is here so that you can use the Variable Watcher
to see that tMyStore initially contains "empty" then it is empty.  --8
    breakpoint  --9
    put the clipboard into tMyStore  --10
    put the clipboardData["Text"] into tMyStore  --11
    put tMyStore into msg  --12
end mouseUp  --13

You'll notice in the script above a 'do' statement at line 4 which has
been commented out. Because TextEdit isn't the most powerful text
editor around I thought I'd give it another go using BBEdit, and one
further step, converting the file contents to ASCII. I imagine this
might be possible with the free TextWrangler if you don't own BBEdit.

BBEdit Test
Step 7: Now that you are familiar with Automator:
	i) Finder action to "Ask For Finder Items"
	ii) Finder action to "Open Finder Item" Open with "TextEdit"
	iii) BBEdit action to "Get Contents of BBEdit Document"
	**iv) BBEdit action to "Convert to ASCII"**
	v) System action to "Copy to Clipboard"
	vi) BBEdit action to "New BBEdit Document" Save as "Output.txt" to 'Desktop'

Step 8: Save as... **"Text to CB BBEdit"** as an application. The name
must be the same as used in the Rev script.

Step 9: Click the Automator 'Run' button to confirm that it operates
as expected (delete the Output.txt file created on your desktop)

Step 10: In the button script comment the first 'do' statement and
uncomment the second one.

Looking for confirmation that others experience a clipboard full of
text that only Rev doesn't want to touch and believe this is a bug.



More information about the use-livecode mailing list