About

The blog contains mostly brain-dead programming tutorials, because it seems like you can never find any programming tutorials brain-dead enough.

This Could Be Better: Insulting your intelligence since 2011.

7 Responses to About

  1. Ashley says:

    Hi,
    I happened to come across your page by accident. it is amazing to actually see some great programs and passion.

    I’m going to be cheeky, because someone once said, if you don’t ask, you don’t know.. I am desperate for some help on small program that allows you to fill in 5 text boxes and submit them. once submitted, I need them to save into the same excel workbook on a different line each time.

    I built this system in excel VBA, but our excel versions at work are so dated! that they don’t all run the code.

    would you be able to help in any way?

    many thanks,
    ash

  2. Cherie says:

    Hello I am totally desperate as I am not a programmer, and need to get some javascript running from articulate storyline. Here is the code which you will probably laugh at, but all I need to do is pull some variables and export them to a .txt file on my computer so that each time someone clicks on the complete button, the javascript runs:

    alert(“Thankyou…”);
    var currentTime = new Date()
    var month = currentTime.getMonth() + 1
    var day = currentTime.getDate()
    var year = currentTime.getFullYear()
    var dateString=month + “/” + day + “/” + year
    var player = GetPlayer();
    var Firstname = player.GetVar(“FirstName”);
    var Surname = player.GetVar(“Surname”);
    var DateofBirth = player.GetVar(“DateofBirth”);
    player.SetVar(“SystemDate”,dateString);
    var fso = new ActiveXObject(“Scripting.FileSystemObject”);
    var s = fso.OpenTextFile(“D:\\Test.txt”, 8, true, 0);
    s.WriteLine(“FirstName: ” + Firstname);
    s.WriteLine(“Surname: ” + Surname);
    s.WriteLine(“DateofBirth: ” + DateofBirth);
    s.WriteLine(“DateofCompletion: ” + SystemDate);
    s.WriteLine(“==========”);
    s.Close();

    Do I need to create the Test.txt file before I run this on my D:/ or will the code do this for me? I’m so stuck!

    THANKS

    • It looks like your code uses ActiveX, which is not really something I know very much about, nor do I wish to. Sorry. If you haven’t already looked at it, you might take a look at my post at https://thiscouldbebetter.wordpress.com/2012/12/18/loading-editing-and-saving-a-text-file-in-html5-using-javascrip, which uses HTML5 rather than ActiveX to allow loading and saving of text.

      I’ll try to post another reply after this one with some code adapted from that post that you might find helpful, but it’s pretty legendarily difficult to post code in a WordPress comment. I’ll do my best.

    • Text to Save:

      File Name to Save As:

      Save Text

      function buttonSaveText_Clicked()
      {
      var textToSave = document.getElementById(“inputTextToSave”).value;
      var fileNameToSaveAs = document.getElementById(“inputFileName”).value;
      saveTextAsFile(textToSave, fileNameToSaveAs)
      }

      function saveTextAsFile(textToSave, fileNameToSaveAs)
      {
      var textToSaveAsBlob = new Blob([textToSave], {type:”text/plain”});
      var textToSaveAsObjectURL = window.URL.createObjectURL(textToSaveAsBlob);

      var downloadLink = document.createElement(“a”);
      downloadLink.download = fileNameToSaveAs;
      downloadLink.innerHTML = “Download File”;
      downloadLink.href = textToSaveAsObjectURL;
      downloadLink.onclick = function(event) { document.body.removeChild(event.target); }
      downloadLink.style.display = “none”;
      document.body.appendChild(downloadLink);
      downloadLink.click();
      }

    • <html>
      <body>

      <!– ui –>

      Text to Save:

      File Name to Save As:

      <button id=”buttonSaveText” onclick=”buttonSaveText_Clicked();”>Save Text</input>

      function buttonSaveText_Clicked()
      {
      var textToSave = document.getElementById(“inputTextToSave”).value;
      var fileNameToSaveAs = document.getElementById(“inputFileName”).value;
      saveTextAsFile(textToSave, fileNameToSaveAs)
      }

      function saveTextAsFile(textToSave, fileNameToSaveAs)
      {
      var textToSaveAsBlob = new Blob([textToSave], {type:”text/plain”});
      var textToSaveAsObjectURL = window.URL.createObjectURL(textToSaveAsBlob);

      var downloadLink = document.createElement(“a”);
      downloadLink.download = fileNameToSaveAs;
      downloadLink.innerHTML = “Download File”;
      downloadLink.href = textToSaveAsObjectURL;
      downloadLink.onclick = function(event) { document.body.removeChild(event.target); }
      downloadLink.style.display = “none”;
      document.body.appendChild(downloadLink);
      downloadLink.click();
      }

      </body>
      </html>

  3. Max says:

    Hey thiscouldbebetter🙂 I like your blog and have been running some of your coding projects locally to see what happens and how they work!

    Thanks for publishing this all online🙂 You’re awesome!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s