Jump to content

Clipboard to variable


This topic is 3731 days old. Please don't post here. Open a new topic instead.

Recommended Posts

I was wondering if there was a way to put the clipboard contents into a variable without putting it into a field first.  

 

Thanks,

 

Fed

Link to comment
Share on other sites

Not that I know of, but if the data can be copied to the clipboard in the first place, then it should be available to the SetVariable script step without using the clipboard.

 

Of course I assume you mean to automate this. You can always copy the data to the clipboard and paste it into the SetVariable (specify) dialog.

Edited by Rick Whitelaw
Link to comment
Share on other sites

It might also be useful to describe why you want to do this, including the source of the clipboard; and why using a field is not desirable. Note that the field could be a global field.

  • Like 2
Link to comment
Share on other sites

The text in the clipboard is from the web viewer. It is The only way I found to get text from a webpage I need to access regularly. I'm trying not to use a browser and applescripts (which is what I'm using now).

If I paste it to a global field, I seem to loose all carriage returns and/or line feeds.

How do I paste it to the de variable dialogue using a script?

I've tried plugins before, but they have messed my database up so much, I'll never try it again.

Thanks for your help

Link to comment
Share on other sites

It looks like you are concentrating more on the things you're trying to avoid (fields, AppleScript, plugins) - all useful tools when used properly - then on the task at hand, which is not quite clear. Can't you get the text you need through scraping the content of the web viewer?

There's one thing I am fairly certain of: if the clipboard contains carriage returns, then so will the field you paste into; if it doesn't, then passing the clipboard to a variable will not create them.

Link to comment
Share on other sites

The text in the clipboard is from the web viewer. It is The only way I found to get text from a webpage I need to access regularly. 

 

I'm with Comment on this: disregarding valid tools is not the right approach.  Also, using the clipboard and potentially destroying what the user has on it (and wants to keep on it, is considered bad form.

 

Note that you can get the content from a web viewer directly through the GetLayoutObjectAttribute function.

Link to comment
Share on other sites

Actually, I'm not trying to avoid anything. I have just tried all those things, and then of them work. I have even tried GetLayoutObjectAttribute, but that gives you the full HTML, which in these cases are huge. I am only interested in the resulting text.

 

I am trying to scrape the web viewer, that is entirely the point. Is there a way to do this using FileMaker? I was not aware that was something FMP offered. I have searched long and hard for that. Could you please point me in the right direction?

 

If I manually copy the contents of the web viewer onto the clipboard, and then paste it to a text program, such as TextEdit (on OSX), then the carriage returns and/or linefeeds work just fine. If I paste the exact same thing, again manually, into a field (which is global and is a text field) then these carriage returns and/or linefeeds disappear. It is all just one long paragraph. I'm not sure what is going on, it seems a bit strange to me.

 

Thanks again for commenting on this.

Link to comment
Share on other sites

If I manually copy the contents of the web viewer onto the clipboard, and then paste it to a text program, such as TextEdit (on OSX), then the carriage returns and/or linefeeds work just fine. If I paste the exact same thing, again manually, into a field (which is global and is a text field) then these carriage returns and/or linefeeds disappear. It is all just one long paragraph. I'm not sure what is going on, it seems a bit strange to me.

 

It seems strange to me too. Could you post an URL, so that we can try and reproduce the issue?

 

 

I am trying to scrape the web viewer, that is entirely the point.

 

By "scraping the web viewer" I meant processing the result of GetLayoutObjectAttribute() - i.e the entire HTML. Again, it's hard to be specific without seeing the actual HTML code, but usually there will be an "anchor" you can hook onto in order to parse out the data you need. It's not an ideal method, but IMHO it's the best route to follow if the data cannot be accessed through a web service or some other form of API.

Link to comment
Share on other sites

It seems that GetLayoutObjectAttribute() only gives me the HTML code on the dynamic page, not the resulting text.

Am I missing something?

Link to comment
Share on other sites

I am not sure what you mean by "the dynamic page". Usually (but not always) the text is found inside the HTML code. HTML is a mark-up language and HTML code contains text (data) and mark-up (metadata). The idea of "scraping" is to extract the data and discard the mark-up.

Link to comment
Share on other sites

The page is JavaScript and extracts info from a database and presents it on the webpage.

The HTML has no text. The text is generated by JavaScript.

Link to comment
Share on other sites

This topic is 3731 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.