Set the clipboard to pbdata - Load previous data back onto clipboard Menu bar items of menu bar 1 of (the first process where ¬įrontmost = true) where name = "Paste") to click item 1 Tell application "System Events" to tell (menu items of menus of ¬ Set the clipboard to the IPv4 address of (system info) set pbdata to the clipboard as record - Original clipboard data This is probably fine for most situations, but wouldn't work if you were in an application that didn't have a visible menu bar, or didn't have a "Paste" menu item. The disadvantage of this is the invocation of System Events to perform the action of pasting by way of programmatically clicking on the "Paste" menu item. This lets AppleScript store the original clipboard data to a variable without having to write out to a file, and everything gets handled in one script. Have AppleScript retrieve your computer's IP address and do the pasting for you. Here's how both options might be implemented with AppleScript: I can't think of a way that doesn't use the clipboard that would work consistently in any application. Unless Better Touch Tool provides me a way of storing it in a variable somehow or I save it to a file If I overwrite my clipboard, my previous data is lost. I asked for a way of pasting my IP without the clipboard (I said I knew about it, because I did it.) I want to maintain my clipboard data.
0 Comments
Leave a Reply. |