Google Drive is a wonderful thing, but when it comes to getting at a file with scripts things can get a little quirky. Every file and folder has a unique ID number (28 digits, letters and other marks) which can make it easy to locate it, if you know how. However you can of course have many files, or folders with the same name spread out across your Google Drive, which can create a bit of a problem when trying to find the file or folder. Very often you may have to iterate over “all the folders” in order to find what you want, using names to do this can be problematic.
I find I am routinely needing to grab a list of filenames, file IDs, or file types, and routinely searching the web each time I need to do this, therefore it was about time I tied down the required scripts in one place for reuse. The scripts I have put together will request either a folder name or ID in order to iterate over the files within that folder and return the results to a spreadsheet. The scripts can be used as a base, and edited to suit specific requirements by adding further properties to return, or through the use of if statements to narrow down selected files.
- You can find the ID of the folder by looking in the url address bar if you have the folder open in Google Drive
- You can also right click on the folder and then Shareable Link
- Finding the name should be obvious! – use search in Google Drive to check for folders with the same name. It may be wise to do this occasionally if you use name a lot in your scripts, and to make your folder names unique
In my scripts I have chosen to return the filename, the mime type, the file ID, and to create a download link. I also include a helper script (courtesy of Sandy Good) that presents the mimetype in a more user friendly way. All four folder scripts rely on this. Thanks should also go to Brian P and AD:AM on the google group support forum for their code.
I will add a link to a google sheet which contains all the scripts, just make a copy of it to your own google drive, authorise the scripts and away you go.
Nice and simple, but complicated css. The site I found the code on only gave instructions for “Left” so I had to work out the others by myself, and felt the need to share! I needed these for a layout in an awesome table directory.
This one has been annoying me for a while but I finally arrived at a solution. It is especially usefeul when working inside a G Suite domain, and you wish to share information on a spreadsheet with some selectable cells (e.g. with drop downs) via a classic googlesites page, so for people with the right permissions they can use the functionality of the sheet without causing damage to the underlying data.
The default options and gadgets for presenting a spreadsheet offer too much of the sheet for my liking.
The way to sort this out is to create a web App that can be displayed on the page. The apps script is created on the website (Manage Site > Apps Script), and once the two parts are created inside a project, the app can be deployed and will then show up when added to you page.
So here is what you need to put in your code.gs Continue reading
Simply, type “after:yesterday” in the search box. You can then grab the resultant url and use this as a bookmark to get back the posts from the last 24 hours (or since “your” midnight)
I can never seem to get it right. These two links offer some respite:
Re-encode the video and stream copy the audio. The output should be a similar quality as the input and will hopefully be a more manageable size.
ffmpeg -i input.avi -c:v libx264 -preset slow -crf 18 -c:a copy -pix_fmt yuv420p output.mkv
Same as above, but also re-encode the audio instead of stream copying it:
ffmpeg -i input.mov -c:v libx264 -preset slow -crf 18 -c:a libvorbis -q:a 5 -pix_fmt yuv420p output.mkv
Create a video with a still image (input.png) and an audio file (audio.ogg):
ffmpeg -loop 1 -framerate 2 -i input.png -i audio.ogg -c:v libx264 -preset medium -tune stillimage -crf 18 -c:a copy -shortest -pix_fmt yuv420p output.mkv
ffmpeg -i <input file> -codec:v libx264 -crf 21 -bf 2 -flags +cgop -pix_fmt yuv420p -codec:a aac -strict -2 -b:a 384k -r:a 48000 -movflags faststart <output_name>.mp4
A colleague asked me the other day if I could download a video clip from the BBC News website so that she could use it in her training course (to save having to load up the website and play it “live” from there!)
I said anything is possible 😉 Took me on a little journey but finally found a way without having to resort to any browser plugins or switching to Windows to download a video grabber program. Decided to write a bash script to pull all the elements together too Continue reading
A cool little command line or two.
Say you have a remote machine that you can ssh into, it is running an X server, and you want to take a screenshot of what is on screen. You will need imagemagick installed on the remote machine for the import command to work.
1. After you have ssh’d in:
DISPLAY=:0.0 import -window root /tmp/shot.png
This will save the screenshot to the remote machine’s tmp folder. You will need to scp across to get it!
2. Before ssh’ing
ssh user@remote-host "DISPLAY=:0.0 import -window root -format png -" | display -format png -
Replace user@remote-host with your details. The image will appear on your PC, you can then save it as required.
Both very cool
Word and LibreOffice can do this as a built-in feature but Sharepoint and Google Drive/Docs can’t. Given that Sharepoint is a nightmare to just use (!) I tackled the problem on Google Drive. What we are seeking to achieve is to have a main or master document that pulls in other documents, correctly formatted to make a full document. This is useful when “writing a book”, or creating a Health and Safety file or Employee Handbook. Once again I can’t take all the credit for a lot of the coding, the initial script to pull in formatted data from other documents is due to Henrique Abreu with additional help from Mogsdad and Serge Insas. Continue reading
I need to write this up before I forget what I did!
This is quite complex and draws on several resources. Why do this? Because in my organisation many have not/cannot move to online systems, we do not have the resources (e.g. tablets/laptops), or what we need is not yet written/ready, so whilst we can easily input data with google forms, we still need a paper copy in order to act on the contents and record actions. In addition this gets the data into a digital format we can work with (on the google sheet), making it easier to work with and interrogate later, without having to input it from the paper form. Continue reading
Another solution to digital signage, this time using Google Slides and Chromium (or Chrome) in Kiosk mode.
I am using the base of a linux install (Crunchbang) and Chromium, but the basics transfer across to Chrome and other OS platforms with some tweaking.
- Kiosk Syntax
- The Google Slides Toolbar or Transport
- Web Page Presentation
- Updating the Slides
- Sharing the Slides
- Locking Down if keyboard/touchscreen in use
Am grateful for the work done by Mark Pajak at Bristol Museums on setting up Chrome/Chromium in kiosk mode, and to Google Slides users on the google groups forums and good old StackOverflow for other snippets.