midstr

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
tim gantz

midstr

Post by tim gantz » Thu Jun 03, 2004 8:04 pm

i have a scrpt that i did about 4 verions ago .
i made changes with the new version 7.2.5
and it give me an error every time i run it or debug it i belive it is in my mdstrng line .if anyon can help me i would greatly apreciate it here is the script



exe>c:\militarypac.pdf
wait>1.0
Press Tab
Wait>1.5
Readln>c:\credit.txt,7,theline
let>c:\credit.txt,7,=theline
length>line,le
let>numcharts=le,-2
MidStr>theline,2,numchars,theline
send>theline
wait>1


thanks tim

Lumumba

Post by Lumumba » Thu Jun 03, 2004 9:18 pm

exe>c:\militarypac.pdf
wait>1.0
Press Tab
Wait>1.5
Readln>c:\credit.txt,7,theline //read line 7 of the file named credit.txt and store its content in the variable theline
let>c:\credit.txt,7,=theline //sets a variable named c:\credit.txt,7, with the line content which has been detected the line ago
length>line,le //get the lenght of a variable which hasn't been set
let>numcharts=le,-2 //sets a variable named numcharts and tries to sub 2 from it in one go
MidStr>theline,2,numchars,theline // gets the string which starts from position 2 of the line which is stored in the variable theline with the length which was set in the variable the line above
send>theline // send the string which has been set to the variable theline to the window which has the focus
wait>1

---

Code reviewed. Please check if this works for you.
exe>c:\militarypac.pdf
wait>1.0
Press Tab
Wait>1.5
Readln>c:\credit.txt,7,theline
length>theline,le
sub>le, 2
let>numcharts=%le%
MidStr>theline,2,%numchars%,theline
send>%theline%
wait>1

Guest

Post by Guest » Thu Jun 03, 2004 11:11 pm

it still isnt woring and when i follow your example code i get an error in

sub>le, 2

do you hane an email i cand send you the script ?

thanks for your help tin gantz :D


Lumumba wrote:exe>c:\militarypac.pdf
wait>1.0
Press Tab
Wait>1.5
Readln>c:\credit.txt,7,theline //read line 7 of the file named credit.txt and store its content in the variable theline
let>c:\credit.txt,7,=theline //sets a variable named c:\credit.txt,7, with the line content which has been detected the line ago
length>line,le //get the lenght of a variable which hasn't been set
let>numcharts=le,-2 //sets a variable named numcharts and tries to sub 2 from it in one go
MidStr>theline,2,numchars,theline // gets the string which starts from position 2 of the line which is stored in the variable theline with the length which was set in the variable the line above
send>theline // send the string which has been set to the variable theline to the window which has the focus
wait>1

---

Code reviewed. Please check if this works for you.
exe>c:\militarypac.pdf
wait>1.0
Press Tab
Wait>1.5
Readln>c:\credit.txt,7,theline
length>theline,le
sub>le, 2
let>numcharts=%le%
MidStr>theline,2,%numchars%,theline
send>%theline%
wait>1

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Fri Jun 04, 2004 1:27 am

I noticed an extra space in that Sub command, before the "2". It does not make a difference on a test that I did, but perhaps try removing it anyway.
From: sub>le, 2
To: sub>le,2

Also make sure you have no Trailing Space characters at the end of any of your lines. In the Editor, you can select Edit, Show All Chars, and Remove Trailing Spaces. Is a not-uncommon problem if Cut/Paste from the forum.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

Tim Gantz

Post by Tim Gantz » Fri Jun 04, 2004 11:12 pm

i solved my problem by increesing my inital wait tim from 1 sec to two the script works fine the orginal way...thanks for all the help''Tim G :D




Bob Hansen wrote:I noticed an extra space in that Sub command, before the "2". It does not make a difference on a test that I did, but perhaps try removing it anyway.
From: sub>le, 2
To: sub>le,2

Also make sure you have no Trailing Space characters at the end of any of your lines. In the Editor, you can select Edit, Show All Chars, and Remove Trailing Spaces. Is a not-uncommon problem if Cut/Paste from the forum.

armsys
Automation Wizard
Posts: 1108
Joined: Wed Dec 04, 2002 10:28 am
Location: Hong Kong

Post by armsys » Sat Jun 05, 2004 2:25 am

Hello Tim,

I notice your script attempts to open a PDF file. If it's the first time (after cold boot) you run Acrobat, 2 seconds are not enough to load the Acrobat. You may consider the following code (partial):
exe>c:\militarypac.pdf
Wait>0.1
WaitCursorChanged>10
WaitReady>1
Press Tab
Happy scripting.

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