Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

[Bug] Incorrect URL path segment matching

93 views
Skip to first unread message

Yu Ho

unread,
Apr 10, 2025, 3:12:49 PMApr 10
to AutoControl Community Forum
I added 3 actions under the same domain but with a different path segment or trigger:
/^https:\/\/fake.tld\/db/ - trigger: middle click
/^https:\/\/fake.tld\/album/ - trigger: mouse 4
/^https:\/\/fake.tld\/album/ - trigger: mouse 5

It seems AutoControl is unable to work properly since it's still fetching data even if the url pattern is not a match like if middle click is pressed, it will still gather data from /^https:\/\/fake.tld\/album/.

Message has been deleted
Message has been deleted

cw noway

unread,
Apr 10, 2025, 10:09:53 PMApr 10
to AutoControl Community Forum
I am NOT AC support, just a guy trying to help.

Try the three Actions in the attached pic.

Hopefully it helps,

cw

Response to ( 10 Apr 2025 - I added 3 actions under the same domain but with a different path segment or trigger - AutoControl Forum ).png

Response to ( 10 Apr 2025 - I added 3 actions under the same domain but with a different path segment or trigger - AutoControl Forum ).png

Yu Ho

unread,
Apr 15, 2025, 1:38:11 PMApr 15
to AutoControl Community Forum
Thanks for your response. Unable to make this work with Run Script actions that already specify   /^https:\/\/vgmdb.net\/db\/collection.php?do=view/ (not  /^https:\/\/fake.tld\/db/, my bad)  and  /^https:\/\/fake.tld\/album/

cw noway

unread,
Apr 15, 2025, 5:40:30 PMApr 15
to AutoControl Community Forum
/*

NO PROBLEM.  Here's an easy fix given the new information you provided.  (READ BELOW AND SEE ATTACTED PIC ALSO)

In the "Action" that you are referring to, remove all (if present) conditions below your "Trigger,"
such as "URL: Path  does  match exactly /db"



Make sure a "Run Script" is your first "Action" item.

Place the following code (shown below) at the top of that "Run Script."  Or copy and paste this COMPLETE RESPONSE at the top of that "Run Script."

If your first action item is already a "Run Script," paste it in there.  Or, you can create a brand new "Run Script,"
paste it over the default "Hello World" text, and then MOVE THE "RUN SCRIPT TO THE LEFT, making it the "first" "Run Script."

THE CODE WILL DO THE FOLLOWING:

STEP 1:  Test the current URL.  

If the current URL DOES NOT begin with: "https://vgmdb.net/db/collection.php?do=view/"

NOTHING ELSE (within this script), nor any following "Action items" in the chain will be executed.

*/

var url = document.URL;
var bool = false;

bool = /^https:\/\/vgmdb.net\/db\/collection.php\?do\=view\//i.test(url);

if(bool == false) {
// -------------------------------------------------------------------------
// DO NOT GO ANY FURTHER because the current URL does not meet the criteria.
// -------------------------------------------------------------------------
return ACtl.STOP_FULL_SEQ;
}

// If bool = true...
// AT THIS POINT:  The URL "does" meet the criteria, so continue on with the remaining
// code in this script (if present), and any following "Action" items in the "Chain"


Response 2 to ( 10 Apr 2025 - I added 3 actions under the same domain but with a different path segment or trigger - AutoControl Forum ).png
Hope that helps,

cw

Response 2 to ( 10 Apr 2025 - I added 3 actions under the same domain but with a different path segment or trigger - AutoControl Forum ).png

Yu Ho

unread,
Apr 16, 2025, 3:31:03 AMApr 16
to AutoControl Community Forum
I ended up changing the selector because I can't get it to work. Just out of curiousity, how would you match https://vgmdb.net/album/ as in https://vgmdb.net/album/[any number of digits] in that Run Script action you provided?
Message has been deleted

cw noway

unread,
Apr 16, 2025, 2:13:34 PMApr 16
to AutoControl Community Forum
No problem.  Here you go.  

Hope it helps,

cw


var url;
var regex;
var bool = false;

try {
// ...match https://vgmdb.net/album/ as in https://vgmdb.net/album/[any number of digits]


regex = new RegExp(/https\:\/\/vgmdb\.net\/album\/\d*/i); // will match zero (none) or more digits following "album/" (aka 'any number of digits')


// regex = new RegExp(/https\:\/\/vgmdb\.net\/album\/\d+/i); // there must be at least one or more digits following "album/"

// regex = new RegExp(/https\:\/\/vgmdb\.net\/album\/\d{1,}/i); // there must be at least one or more digits following "album/"

// regex = new RegExp(/https\:\/\/vgmdb\.net\/album\/\d{2,}/i); // there must be at least two or more digits following "album/"

// regex = new RegExp(/https\:\/\/vgmdb\.net\/album\/\d{5,10}/i); // there must be at least five digits following "album/" and a maximum of 10 digits will be matched

// regex = new RegExp(/https\:\/\/vgmdb\.net\/album\/\d{5}/i); // there must be at least five digits following "album/"



/*
EXAMPLE:
---------------------------------------------------------------------------------
A RegExp "test" OF BOTH OF THE URLS BELOW WOULD RETURN A BOOLEAN VALUE OF: true
---------------------------------------------------------------------------------
https://vgmdb.net/album/
https://vgmdb.net/album/254738
*/

// TEST 1
url = 'https://vgmdb.net/album/';
bool = regex.test(url); // bool equals true

// TEST 2
// url = 'https://vgmdb.net/album/254738';
// bool = regex.test(url); // bool equals true


if (bool != true) {
alert('URL did not match the criteria');
} else {
alert('SUCCESS:  URL matches the criteria');
}

} catch (ex) {
alert('\nSOMETHING WENT WRONG DURING URL TESTING:\n\n' + ex.message);
}

cw noway

unread,
Apr 17, 2025, 7:26:47 AMApr 17
to AutoControl Community Forum
Here you go...

var url;
var regex;
var bool = false;

try {
// ...match https://vgmdb.net/album/ as in https://vgmdb.net/album/[any number of digits]

// -----------------------------------------------------------------------------------------------------------------------------------
// Regular Expression (RegExp) used to see if the current URL matches "https://vgmdb.net/album/" OR "https://vgmdb.net/album/[digits]"

// EXAMPLE: The RegExp below will match "https://vgmdb.net/album/" and "https://vgmdb.net/album/254738"
// -----------------------------------------------------------------------------------------------------------------------------------

regex = new RegExp(/https\:\/\/vgmdb\.net\/album\/\d*/i);


// -------------------------------------------------------------------------------------------------------------
// RegExp used to see if the current URL matches "https://vgmdb.net/album/[digits]"

// EXAMPLE: The RegExp below will match "https://vgmdb.net/album/254738" but NOT "https://vgmdb.net/album/"
// --------------------------------------------------------------------------------------------------------------

// regex = new RegExp(/https\:\/\/vgmdb\.net\/album\/\d+/i);


url = document.URL; // The URL of the current page
bool = regex.test(url); // Test to see if the url matches the Regular Expresssion (RegExp)

if (bool != true) {
// DO NOT GO ANY FURTHER because the current URL does not match the Regular Expression (RegExp)
return ACtl.STOP_FULL_SEQ;

}

} catch (ex) {
alert('\nSOMETHING WENT WRONG DURING URL TESTING:\n\n' + ex.message);
return ACtl.STOP_FULL_SEQ; // DO NOT GO ANY FURTHER
}

Response 3 to ( 10 Apr 2025 - I added 3 actions under the same domain but with a different path segment or trigger - AutoControl Forum ).png
Response 3 to ( 10 Apr 2025 - I added 3 actions under the same domain but with a different path segment or trigger - AutoControl Forum ).png

peter quitzgard

unread,
Apr 18, 2025, 2:03:11 AMApr 18
to AutoControl Community Forum

@cw noway

Hi, since I see you are knowledgeable regarding scripts and regex,
I'm wondering about if you might be able to help me with this topic:


Thanks.

cw noway

unread,
Apr 19, 2025, 3:29:09 AMApr 19
to AutoControl Community Forum
No problem.  

You will see my functions and replies on that thread.


hope it helps,

cw 

Reply all
Reply to author
Forward
0 new messages