iMacros: Why I have "undefined" value time to time? - imacros

I have the iMacros code bellow and I don't understand why sometime, not always {{draft18claim}} receive undefined Value or 0.0.0.2.
the script is made to go to a link once at 2 loops.
SET filterdraft18claim "videos/upload?filter=%5B%7B"name"%3A"VISIBILITY"%2C"value"%3A%5B"DRAFT"%5D%7D%2C%7B"name"%3A"AGE_RESTRICTION"%2C"value"%3A"NOT_AGE_RESTRICTED"%7D%2C%7B"name"%3A"HAS_COPYRIGHT_CLAIM"%2C"value"%3A"VIDEO_HAS_COPYRIGHT_CLAIM"%7D%5D&sort=%7B"columnType"%3A"date"%2C"sortOrder"%3A"DESCENDING"%7D"
SET draft18claim EVAL("var n='{{!LOOP}}'; var z; if((n%2)==1){z=\"https://studio.youtube.com/channel/{{idcanal}}/video/{{filterdraft18claim}}\";} else{z=\"javascript:window.scrollBy(0,5)\";}; z;")
URL GOTO={{draft18claim}}
Error
RuntimeError: Navigation error occured while loading url http://undefined/, details: net::ERR_NAME_NOT_RESOLVED, line: 65
thank you
I am using (FCI): iMacros for CR v10.1.1 'PE', CR v105.0.5195.102 (_x64), Win10_x64. ('CR' = 'Chrome' / 'PE' = 'Personal Edition')

Related

Javascript/php - After page Refresh, return to page anchor

I have a single page with numerous html anchor points.
I need to refresh the page every 10 seconds to get new incoming data from my database, the page refresh does this.
What I need is if, I am viewing another anchor point which is another page, I wish to be returned to that anchor point after the refresh happens.
Here is what I have, which runs fine but doesn't return me to the anchor I was viewing:
function refresh() {
if(new Date().getTime() - time >= 10000)
window.location.reload(true);
}
This above, refresh's the page then returns me to the default anchor point #menu
I have also tried this to be returned to the current view anchor point, but this doesn't work, it won't even run:
function refresh() {
if(new Date().getTime() - time >= 10000)
window.location.href = 'driver.php#<?php echo $_SESSION['loc'];?>';
window.location.reload(true);
}
Also tried it without the php coding it still won't run:
function refresh() {
if(new Date().getTime() - time >= 10000)
window.location.href = 'driver.php#show_requests';
window.location.reload(true);
}
Any help is much appreciated.
As I couldn't work out a result to use the one page, I solved the issue by using multiple pages and just set a refresh on each individual page. A bit messy, but it works.

Parsing email with Google Apps Script, regex issue?

I used to be quite proficient in VBA with excel, but I'm currently trying to do something with Google Scripts and I am well and truly stuck.
Basically, I am trying like to extract data out of a standardised email from Gmail into a Google sheet. There are a couple of other threads on the subject which I have consulted so far, and I can get the body of the email into the sheet but cannot parse it.
I am new to regex, but it tests OK on regex101
I am also brand new to Google Script, and even the debugger seems to have stopped working now (it did before, so would be grateful if anyone can suggest why this is).
Here is my basic function:
function processInboxToSheet() {
var label = GmailApp.getUserLabelByName("NEWNOPS");
var threads = label.getThreads();
// Set destination sheet
var sheet = SpreadsheetApp.getActiveSheet();
// Get all emails labelled NEWNOPS
for (var i = 0; i < threads.length; i++) {
var tmp,
message = threads[i].getMessages()[1], // second message in thread
content = message.getPlainBody(); // remove html markup
if (content) {
// search email for 'of:' and capure next line of text as address
// tests OK at regex101.com
property = content.match(/of:[\n]([^\r\n]*)[\r\n]/);
// if no match, display error
var property = (tmp && tmp[1]) ? tmp[1].trim() : 'No property';
sheet.appendRow([property]);
} // End if
// remove label to avoid duplication
threads[i].removeLabel(label)
} // End for loop
}
I can append 'content' to the sheet Ok, but cannot extract the address text required by the regex. Content displays as follows:
NOPS for the purchase of:
123 Any Street, Anytown, AN1 1AN
DATE: 05/05/2017
PRICE: £241,000
Seller’s Details
NAME: Mrs Seller
Thanks for reading :)
The return value of .match() is an array. The first captured group, containing the address, will be at index 1.
Based on the following line after your call to .match(), it looks like the tmp variable should have been assigned that array, not the property variable.
var property = (tmp && tmp[1]) ? tmp[1].trim() : 'No property';
That line says, if .match() returned something that isn't null and has a value at index 1, then trim that value and assign to property, otherwise assign it the string 'No property'.
So, try changing this line:
property = content.match(/of:[\n]([^\r\n]*)[\r\n]/);
To this:
tmp = content.match(/of:[\n]([^\r\n]*)[\r\n]/);
Thanks Kevin, I think I must have changed it while debugging.
The problem was with my regexp in the end. After a bit of trial and error the following worked:
tmp = content.match(/of:[\r\n]+([^\r\n]+)/);

jomsocial force status refresh

I am getting crazy to make jomsocial 2.6.2 with joomla 2.5.7 to works.
The problem is that when a user change the status the message is not reflecting in the wall.
Only if you refresh the page or switch view all to me and Friends view.
There no js error in the console and i get:
Jax.submitTask ajax_1.3.js:1
Jax.call ajax_1.3.js:1
joms.extend.activities.getLatestContent script-1.2.js:226
reloadActivities myaccount:1129
(anonymous function)
But no refresh anybody know how to force the wall so i can add a line after:
Status.submit
in
status.form.php
any tip welcome 2 days already trying...
Thanks a lot
I can believe that it is working
I add this line at the status.forum.php forcing to load all status
line 255
complete: function()
{
CreatorLoadingIndicator.hide();
joms.ajax.call('frontpage,ajaxGetActivities', [ 'all' ])
Status.reset();
Status.submitting = false;
}

How to match and return part of an HTML file in ASP

I'm looking to match a part of several HTML files that get passed into a loop in an ASP file and then return that part of the HTML files to include in my output. Here's my code so far:
<%for i=0 to uBound(fileIDs) ' fileIDs is an array of URLs
dim srcText, outText, url
Set ex = New RegExp
ex.Global = true
ex.IgnoreCase = true
ex.Pattern = "<section>[\S\s]+</section>" ' This finds the HTML I want
url = fileIDs(i)
Set xmlhttp = CreateObject("MSXML2.ServerXMLHTTP")
xmlhttp.open "GET", url, false
xmlhttp.send ""
srcText = xmlhttp.responseText
outputText = ex.Execute(mediaSrcText) ' I expect this to be the HTML I want
Response.Write(outputText.Item(0).Value) ' This would then return the first instance
set xmlhttp = nothing
next %>
I've tested the regular expression on my files and it's matching the parts that I want it to.
when I run the page containing this code, I get an error:
Microsoft VBScript runtime error '800a01b6'
Object doesn't support this property or method
on the line with ex.Execute. I've also tried ex.Match, but got the same error. So I'm clearly missing the proper method for returning the match so I can write it out into the file. What is that method? Or am I approaching the problem from the wrong direction?
Thanks!
You need a Set when you're assigning outputText:
Set outputText = ex.Execute(mediaSrcText)
I should probably also say that you really shouldn't be using regular expressions to attempt to parse HTML, although I don't know enough about the context to offer more specific advice.

getElementsByTagName setAttribute and regex javascript

i want to put rel=lightbox to some links that mediabox support using javascript.
i try this and wonder why it's not working?
test: http://jsbin.com/opica
please help edit this: http://jsbin.com/opica/edit
<script type="text/javascript">
var x=xmlDoc.getElementsByTagName("a");
var regexku=/^.+(((twit)|(tweet)|(com/video.+)|(flickr.com.+)|(tube.com.+))|((gif)|(jpe?g)|(png)|(flv)|(swf)|(mp3)|(mp4))$)/;
for(i=0;i<x.length;i++)
{
a=x[i].getAttribute('href');
if (a.match(regexku) != null)
{
x.item(i).setAttribute("rel","lightbox");
}
}
</script>
So if you open the Error Console (Tools -> Error Console in Firefox), you'll see two errors on your page:
Error: xmlDoc is not defined
Source File: http://jsbin.com/opica
Line: 35
Error: invalid regular expression flag v
Source File: http://jsbin.com/opica
Line: 21, Column: 38
Source Code:
var regexku=/^.+(((twit)|(tweet)|(com/video.+)|(flickr.com.+)|(tube.com.+))|((gif)|(jpe?g)|(png)|(flv)|(swf)|(mp3)|(mp4))$)/;
The later is fixed by escaping the slash as Bart suggested (com\/video).
The former says there's no such thing as xmlDoc. You probably meant the page's document, in which case you should replace it with document.
Next the whole thing probably won't work because you should run the script after the page is finished loading. In jQuery it's $(document).ready(function() { /* do your work here */ }), google how to do it using the whatever framework you're using (mootools-yui?).
After that as you can see, the rel attribute is set on the links: http://jsbin.com/elaca/edit. The fact that the whatever library you're using still doesn't work means you're using it wrong. You didn't even link to the page you've downloaded the library from so that someone could look up the documentation for you...
Try escaping the / between com and video.