Select a field/line in Excel and copy in another application

Tinderbox is NOT AppleScriptable.

This works:

-----------------------------------------------------------------------
# This script assumes a SINGLE column of values in the front worksheet in Excel.
-----------------------------------------------------------------------

tell application "Microsoft Excel"
  tell active sheet of active workbook
    set valueList to value of used range
  end tell
end tell

if valueList ≠ "" then
  
  repeat with i in valueList
    set contents of i to item 1 of (contents of i)
  end repeat
  
  tell application "System Events"
    
    if quit delay ≠ 0 then set quit delay to 0
    
    set frontmost of application process "TinderboxSix" to true
    
    repeat with i in valueList
      set the clipboard to (contents of i)
      delay 0.2
      keystroke "v" using {command down}
      delay 0.2
      key code 36
    end repeat
    
  end tell
  
end if

-----------------------------------------------------------------------

The delay might have to be adjusted for systems other than mine.

[Edit 2015/06/19 20:32 CST — changed delay times.]

Oh, I note that you cannot paste into a new Tinderbox document without first clicking in the entry pane.

Tinderbox is finicky about how fast you paste data into it.

-Chris

-----------------------------------------------------------------------
# This Script works with the single SELECTED column in Excel.
-----------------------------------------------------------------------

tell application "Microsoft Excel"
  tell active window
    set valueList to value of selection
  end tell
end tell

repeat with i in valueList
  set contents of i to item 1 of (contents of i)
end repeat

# valueList

tell application "System Events"
  
  set frontmost of application process "TinderboxSix" to true
  
  repeat with i in valueList
    set the clipboard to (contents of i)
    delay 0.2
    keystroke "v" using {command down}
    delay 0.2
    key code 36
  end repeat
  
end tell

Hi Chris,
The first part of your code works.
The second part fails to open a note.

To make a note (where you want to input one cell of Excel), you have to double click on the mouse pad of TBx (Tinder ). You need a keyboard shortcut.

I tried making a note and then pasting (command V). The whole Excel column was pasted in instead of the specific cell.

Here is the clunky thing I did, but It did not work to paste in one cell at a time and then make a new note. I think it is stuck in not knowing how to make a new note.

Ellen Madono

Hey Ellen,

You never specified a new note should be opened. [ Edit: I was thinking document — notes are not so much opened as created within the context of the document.]

I did mention problems with this:

What you've done with the AppleScript cannot work.

You can't split up programming that shares variables without somehow passing those variables.

Your macro provides no pause to allow selecting a column in Excel.

In general user-intereaction is not desired in an automated process. It slows things down and creates more opportunities for error.

It would be better to have an Excel document with ONE column and use the used range script rather than the selected column script if reasonably possible.

If you really want to sort this out then send me a proper example of the Excel file you're working with to: listmeister@thestoneforge.com

-Chris

As far as I can see Tinderbox provides no formal method of moving the focus into the Map pane other than:

A) Creating a new document.

B) Clicking within the map side of the front document

C) Using the menu View > Tab > Previous (or Next) to move out of the Map view and then back again.

It does not seem to respect normal accessibility methods using System Events, so while SEV can see the map pane it cannot change the focus to the map pane.

The only way I see around this is to click at some specific starting point within the map pane before beginning to paste notes.

-Chris