Get URL from inside text file

0 favourites
  • 12 posts
From the Asset Store
94 Inside buildings views - Isometric view - PNG transparent - 2048x2048
  • Hello,

    I am trying to grab some text from a Steam URL shortcut. The URL file looks like this:








    I tried to get the text like this:

    Set text => tokencount(Text.Text,4,"URL=")

    But no luck.

    How I can extract the URL on line 4 after the URL=?

    Thanks in advance :)

  • I think I am getting close. I tried this:


    And recieved :



    Is there any way I can saw the the "IDList" off the end? maybe tell it to stop at the new line somehow?

  • Manual: Scroll down to text - lots of options

    I would learn and Use Regex - its a little confusing here is link to topic on regex


    Regex Cheat Sheet - adding it here for my own benefit too :)

    Forum seriously needs bookmark feature lol

  • Delete

  • Hey thanks DUTOIT!

    Great cheat sheet and tutorials!

    Here is what I came up with, It does not work though:


  • This is what I had in mind. I am not that advanced with regex, but can use the replace - this should give you the url

    RegexReplace(tokenat(Text.Text,2,"="), "/d", "g", "IDList")

    Edit: it works

    Edit2: Got your PM - You are most welcome. I personally prefer tokenat, but have started to use regex as it is available in C2 and is very powerful, but it is very complicated - well, at this point it is too me, with a bit of time things always get easier - ha ha

  • Yeah Thanks so much, Really nice of you to take the time and help people like this. <img src="smileys/smiley1.gif" border="0" align="middle" />

    Your example will help me out quite a bit. I can see now that I had the syntax totally wrong.

    The last expression you listed returned the exact same value to me. I am going to download the new C2 beta and look at your example as soon as I finish this clients application.

    Luckily I have a workaround for my task of launching Steam or any other game. I will simply have the user drag and drop the shortcuts onto the node-webkit window, and the application will make a copy of the shortcut in a scratch folder in the users /home or %Documents% folder.

    The kids are going to want to add custom images anyway for their icons, box art, and banners. There is no need for me to extract the icon or the Steam URL. I just thought it would look sharp if there was an icon or something in the box art placeholder right when they dragged and dropped the URL.

    As soon as I have some more time to learn the in's and outs of RegEx I will offer them a free update.

    This looks like a really powerful feature. I have always wondered how people made card and puzzle games.

    It will make me a better Linux and Unix administrator too. I have put off learning GREP and Emacs for way too long.

    Thanks again for leading me in the right direction , This is going to answer some life-long questions about non-shooter games.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I'm using it for card, boardgames, databases intensive apps right now lol

    Steam thing sounds cool.

    Anyways this is what it returns for me


    I hope that is what you are after. You could use regex and not the tokenat, but I am still figuring that out myself.

    Sorry about saving in beta, I gave up with everyone else working in the beta and changed my steam to beta so I could get hold of C2 beta, anyways the debugger is fantastic. Worth the the upgrade.

    No problem, hope it works out for you :)

  • This is the oddest thing.

    The file you provided works like a charm, but my test file still returns a different value. (node-webkti)

    just drop a steam URL shortcut on the node-webkit window to load up the text.

    I wonder if this is a bug?

  • Yeah, node-webkit is problematic.

    Where you getting the steam stuff from. You're capx is incomplete, can't get any data.

    Thought) Could steam have changed the url structure - we checked for second = equal sign, could they have added another one in?

    What are you getting?

    But, it most probably is a bug.

    Damn, I should read properly - just drop steam shortcut on window.

    Wait let me try...

  • Okay - got it:


    Just took regex out of the whole thing. Node webkit obviously doesn't work with it ???

    Anyways tokenat works perfectly

    Because it loads data on a new line, I filtered using newline then we have


    So we just take first occurance of =

    There is no one way to skin a cat - lol, but I guess we all go with what we are familiar with.

    But, at least it works <img src="smileys/smiley36.gif" border="0" align="middle" />

  • Blender - any good teach yourself recommendations - I have it installed, and want to learn, but am scared to death of it. Well, not really, but My 3d is limited knowledge, but would love to learn.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)