Jump to content
Macro Express Forums

Critique Please!


cuppanews

Recommended Posts

Hi...

 

I want to take a URL and extract the domain name. I've written a macro that does this, but since it's something that's critical to my workflow, I'd like to ask for your thoughts.

 

Is this the best way to do what I want? Are there any obvious flaws in what I've done?

 

The aim here is to get the domain name into T4. The URL is in T2, a variable that is restored when the macro begins.

 

// Restore all variables from memory.

Variable Restore All Variables

// Extract domain name.

// Strip "http://".'>http://".

Replace "http://" with "" in %T2%

// Put the position of the first remaining slash (i.e., end of domain name + 1) into an integer variable: N1

Variable Set Integer %N1% from Position of Text in Variable %T2%

// Reduce the value of N1 by 1.

Variable Modify Integer: %N1% = %N1% - 1

// Copy everthing from position 1 to N1 into T4.

Variable Modify String: Copy Part of %T2% to %T4%

 

Thanks for your help!

 

M.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...