fed Posted January 27, 2014 Posted January 27, 2014 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
Rick Whitelaw Posted January 27, 2014 Posted January 27, 2014 (edited) 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 January 27, 2014 by Rick Whitelaw
comment Posted January 28, 2014 Posted January 28, 2014 I was wondering if there was a way to put the clipboard contents into a variable without putting it into a field first. Not natively, yes with a plugin such as BaseElements.
bruceR Posted January 28, 2014 Posted January 28, 2014 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. 2
fed Posted January 28, 2014 Author Posted January 28, 2014 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
comment Posted January 28, 2014 Posted January 28, 2014 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.
bruceR Posted January 28, 2014 Posted January 28, 2014 "If I paste it to a global field, I seem to loose all carriage returns and/or line feeds." What makes you say that? (You will have to define the global field as a text field) See attached. WVCopy.fp7.zip
Wim Decorte Posted January 28, 2014 Posted January 28, 2014 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.
fed Posted January 29, 2014 Author Posted January 29, 2014 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.
comment Posted January 29, 2014 Posted January 29, 2014 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.
fed Posted January 31, 2014 Author Posted January 31, 2014 It seems that GetLayoutObjectAttribute() only gives me the HTML code on the dynamic page, not the resulting text. Am I missing something?
comment Posted January 31, 2014 Posted January 31, 2014 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.
fed Posted January 31, 2014 Author Posted January 31, 2014 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.
comment Posted January 31, 2014 Posted January 31, 2014 If that is the case, then you indeed have no choice other than copy the rendered content and paste it somewhere for further processing. So it seems we are back to the carriage returns question. Any chance of enabling us to reproduce the issue?
Recommended Posts
This topic is 3948 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 accountSign in
Already have an account? Sign in here.
Sign In Now