Creative Help....Please.

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
User avatar
PepsiHog
Automation Wizard
Posts: 511
Joined: Wed Apr 08, 2009 4:19 pm
Location: Florida

Creative Help....Please.

Post by PepsiHog » Tue Feb 02, 2010 6:38 am

Hey Everyone,

Working on this script. The actual one is way too long to post. But I am having a problem with getting this particular part to work. I created a sample script so that you can run it and get the gist of what I need.

In the actual program, I read from an ini file. A string is read in.

i.e. 345,234;675,123;765,987....... and up to 20 of these in one string.

In the sample script I only have 10 numbers. I use the stringreplace command to replace ; with %crlf%. This list is then assigned to a memo.

The result variable is named AttackPageList.

let>Dialog1.msMemo1=%AttackPageList%
Next to the memo box are 10 labels. All set to be invisible at start of program. Each label is defined as "Dialog1
Caption=Dialog1
Width=445
Height=499
Top=117
Left=22
Edit=msEdit1,193,107,208,msEdit1
Memo=msMemo1,21,47,76,170,msMemo1
Label=msLabel1,104,48,true
Label=msLabel2,104,64,true
Label=msLabel3,104,80,true
Label=msLabel4,104,96,true
Label=msLabel5,104,112,true
Label=msLabel6,104,128,true
Label=msLabel7,104,144,true
Label=msLabel8,104,160,true
Label=msLabel9,104,176,true
Label=msLabel10,104,192,true
EndDialog>Dialog1


let>Dialog1.msEdit1=

// this string is read in from an ini, in the actual program
let>AttackPList=123,567;345,890;345,123;123,567;345,890;345,123;123,567;345,890;345,123;111,987;
StringReplace>AttackPList,;,%crlf%,AttackPageList
let>Dialog1.msMemo1=%AttackPageList%

let>ase=0
Repeat>ase
add>ase,1
let>Fill=msLabel%ase%
let>Dialog1.%Fill%=Dialog1,%Fill%,0
Until>ase=10
SetDialogObjectVisible>Dialog1,msLabel2,1
ResetDialogAction>Dialog1

Show>Dialog1

Label>Start
GetDialogAction>Dialog1,r
if>r=2
exit>0
endif


Goto>Start
Windows 7

PepsiHog. Yep! I drink LOTS of Pepsi (still..in 2021) AND enjoy programming. (That's my little piece of heaven!)

The immensity of the scope of possibilities within Macro Scheduler pushes the user beyond just macros!

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

Post by Marcus Tettmar » Tue Feb 02, 2010 9:47 am

Here you go:

Code: Select all

OnEvent>DIALOG_CHANGE,Dialog1,msEdit1,VerifyEdit

Dialog>Dialog1
  Caption=Dialog1
  Width=445
  Height=499
  Top=117
  Left=22
  Edit=msEdit1,193,107,208,msEdit1
  Memo=msMemo1,21,47,76,170,msMemo1
  Label=msLabel1,104,48,true
  Label=msLabel2,104,64,true
  Label=msLabel3,104,80,true
  Label=msLabel4,104,96,true
  Label=msLabel5,104,112,true
  Label=msLabel6,104,128,true
  Label=msLabel7,104,144,true
  Label=msLabel8,104,160,true
  Label=msLabel9,104,176,true
  Label=msLabel10,104,192,true
EndDialog>Dialog1


let>Dialog1.msEdit1=

// this string is read in from an ini, in the actual program
let>AttackPList=123,567;345,890;345,123;123,567;345,890;345,123;123,567;345,890;345,123;111,987;
StringReplace>AttackPList,;,%crlf%,AttackPageList
let>Dialog1.msMemo1=%AttackPageList%

GoSub>ResetAll

SetDialogObjectVisible>Dialog1,msLabel2,1
ResetDialogAction>Dialog1

Show>Dialog1

Label>Start

  GetDialogAction>Dialog1,r
  if>r=2
    exit>0
  endif


Goto>Start

SRT>VerifyEdit
  GetDialogAction>Dialog1,r
  Let>stringlist=Dialog1.msMemo1
  Separate>stringlist,CRLF,strings
  If>strings_count>0
    GoSub>ResetAll
    Let>k=0
    Repeat>k
      Let>k=k+1
      Let>this_string=strings_%k%
      If>this_string=Dialog1.msEdit1
        SetDialogObjectVisible>Dialog1,msLabel%k%,1
      Endif
    Until>k=strings_count
  Endif
END>VerifyEdit

SRT>ResetAll
  Let>k=0
  Repeat>k
    Let>k=k+1
    Let>Dialog1.msLabel%k%=<
    SetDialogObjectVisible>Dialog1,msLabel%k%,0
  Until>k=10
END>ResetAll
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