Skip to content

Instantly share code, notes, and snippets.

@shrayasr
Created March 28, 2018 06:03
Show Gist options
  • Star 17 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shrayasr/8ba2f9f740dfdceb31834a0eb35cb4c2 to your computer and use it in GitHub Desktop.
Save shrayasr/8ba2f9f740dfdceb31834a0eb35cb4c2 to your computer and use it in GitHub Desktop.
Bulk delete activities in Garmin Connect
function foo() {
console.log("foo - start")
$("button.search-button").click()
setTimeout(function() {
var li = $(".list-item")[0]
var delButton = $(li).find("button.js-activity-delete")
var confirmDelButton = $(li).find("button.delete-yes")
console.log(delButton, confirmDelButton)
$(delButton).click()
setTimeout(function() {
$(confirmDelButton).click()
console.log("foo - end")
}, 100)
}, 2000)
}
setInterval(foo, 3000)
@arpatoz
Copy link

arpatoz commented Jan 27, 2021

This is really great! Is there any similar way to bulk delete all the body weight (or any measurement) entries from Garmin Connect.

I happened to import 8 years of weight data into GConnect from FitBit, but entered them as kg instead of pound. :(( Now, I have 700+ entries to delete.

@wagn1184
Copy link

Yes but you are likely going to have to make the program yourself (easier than it might sound). You can use a macro automation program where you record yourself completing the task (deleting a single weight) and then the program can replay this over and over. Pulover’s Macro Creator should work for this https://www.macrocreator.com/
Also if you are familiar with python you can use the pyautogui library to automate tasks.

@ElMichel
Copy link

ElMichel commented Jun 16, 2021

Thx a lot. This is incredible time saver

@private-jobe
Copy link

private-jobe commented Sep 1, 2022

Use the following code to delete courses. If automaticly importing from Strava there can be a lot of old courses/routes.

//go to courses page first. click search as the activity list gets low.

var jq = document.createElement('script');
jq.src = "https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js";
document.getElementsByTagName('head')[0].appendChild(jq);
// ... give time for script to load
jQuery.noConflict();

function foo() {
console.log("foo - start")
$("button.search-button").click()
setTimeout(function() {
var list = $(".quick-action")
console.log("List length:", list.length)
if (list.length > 2) {
var li = $(list)[list.length - 1]
var delButton = $(li).find("a.icon-trash")[0]

  console.log(delButton)

  delButton.click()

  setTimeout(function() {
    var confirmDelButton = $(".js-saveBtn")[0]
    console.log(confirmDelButton)
    confirmDelButton.click()
    console.log("foo - end")
  }, 2000)
}

}, 100)
}

setInterval(foo, 2500)

@lizcue
Copy link

lizcue commented Dec 28, 2023

Extremely helpful, thanks!
If I add new activities will the code keep executing forever? If so, how can I stop it?

@lordmat0
Copy link

lordmat0 commented Dec 29, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment