Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
First complex macro, need help
#1
Hello,

I do a lot of simple macros and searching online to make my macros but I can't seem to find an example or something similar for what I am trying to create.

I work in IT and get a lot of emails from different systems and requesting methods which need to be consolidated into one single ticketing system as I work them. Unfortunately, not all of these systems list the user data in the same order. I am extremely tired of reformatting these things and unfortunately our management is unwilling to consolidate all of our legacy ticketing systems into the one we are required to use.

So for example:
Quote:Name: Suise Exampleton
Email: [email protected]
Phone: 123-456-7890

I basically want to be able to select this whole block of text, and have it split the first name and last name into two different variable using the space, save the email as a variable and the phone as another one. Then I can call for that info by doing a macro to put that text in the clipboard as I need it in a ticket/password/reset/whatever. Once I create one macro system based on this format above, I can make others to suit the various other ordered lists I receive. 
  • Variable UsrFirstName: Susie
  • Variable UsrLastName: Exampleton
  • Variable UsrEmail: [email protected]
  • Variable UsrPhone: 123-456-7890
I'm not asking for anyone to create it for me (though if you do, you will probably make my work day a lot easier), but are there any good example of similar macros with this I can reference to create what I need?

Thank you in advance for any guidance. I have been researching this off and on for a couple months but have not successfully made a macro to do this yet.
#2
Macro Macro3186
Code:
Copy      Help
str s=
;Name: Suise Exampleton
;Email: [email protected]
;Phone: 123-456-7890

str UsrFirstName UsrLastName UsrEmail UsrPhone
str line
foreach line s
,int i=find(line ":"); if(i<0) end "error 1"
,str s1.left(line i)
,str s2.get(line i+1); s2.trim
,sel s1
,,case "Name"
,,i=find(s2 " "); if(i<0) end "error 2"
,,UsrFirstName.left(s2 i)
,,UsrLastName.get(s2 i+1)
,,
,,case "Email"
,,UsrEmail=s2
,,
,,case "Phone"
,,UsrPhone=s2
,,

out UsrFirstName
out UsrLastName
out UsrEmail
out UsrPhone
#3
You are a wonderful life saver. This is already saving me so much time! And with this example I can now expand on this concept on my own.

I'd buy you a coffee or something if I could. <3


Forum Jump:


Users browsing this thread: 1 Guest(s)