Jump to content

dfobare

Members
  • Posts

    8
  • Joined

  • Last visited

dfobare's Achievements

Seeker

Seeker (1/7)

0

Reputation

  1. Ok, now I'm frosted. I decided to try a _IETagNameGetCollection($oIE, "textarea") to grab the form's textareas and loop thru the collection and do a IEFormElementSetValue on the one named 'content'. I used a msgBox call to verify that I got it, and indeed I did. But the IEFormElementSetValue still didn't deposit any text. BUT I also tried stuffing some text into one of the other textareas available when making a post to WP: the "excerpt" box. Its a ways down the page. And that textarea is stuffed just fine by a IEFormElementSetValue call. But not the all important 'content' textarea. I'm stumped.
  2. I should also note a couple of other strange behaviors. First I can post to the Title field just fine - IF I use a $oQuery3 = _IEFormElementGetObjByName ($oTextForm, "title") command. I mention this because the name of the Title field is really "post-title". But if I use "post-title" instead of "title", the code doesn't work. I find it curious that the "id" attribute of this INPUT to be "title". As though the _IEFormElementGetObjByName UDF is really grabbing by "id" and not "name". Of course, this doesn't help with the textarea; its id and name attributes are both 'content'. I wonder if the fact that those attributes on the textarea are encased by single quotes and not double makes a difference.
  3. I ought to note that I have tried alternative UDF's like _IEFormGetCollection and _IEFormElementGetCollection and they have failed as well. If you're reading this, is there any other info I need to provide to enlist your help?
  4. So then you use just the email facility, yes? Here is a weird thing: today I got this script to work just fine on my work machine, but it fails on my home machine. Here is the total script: #include <IE.au3> #include <file.au3> $oIE = _IECreate ("www.thisismysite.com/RecentSubmissions.php") $sHTML = _IEBodyReadHTML ($oIE) _IELoadWait($oIE) _IENavigate ($oIE,"www.thisismysite.com/blog/wp-admin") _IELoadWait($oIE) Sleep(1000) $oForm = _IEFormGetObjByName ($oIE, "loginform") $oQuery = _IEFormElementGetObjByName ($oForm, "log") _IEFormElementSetValue ($oQuery, "admin") $oQuery2 = _IEFormElementGetObjByName ($oForm, "pwd") _IEFormElementSetValue ($oQuery2, "mypwd") _IEFormSubmit ($oForm, 0) _IELoadWait($oIE) _IELinkClickByText ($oIE, "Write") _IELoadWait($oIE) Sleep(1000) $oTextForm = _IEFormGetObjByName ($oIE, "post") $oQuery3 = _IEFormElementGetObjByName ($oTextForm, "content") _IEFormElementSetValue ($oQuery3, $sHTML) On IE7 at work this is going just fine. But here at home on IE7 where I really need to use this, the script stops gracefully after click on "Write". Any ideas?
  5. Monamo: thx for the reply. I was working mine the same time you were working on yours, so I didn't see it. Sorry. My goal with this script is to run a server-side PHP script that produces some automated content based on a mysql query, scrape the screen for the results, then log in to WP, start a new post, then dump the PHP output into the textarea. The script ends there, as I then manually add a couple of sentences or paragraphs commentary before clicking the Publish button. That's the direct route. I considered the email idea. Basically after scraping the browser for the PHP results, I email them to my WP, then open up WP itself, and choose to edit the post I just set up thru the email. This brings up a couple of considerations: 1) I've heard that enabling WP posting via email is a bit of a security hole. Probably not a big deal though. 2) I'd like the posting email to have WP set up a new post with it, but not actually publish. That can probably be done; I need to look at the WP docs more thoroughly. 3) Assuming #2 is successfully completed, I still have to get AutoIt to focus on the textarea that holds the emailed post once I navigate to the Edit screen. Since I can't yet do that on the Write page, I can't imagine I'd be able to do that on the Edit page. Still, this is something I'm going to explore. Dave
  6. Ok, I guess I'll post my code on this. Here is the segment that works: ; #include <IE.au3> $oIE = _IECreate ("www.thisismyblog.com/blog/wp-admin") Sleep(1000) $oForm = _IEFormGetObjByName ($oIE, "loginform") $oQuery = _IEFormElementGetObjByName ($oForm, "log") _IEFormElementSetValue ($oQuery, "admin") $oQuery2 = _IEFormElementGetObjByName ($oForm, "pwd") _IEFormElementSetValue ($oQuery2, "mypassword") _IEFormSubmit ($oForm, 0) _IELoadWait($oIE) _IELinkClickByText ($oIE, "Write") _IELoadWait($oIE) Sleep(1000) Standard stuff; as an inexperienced AU coder this was pretty quick and easy to write. Here comes the code that doesn't: $oTextForm = _IEFormGetObjByName ($oIE, "post") $oQuery3 = _IEFormElementGetObjByName ($oTextForm, "content") _IEFormElementSetValue ($oQuery3, "this is a test") From reading the docs I get there might be a problem with the above thanks to Javascript onclick handlers. I've tried the alternatives but had no luck. Can anyone point the way?
  7. So you're trying to build a bot to help you bonus hustle, right?
  8. I'm trying to build a script that logs into WP and starts a post. I'm able to log in, click on "Write" to start a new post. But everything I try to do from there is a failure. I can't seem to get ahold of the posting form, or the textarea that holds the content. I've tried clicking on "HTML" as an alternative but can't do that either. Has anyone here written an autoposter before?
×
×
  • Create New...