• Activity
  • Votes
  • Comments
  • New
  • All activity
    1. Please proofread this AI-generated AutoHotkey script

      For my job I need to copy a person's name out of a field and split it into first and last names. I have a AHK script that can do this but my version only works with simple, one-word,...

      For my job I need to copy a person's name out of a field and split it into first and last names. I have a AHK script that can do this but my version only works with simple, one-word, non-hyphenated names. I tried prompting Gemini as below.

      There is a line of text consisting of one or more words, a comma, then one or more words. write an autohotkey 1.1 script to select everything before the comma, store it to a variable called firstname, then select everything after the comma and store it to a variable called lastname. thanks

      (the firstname and lastname variables should be swapped as the last name would come before the comma, that was my error)

      Here's the AutoHotkey 1.1 script to achieve what you described:

      ; This script splits a text line into first and last name based on a comma
      
      #NoEnv  ; Recommended for performance and compatibility.
      SendMode Input  ; Simulates keystrokes for reliable input.
      
      ; Function to split the text
      Func SplitText(_text, firstName, lastName) {
        StringSplit, parts, _text, `,`
        if (parts[1]) {
          firstName := parts[1] ; Assign first name
          lastName := SubStr(_text, 1 + StrLen(parts[1])+1) ; Extract last name after comma (including space)
        } else {
          firstName := _text ; Handle cases without a comma
          lastName := ""
        }
      }
      
      ; Hotkey to trigger the script (replace F2 with your desired key)
      F2::
        Send, ^c ; Copy the selected text to clipboard
        clipText := ClipboardAll  ; Read the clipboard content
        SplitText(clipText, firstName, lastName) ; Call the function to split the text
        MsgBox, First Name: %firstName%`nLast Name: %lastName%
      
        ; Optional: Clear clipboard to avoid unintended pasting (comment out if not desired)
        ; Clipboard := 
      Return
      

      Explanation:

      #NoEnv and SendMode Input: These lines are included for performance and reliable input simulation.
      Func SplitText(_text, firstName, lastName): This function takes the text (_text) as input and assigns the split parts to variables firstName and lastName.
      StringSplit, parts, _text, ,:** Splits the text based on the comma (,`) delimiter.
      if (parts[1]):** Checks if there's a second part (i.e., text after the comma).
      If true, the first part is assigned to firstName and the text after the comma (including the space) is extracted using SubStr and assigned to lastName.
      else:** If there's no comma, the entire text is assigned to firstName and lastName is set to an empty string.
      F2::: This line defines a hotkey. When F2 is pressed, the following actions occur:
      Send, ^c:** Copies the selected text to the clipboard.
      clipText := ClipboardAll:** Reads the copied text from the clipboard and stores it in the variable clipText.
      SplitText(clipText, firstName, lastName):** Calls the function to split the copied text into first and last names.
      MsgBox:** Displays a message box showing the extracted first name and last name.
      Optional: Clear Clipboard: The commented line Clipboard := clears the clipboard content after processing. Uncomment this line if you want to avoid accidentally pasting the copied text elsewhere.

      Edit: To answer questions, and provide info I probably should have from the beginning: I'm a medical transcriptionist using AHK with my job's software (Emdat Inscribe) and a word expander (Instant Text). Inscribe seems to be browser-based but functions as a standalone app. I already have dozens of AHK 1.1 macros; my .ahk file has over 2000 lines, although I'm sure it's terribly written code. This is also why I'm disinclined to switch to AHK 2.0 since I have no desire to rewrite everything unless absolutely necessary. The first part of this macro is a bunch of keypresses to jump to the relevant patient info field, then this part would be used to store the names appropriately. I already have hotkeys to use the variables as needed and most macros are limited with #ifwinactive to Inscribe.

      6 votes
    2. Seems like all socials are being scraped for AI and personal/aggregate data. Is Tildes?

      I was just reminded of that again when going back and looking at some of my old posts on reddit which is openly selling online data. Prompted me to use Redact which erases and overwrites comments...

      I was just reminded of that again when going back and looking at some of my old posts on reddit which is openly selling online data. Prompted me to use Redact which erases and overwrites comments before deleting them. But that got me wondering if the same is true of Tildes? And how would we know?

      34 votes
    3. What have you been watching / reading this week? (Anime/Manga)

      What have you been watching and reading this week? You don't need to give us a whole essay if you don't want to, but please write something! Feel free to talk about something you saw that was...

      What have you been watching and reading this week? You don't need to give us a whole essay if you don't want to, but please write something! Feel free to talk about something you saw that was cool, something that was bad, ask for recommendations, or anything else you can think of.

      If you want to, feel free to find the thing you're talking about and link to its pages on Anilist, MAL, or any other database you use!

      5 votes
    4. What programming/technical projects have you been working on?

      This is a recurring post to discuss programming or other technical projects that we've been working on. Tell us about one of your recent projects, either at work or personal projects. What's...

      This is a recurring post to discuss programming or other technical projects that we've been working on. Tell us about one of your recent projects, either at work or personal projects. What's interesting about it? Are you having trouble with anything?

      16 votes
    5. Midweek Movie Free Talk

      Have you watched any movies recently you want to discuss? Any films you want to recommend or are hyped about? Feel free to discuss anything here. Please just try to provide fair warning of...

      Have you watched any movies recently you want to discuss? Any films you want to recommend or are hyped about? Feel free to discuss anything here.

      Please just try to provide fair warning of spoilers if you can.

      4 votes
    6. Other artists like Freya Catherine, Jillian Aversa, Erutan?

      I really like listening to video game music covers, some of my favorite artists are Freya Catherine, Jillian Aversa, Erutan, Malukah, Karliene. Does anyone else enjoy this kind of music, and do...

      I really like listening to video game music covers, some of my favorite artists are Freya Catherine, Jillian Aversa, Erutan, Malukah, Karliene. Does anyone else enjoy this kind of music, and do you have any recs for similar artists (especially if they are still actively posting music) (and bonus points if they have a bandcamp page)?

      3 votes
    7. Nominate for "Movie of the Week" in April - Female leads

      Voting closed I do think our list of movies is turning out to be a pretty good list of solid movies, it it a bit male heavy. I hope we can find 5 movies for April that has a female substantial...

      Voting closed

      I do think our list of movies is turning out to be a pretty good list of solid movies, it it a bit male heavy. I hope we can find 5 movies for April that has a female substantial leading role.

      Rules

      • Have a woman in a leading role
      • Only one nomination per user
      • Please only nominate if you intent to participate
      • Upvote the post(s) with a nomination you would like to be picked for discussion next month
      • Please state the title of the movie clearly on the first line, and add any additional general comments in the next paragraph to keep voting simple

      In case of ties in the number of votes, random.org will decide. Voting closes Sunday.

      11 votes
    8. Book recommendation: A Half-Built Garden, by Ruthanna Emrys

      This sci-fi book starts out as a first contact novel. Aliens show up and say "Your planet is dying--we're here to rescue you! Come join our galactic federation!" Here's the twist: the protagonist...

      This sci-fi book starts out as a first contact novel. Aliens show up and say "Your planet is dying--we're here to rescue you! Come join our galactic federation!"

      Here's the twist: the protagonist emphatically refuses. The world is sick, but humanity is healing it. Successfully. They have been for decades. And they refuse to leave Earth and go explore the stars until the job is done.

      Thus begins this story's major conflict. The aliens have visited a few other planets with signs of advanced civilization, and in every case they've arrived too late--the other civilizations have extincted themselves by the time they arrive. The aliens are emphatic that technological societies cannot thrive on a planet's surface; in every other case, either the planet or the civilization dies. The humans are unfazed. Repairing an ecosystem is possible, they say. We've proven it. Are proving it. Yes, there's a hurricane bearing down on us, but the storms get a little less intense every year.

      This is a story about meeting people utterly unlike you and finding common ground with them. It's about imagining a better future and working doggedly toward it.

      Eco-focused stories usually have a back-to-the-land, pastoral vibe; they want to get in touch with nature by reducing our use of technology as much as possible. That's not this book at all. Our heroes use neural interfaces and networked decision-making algorithms to manage the restoration of the ecology. They write algorithms that weight the vote in favor of community-defined ethical preferences. Technology isn't the enemy--corporations are, which is why the corps were exiled decades ago. Networks and algorithms can be powerfully good when they're used to benefit the many instead of the few.

      This book has so much heart and so much beautiful imagery. It is gloriously weird in lots of ways I'm not going to spoil. It's a hopeful book that's giving me ideas I'm starting work on now. You can find it here or in your local library.

      5 votes
    9. Looking for creative types in the gaming world to interview!

      I have a project where I interview people on my twitch live, as if it were a talk show. I mainly focus on people in the gaming world, so if you would like to be interviewed about your hobby for...

      I have a project where I interview people on my twitch live, as if it were a talk show. I mainly focus on people in the gaming world, so if you would like to be interviewed about your hobby for 30-40 minutes let me know!

      I interviewed speedrunners, gaming musicians, challenge runners, and tournament hosters before, but I'm open to anyone that is interested and in the gaming sphere. I don't have many viewers or influence it's simply because I love to do it. If you would like to collaborate on something like this, let me know! Thanks!

      6 votes
    10. TV Tuesdays Free Talk

      Have you watched any TV shows recently you want to discuss? Any shows you want to recommend or are hyped about? Feel free to discuss anything here. Please just try to provide fair warning of...

      Have you watched any TV shows recently you want to discuss? Any shows you want to recommend or are hyped about? Feel free to discuss anything here.

      Please just try to provide fair warning of spoilers if you can.

      6 votes
    11. Positive (personal) news discussion?

      I feel like the general air recently has been pretty down recently, and I feel like it's been downer after downer headlines and discussion. What are some good things that have happened to you...

      I feel like the general air recently has been pretty down recently, and I feel like it's been downer after downer headlines and discussion.

      What are some good things that have happened to you recently? Big or small, what have you been appreciating?

      37 votes