how to grab the right info from file to type in a homepage

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
brunop
Junior Coder
Posts: 38
Joined: Mon Dec 03, 2007 2:29 pm

how to grab the right info from file to type in a homepage

Post by brunop » Mon Aug 11, 2008 4:42 pm

hello

i have a long list of people and their info that i need to get typed in on a formula on a homepage. how should i approach this the easiest way.

it is the same 7 types of info from those people that needs to be typed in at the same place on the homepage so most could be done with the
tabulator key or mouse clicks. The only thing i have no clue to how to approach is how to grab the right information from the.txt file.

will i need to arrange all the info in a column 1,2,3 i excell for the program to find it or is there another way?

Right now i have it listed in the text document as:

persons name
info 1
info 2
info 3
info 4
info 5
info 6
info 7

two spaces and then the next person



Thanks

Bruno

User avatar
JRL
Automation Wizard
Posts: 3532
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Mon Aug 11, 2008 8:21 pm

Here's a sample that demonstrates one possible solution for you using your current file configuration. This assumes your file is perfect, although I did put in an error check in case the spaces did not show up when they were supposed to. If the line does not really contain a space but is just a linefeed then you will need to change the 2 lines:

If>line%SPACE%,Error

to

If>line,Error

Code: Select all

Let>filename=drive:\Path\file
Let>kk=0

Label>start
  GoSub>ReadLine
  //Do something with the user name
  send>%line%
  GoSub>ReadLine
  //Do something with Info 1
  send>%line%
  GoSub>ReadLine
  //Do something with Info 2
  send>%line%
  GoSub>ReadLine
  //Do something with Info 3
  send>%line%
  GoSub>ReadLine
  //Do something with Info 4
  send>%line%
  GoSub>ReadLine
  //Do something with Info 5
  send>%line%
  GoSub>ReadLine
  //Do something with Info 6
  send>%line%
  GoSub>ReadLine
  //Do something with Info 7
  send>%line%
  GoSub>ReadLine
  If>line<>%SPACE%,Error
  GoSub>ReadLine
  If>line<>%SPACE%,Error
goto>start

SRT>Error
  MDL>This line should be a space,  Something is out of sequence. Press Shift+Esc to terminate script.
END>Error

SRT>ReadLine
  add>kk,1
  ReadLn>filename,%kk%,line
  If>line=##EOF##,EOF
END>ReadLine

Label>EOF

brunop
Junior Coder
Posts: 38
Joined: Mon Dec 03, 2007 2:29 pm

Post by brunop » Tue Aug 12, 2008 1:01 am

Hi

Thanks for the help so far! im trying to implement your suggestion right now.

But i got to think that the program should be able to find a specific person and his info. it is not supposed to go through my list of people from one end to another, but rather one at a time.
So would it be possible to implement some sort of search function eg. if i typed in the name of the person i needed the info on then the program would be able to find the rest on its own and fill it in on the webpage. or i could just find the person by a normal search in the .txt document and then just leave the cursor at the name so the program knows who i need the info from

Thank you in advance, these commands are still a bit too hard for me to figure out on my own

Bruno

User avatar
JRL
Automation Wizard
Posts: 3532
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Tue Aug 12, 2008 10:44 pm

Try this: Same as above with a dialog and a DOS search.

Code: Select all

Dialog>Dialog1
   Caption=Name
   Width=304
   Height=126
   Top=0
   Left=0
   Edit=msEdit1,16,8,257,
   Button=Ok,104,56,75,25,3
   Default=Ok
EndDialog>Dialog1

Show>Dialog1

Let>filename=drive:\Path\file

Label>Loop
GetDialogAction>dialog1,res1
If>res1=2,EOF
If>res1=3,Start
Wait>0.01
Goto>Loop

SRT>Start
  If>Dialog1.msedit1=
    MDL>No name to Process
	Goto>Cont
  EndIf
  Let>RP_WAIT=1
  Let>RP_WINDOWMODE=0
  Run>Cmd /c find /N /I "%Dialog1.msedit1%" "%filename%"> %temp_dir%~findresults.txt
  ReadFile>%temp_dir%~findresults.txt,data
  DeleteFile>%temp_dir%~findresults.txt
  Separate>data,[,var
  If>var_count<2
  MDL>"%Dialog1.msedit1%" not found
	Goto>Cont
  EndIf
  Separate>var_2,],var
  Let>kk=%var_1%-1
  GoSub>ReadLine
  //Do something with the user name
  send>%line%
  GoSub>ReadLine
  //Do something with Info 1
  send>%line%
  GoSub>ReadLine
  //Do something with Info 2
  send>%line%
  GoSub>ReadLine
  //Do something with Info 3
  send>%line%
  GoSub>ReadLine
  //Do something with Info 4
  send>%line%
  GoSub>ReadLine
  //Do something with Info 5
  send>%line%
  GoSub>ReadLine
  //Do something with Info 6
  send>%line%
  GoSub>ReadLine
  //Do something with Info 7
  send>%line%
  GoSub>ReadLine
  If>line<>%SPACE%,Error
  GoSub>ReadLine
  If>line<>%SPACE%,Error
  Label>Cont
  ResetDialogAction>dialog1
END>Start

SRT>Error
  MDL>This line should be a space,  Something is out of sequence. Press Shift+Esc to terminate script.
END>Error

SRT>ReadLine
  add>kk,1
  ReadLn>filename,%kk%,line
  If>line=##EOF##,EOF
END>ReadLine

Label>EOF

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts