Andwhatwe'regonnadotodayiswe'regoingtobasicallycreate a quiteonscriptslashkindof a shellscript, andwe'regonnaautomatetheprocessoftakingnotesbecauserightnowwhat I useisevernoteandwhat I havetodoishavetoopenupeverynote.
I havetogointoitandlookthroughallthenotebooks, findtherightone, gointothatandthenopenup a newnoteinsidethat, and I kindofwanttospeedthatprocessup.
And I spent a lotoftimeintheterminal.
So I figuredwe'regoingtocreate a shelterofcommandthat's essentiallygonnacreatenotesforusautomatically.
Sothat's whatwe'redoingtoday.
Thanks.
What?
We'regoingtostartwithusjustwritingouttherequirements, andthen I'm goingtogothrough a littlebitmoredetail.
Sowhat I wanttodois I alsowannahave, like, shorthandcommandsforallofthisstuff.
So n f E standsfornotefolderextension.
Sothenfirstyoutypeinthenote, thenyoutypeinthefoldernameandthenyoutypeintheextension, andthenyoucanalsojusttypeinnoteanextensionand e anytypeinthenoteandtheextension.
Andthiswouldthenput a newnoteinjust a foldercalledGeneralorsomelikethat.
Um, Andthenwehave a justendwhereyoujustcreate a newnoteandthatwilldefaulttoadulttextfile.
Andthenwehavealso, uh, thefolder.
Ifyoujustwanttocreate a folder, youcanjusttypein F, andthenthatwouldbeAPSandthenafterwe'vetypedinthecommand.
WhateverthecommandISS, itshouldnavigatetothenotesfolder, whichisgonnabeourmainfolderafteritsnavigatedtothatfolder, itshouldshakeif a foldernamedAPalreadyexists.
Andifthere's nofoldernamedAPP, thenitwillcreate a newfoldernamedupandah, Then I'llnavigateintothatfolder, andthenwe'llcheckwithinthatfolder.
If a filenamedmynotesalreadyexistsandifthefileexists, thenit'llopenthatfileinsublimetext.
Andifitdoesn't exist, thenitwillcreatethefileandthenopenitup s Sothat's essentiallywhat I'm thinkingthattheappisgonnabetostartoutwithNo, stop.
I go.
Therewego.
Wehave a newfilecoldnote.
Stop, I Sowhatwewanttodonowiswewanttobeabletoaccessthedifferentargumentsthatwepassintothescript.
Yeah, Sowe'regonnastartwiththat, so I justwanttomentionthattoday's videoisactuallysponsoredbyhostingher, whichisthehostingplatformthat I'm currentlyusingformywebsiteonBlawg.
Andit's a platformthatworksreallywellanditfeelsreallymodernandhassupereasyintegrationwithWordPress.
AllyouneedtodoisopenyourhostingcontrolpanelandthenintoyourdetailsandclickonebuttontoinstallWordPress, and I'veactuallyused a few.
Otherserviceisforhostinginthepast, and I'vefoundthathostingisbyfartheeasiesttouse.
A couplereasonsforthisisthattheyhavesupersimpleandcleanyou.
I wouldjusthopethat I reallyliketheyhavereallyfastloadtimes, andtheyhave 24 7 customersupport.
It's justreallygood, whichiswhy I personallyusethemandwhy I canalso 100% recommendthemtoyouguys.
Soifyoujustgotohosting a dotcomslashcowandthenusethecouponcodecalwithcapitalletters, youwillgetupto 91% offyouryearlywentpostingplants.
Now I'm abletoactuallygetalloftheargumentsthatwewant.
Soifwetypeinnoteandthenthenameofthenoteandthenfolderandthenameofthefolderandthenextensionandthentheextension, thenwegetallofthemprintedoutlikethissowecanseethenameofthenote, thenameofthefolderandthenameoftheextensionaswell s.
Sothenextthingthatwe'regoingtotrytodoisThiopass a commandtothePythonscripttoopenupsublimetextandthisfilethatwecreatethinkthisshouldworknowifwetypeinthecommand, whichis N f a.
Soif I navigateThiothedesktop, forinstance, thisandthen I typein.
Andif a notefolderDr T acceptwhat I willdo, thenitwillcreatethisnotein a specificsubfolderandthenwe'llnavigatebackintothedesktopso I don't getoutofthedirectory.
Andifitdoesexist, thenwedon't needtocreate a Allright.
Sonow I'vecreated a coupleif l statementsessentiallytocheckwhetherthefilealreadyexistsorwhetherthefolderalreadyexiststogetthefilename, andweatupendedtheextensiontothatfilename.
Okay, sothenextstepnow, I thinkit's gonnabetocreatesomesortofsearchalgorithmthat's goingtogothroughallofthefoldersandcheckwhether a filealreadyexists.
Thismightbe a bitof a difficultalgorithmtofigureout, becauseimaginethatyouhaveseveraldifferentsubfolders.
It's gonnagetprettytricky.
Yeah, weneedtoWeneedtocomeupwith a good, goodwaytosolvethat.
Allright, sonow I think I'vesolvedit.
It's takenme a longtimetofind a waytoessentiallyloopthroughthedirectoriesandtrytofindthedifferentfiles.
I wasusing a differentmethodatfirstthat I thoughtwasgonnawork, whichwasjust a fourloopandgoingthrough.
I alwaysstartlist, dear, whichiskindofwhatyoucandonormallyifyou'relookingfor a file.
So I foundthisothermethodherecalledalwaysdotwalk, andthenyoubasicallyjustaddthepaththatyouwanttolookthroughandtheycall a subdearandgearsandfiles, anditloopsthroughallthefilesthatitconfinedwithinthatfolder.
Sowecreate a notefolderandtheextension, andthenwecreatethefolderandthentheextension, DrDixie, Andthatwillthencreates a foldercalledHellothatyoucanseehere.
Anditwillcreatemynotethattakes a nanoOpenupthenoteinsublimetextandwhatyoucandoaswellasyoucantypeinan F A A.
Thisisbecause I usuallyspend a lotoftimeintheterminal.
Soit's reallysimplenowformetojusttypeinUhoh n andthenthenotethat I wanttocreate.
Andthen I getthatnoteandthen I canjusttypestarttypinginthingssobecausethat's somethingthat I use a lot.
I justtypeinnotesandphrases.
If I useevernote, then I can't.
I havetogointoeverynote, openupinyournotesanddothatsortofstuff, which I don't reallywanttodo.
Sothisis a reallyneatwaytokindofsolvethatproblemforme, essentiallycreatingmyownandnotetakingapp.
So, uh, thatwastheidea, atleastforthisvideo, and I'llleave a linktotheguitarproposestoryinthedescriptionsothatyoucancheckitoutifyouwant, butyeah, that's Ah, it I'm prettyhappy.
Okay, sothat's anotheronedaybilldoneanddusted.
And I'm actuallyrecordingthis a coupledayslater, and I'veactuallybeenusingthescriptnowfor a coupledaysandbeenreallyenjoyingit.
I'veusedit a lotandwaitmorethan I thought I would, So I candefinitelyrecommendtryingthisouteithertryingtryingtobuilditfromscratchonyouroldordownloadingtheguitarperforce a storythat'lllinkinthedescriptionofthisvideoandjusttryingthisoutbecause I reallyenjoyitandAlsobeforeyougo, I justwanttomentionthat I'vestarted a newslettercalledCleanCodeFriday, andthat's basicallygonnabethat.
I'llsendoutoneshortemaileveryweekcontaining a fewofthethingsthatarefoundthroughoutthisweek.
Thiscanbethingslikearticles I'vereadbooks, somereadingpodcastsoflistentoproductivitytips, coding, tipsandtricksandreallyanythingthat I thinkyoumightenjoy.