Question regarding IF, Else

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Panorama
Newbie
Posts: 12
Joined: Tue Jul 18, 2006 4:56 am

Post by Panorama » Fri Jul 21, 2006 6:24 pm

i found the answer

Panorama
Newbie
Posts: 12
Joined: Tue Jul 18, 2006 4:56 am

Post by Panorama » Sat Jul 22, 2006 4:53 am

The R value is conflicting with the program shortcut. What Should I edit or bring something new? R is record where 1 plays file.

Code: Select all

Dialog>dialog1
   Caption=TESTER
   Width=445
   Height=119
   Top=522
   Left=798
   Max=0
   Min=0
   Close=1
   Resize=1
   Label=This is an automated error checker to test programs.,88,8,true
   Label=Created for ESL Department by "MY NAME",104,24,true
   Button=Test,136,48,75,25,1
   Button=Exit,216,48,75,25,2
EndDialog>dialog1
Show>dialog1
label>actionloop
GetdialogAction>dialog1,r
if>r=2,Cancel
if>r=1,Tester
Goto>actionloop
Label>exit
SRT>Cancel
  Closedialog>dialog1
End>Cancel
SRT>Tester
let>r<1>c:\audacitytestfile.mp3
Run Program>c:\Program Files\Audacity\Audacity.exe
wait>2
Send Character/Text>r
wait>1
Send Character/Text>s
wait>1
END>TESTER


User avatar
Marcus Tettmar
Site Admin
Posts: 7380
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Sat Jul 22, 2006 7:46 am

Three possible solutions:

1. Use a different variable name for the result of GetDialogAction.

2. Create a variable set to literal value "r" where you want to send it:
Let>TextToSend={"r"}
Send Character/Text>TextToSend

3. This is the best approach: Use VAREXPLICIT=1. Setting VAREXPLICIT to 1 means that when using variables you must refer to them in % symbols. Without % symbols they are literals. So your script would be:

Code: Select all

Let>VAREXPLICIT=1
Dialog>dialog1
   Caption=TESTER
   Width=445
   Height=119
   Top=522
   Left=798
   Max=0
   Min=0
   Close=1
   Resize=1
   Label=This is an automated error checker to test programs.,88,8,true
   Label=Created for ESL Department by "MY NAME",104,24,true
   Button=Test,136,48,75,25,1
   Button=Exit,216,48,75,25,2
EndDialog>dialog1
Show>dialog1
label>actionloop
GetdialogAction>dialog1,r
if>%r%=2,Cancel
if>%r%=1,Tester
Goto>actionloop
Label>exit
SRT>Cancel
  Closedialog>dialog1
End>Cancel
SRT>Tester
Run Program>c:\Program Files\Audacity\Audacity.exe
wait>2
Send Character/Text>r
wait>1
Send Character/Text>s
wait>1
END>TESTER
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Panorama
Newbie
Posts: 12
Joined: Tue Jul 18, 2006 4:56 am

Post by Panorama » Sun Jul 30, 2006 1:29 am

How do i check whether the sound from the speakers are playing?

Panorama
Newbie
Posts: 12
Joined: Tue Jul 18, 2006 4:56 am

Post by Panorama » Sun Jul 30, 2006 1:44 am

OK now i am testing windows media player. What i dont know is, are the type of error that can be generated by windows media player runnning a wma format file. If the file runs smoothly there should be no errors or in other words no windows should be popup. What commad should I use that if a new window popups up then error if not then no error someting like that...this is my apporach.

User avatar
Marcus Tettmar
Site Admin
Posts: 7380
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Sun Jul 30, 2006 7:40 am

For this I would use OnEvent with the WINDOW_NEWACTIVE paramater. This will call a subroutine whenever the foreground window changes.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

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