Scripts by peterjohnhunt

Basecamp API Library

This is very much still WIP, but i've been building a library for the Basecamp 3 api so i can build a bunch of automations against that.

Here is a gist of the lib file:

https://gist.github.com/peterjohnhunt/128ded029c93fb8f6c4845df7fc590c2

and here is an example of how it could be used to create a task

// Menu: Basecamp - Create Task
// Description: Create a Basecamp task

let { me, selectTodoList, createTodo } = await lib("basecamp")

let list = await selectTodoList()

setHint(`${list.bucket.name} - ${list.title}`)

let title = await arg('Task name:')

let today = new Date()
let dd = String(today.getDate()).padStart(2, '0')
let mm = String(today.getMonth() + 1).padStart(2, '0')
let yyyy = today.getFullYear()

let response = await createTodo({
  content: title,
  assignee_ids: [me.id],
  due_on: `${yyyy}-${mm}-${dd}`
}, list.bucket.id, list.id)

setHint(`${title} Created!`)

wait(2000)
Discuss Post

Simple Zoom Room Quick Links

Hey @johnlindquist! First off, thank you so much for this app! one of the coolest things i've played around with in a long time! I've already spent a bunch of time prototyping a bunch of scripts and automations. Definitely is going to make much easier a lot of the automation type scripts i usually end up writing in bash a bit more clunkily.

I built a super simple zoom room quick launcher: https://gist.github.com/peterjohnhunt/043b9051ff097d415efc8215889d6a25

A couple questions:

  1. For me when doing certain actions (like trying to share) via the UI, it seems to "get confused". For instance, when i try and share a script via "Create install link" it asks me for a github token, but when i enter it i get this error:

[warn] ENOENT: no such file or directory, open '/Users/peterjohnhunt/.kenv/scripts/MYTOKENHERE

It feels like it's using the token as the file it's supposed to share. Doing the share process through the terminal works fine, and after the token is set, the UI works fine as well (since it doesn't prompt for a token)

  1. Following the pattern of the "todos app" i built a db interface as a "lib". Is there an easy way to share the full "script" including that file to others?

  2. For something like opening a url in the default browser, is exec("open MYURL") the best method, or is there a helper function i'm missing?

  3. One other thought, it'd be cool if there was a programatic way to change the tab. An example scenario: After adding a new item to the db, it would be cool if i could trigger it to auto change back to the main tab.

Discuss Post