My Little Project Part 2.

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
jj45410
Junior Coder
Posts: 38
Joined: Tue Nov 18, 2008 8:14 pm

My Little Project Part 2.

Post by jj45410 » Fri Dec 05, 2008 11:53 pm

Well thanks to JRL I have unlocked a new part of making menus, but now it its erroring with the menu I made a few days ago, this is the whole script.. It is telling me it is having problems creating "MyDialog" and that mscheckbox isn't a valid boolean.

Code: Select all

Dialog>MyDialog
Caption=Jordans Task Menu
   Width=455
   Height=279
   top=CENTER
   left=CENTER
   Button=Run Tasks,184,146,98,20,3
   Button=Exit Macro,184,170,97,20,2
   Checkbox=msCheckbox1,DWC,24,140,97,false
   Checkbox=msCheckbox2,Start Disk Defrag,24,160,97,false
   Checkbox=msCheckbox3,Start Disk Clean,24,180,97,false
   Button=www.youtube.com,24,17,120,25,10
   Button=www.myspace.com,24,48,120,25,11
   Button=www.yahoo.com,24,80,120,25,12
   Button=www.mjtnet.com,24,112,120,25,13
   Button=www.google.com,150,17,120,25,14
   Button=www.itunes.com,150,48,120,25,15
   Button=www.Morrowind.com,150,80,120,25,16
   Button=www.aol.com,150,112,120,25,17
   MainMenu=Browsers,IExplorer(101)
   MainMenu=Applications,NotepPad(201),Paint(202),Itunes(203)
   MainMenu=Games,World Of Warcraft(301)
EndDialog>MyDialog


Label>Loop
GetDialogAction>MyDialog,result
If>result=2
endif
  exit>
if>result=101
Run Program>C:\Program Files\Internet Explorer\iexplore.exe  
  ResetDialogAction>MyDialog1
EndIf
wait>0.01
Goto>Loop


Label>MainLoop
Show>MyDialog1,result
If>result=10
  Exe>http://www.youtube.com
EndIf
If>result=11
  Exe>http://www.myspace.com
EndIf
If>result=12
  Exe>http://www.yahoo.com
EndIf
If>result=13
  Exe>http://www.mjtnet.com
Endif
If>result=14
  Exe>http://www.google.com
Endif
If>result=15
  Exe>http://www.itunes.com
Endif
If>result=16
  Exe>http://www.morrowind.com
Endif
If>result=17
  Exe>http://www.aol.com
Endif
if>result=2,End
if>result=3
if>MyDialog.msCheckbox1=True,Del WoW Cache
if>MyDialog.msCheckbox2=True,Start Disk Defrag
if>MyDialog.msCheckbox3=True,Start Disk Clean
if>MyDialog.msCheckbox4=True,Start Itunes
endif
Goto>MainLoop

Label>End

SRT>Del WoW Cache
IfDirExists>C:\Program Files\World of Warcraft\Cache
del>C:\Program Files\World of Warcraft\Cache
messagemodal>Cache Deleted
else
MessageModal>Cache Does Not Exsist
endif
END>Del WoW Cache

SRT>Start Disk Defrag
ExecuteFile>C:\WINDOWS\system32\dfrg.msc,
END>Start Disk Defrag

SRT>Start Disk Clean
ExecuteFile>C:\WINDOWS\system32\cleanmgr.exe,
END>Start Disk Clean

jj45410
Junior Coder
Posts: 38
Joined: Tue Nov 18, 2008 8:14 pm

Post by jj45410 » Sat Dec 06, 2008 2:08 am

Nvm I got it working, Thanks anyway

D__S
Newbie
Posts: 1
Joined: Sat Dec 06, 2008 2:17 am

Post by D__S » Sat Dec 06, 2008 2:32 am

jj45410 wrote:Nvm I got it working, Thanks anyway
Found in this script just as in the Dialog Example script that ships with the latest version of Macro Scheduler if you name the dialog MyDialog it errors out. Change MyDialog to MyD (and all subsequent references) and the code runs properly.

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

Post by JRL » Sat Dec 06, 2008 6:08 am

You got it working but for posterity (and since I worked on it to fix it :wink: ) here is a working version. The main problems were that you had two loops in the original code and you need to put in ResetDialogAction to reset the value of the variable "Result" which is the GetDialogAction result variable. Without the ResetDialogAction lines the loop will keep executing the same thing indefinitely.

Code: Select all

Dialog>MyDialog
   Caption=Jordans Task Menu
   Width=455
   Height=279
   top=CENTER
   left=CENTER
   Button=Run Tasks,184,146,98,20,3
   Button=Exit Macro,184,170,97,20,2
   Button=www.youtube.com,24,17,120,25,10
   Button=www.myspace.com,24,48,120,25,11
   Button=www.yahoo.com,24,80,120,25,12
   Button=www.mjtnet.com,24,112,120,25,13
   Button=www.google.com,150,17,120,25,14
   Button=www.itunes.com,150,48,120,25,15
   Button=www.Morrowind.com,150,80,120,25,16
   Button=www.aol.com,150,112,120,25,17
   Checkbox=msCheckbox1,DWC,24,140,97,False
   Checkbox=msCheckbox2,Start Disk Defrag,24,160,97,False
   Checkbox=msCheckbox3,Start Disk Clean,24,180,97,False
   MainMenu=Browsers,IExplorer(101)
   MainMenu=Applications,NotepPad(201),Paint(202),Itunes(203)
   MainMenu=Games,World Of Warcraft(301)
EndDialog>MyDialog

Show>MyDialog

Label>MainLoop
GetDialogAction>MyDialog,result
If>result=2
  exit>
endif
if>result=101
  Run Program>C:\Program Files\Internet Explorer\iexplore.exe
  ResetDialogAction>MyDialog
EndIf
wait>0.01
If>result=10
  Exe>http://www.youtube.com
  ResetDialogAction>MyDialog
EndIf
If>result=11
  Exe>http://www.myspace.com
  ResetDialogAction>MyDialog
EndIf
If>result=12
  Exe>http://www.yahoo.com
  ResetDialogAction>MyDialog
EndIf
If>result=13
  Exe>http://www.mjtnet.com
  ResetDialogAction>MyDialog
Endif
If>result=14
  Exe>http://www.google.com
  ResetDialogAction>MyDialog
Endif
If>result=15
  Exe>http://www.itunes.com
  ResetDialogAction>MyDialog
Endif
If>result=16
  Exe>http://www.morrowind.com
  ResetDialogAction>MyDialog
Endif
If>result=17
  Exe>http://www.aol.com
  ResetDialogAction>MyDialog
Endif
if>result=3
if>MyDialog.msCheckbox1=True,Del WoW Cache
if>MyDialog.msCheckbox2=True,Start Disk Defrag
if>MyDialog.msCheckbox3=True,Start Disk Clean
if>MyDialog.msCheckbox4=True,Start Itunes
endif
Goto>MainLoop


SRT>Del WoW Cache
IfDirExists>C:\Program Files\World of Warcraft\Cache
del>C:\Program Files\World of Warcraft\Cache
messagemodal>Cache Deleted
else
MessageModal>Cache Does Not Exsist
endif
ResetDialogAction>MyDialog
END>Del WoW Cache

SRT>Start Disk Defrag
ExecuteFile>C:\WINDOWS\system32\dfrg.msc
ResetDialogAction>MyDialog
END>Start Disk Defrag

SRT>Start Disk Clean
ExecuteFile>C:\WINDOWS\system32\cleanmgr.exe
ResetDialogAction>MyDialog
END>Start Disk Clean

jj45410
Junior Coder
Posts: 38
Joined: Tue Nov 18, 2008 8:14 pm

Post by jj45410 » Sat Dec 06, 2008 6:13 am

Well this is the working version I made, It is different from you're version but mine still does the same thing with the same result..

Code: Select all

Dialog>dialog1
   Caption=Test Menu242
   Width=297
   Height=255
   Top=104
   Left=CENTER
   Button=Run Tasks,130,146,98,20,3
   Button=Exit Macro,130,170,97,20,2
   CheckBox=msCheckbox1,DWC,24,140,97,False
   CheckBox=msCheckbox2,Start Disk Defrag,24,160,97,False
   CheckBox=msCheckbox3,Start Disk Clean,24,180,97,False
   Button=www.youtube.com,24,17,120,25,10
   Button=www.myspace.com,24,48,120,25,11
   Button=www.yahoo.com,24,80,120,25,12
   Button=www.mjtnet.com,24,112,120,25,13
   Button=www.google.com,150,17,120,25,14
   Button=www.itunes.com,150,48,120,25,15
   Button=www.Morrowind.com,150,80,120,25,16
   Button=www.aol.com,150,112,120,25,17
   Image=C:\Documents and Settings\Goergia\My Documents\My Pictures\Backroundmenu1.bmp,0,0,289,201,msImage1,0
   MainMenu=Browsers,IExplorer(101),FireFox(102)
   MainMenu=Applications,NotepPad(201),Paint(202),Itunes(203)
   MainMenu=Games,World Of Warcraft(301),Counter Strike(302)
EndDialog>dialog1
Show>dialog1,result

Label>MainLoop
If>result=2
Endif
if>result=101
Run Program>C:\Program Files\Internet Explorer\iexplore.exe  
  ResetDialogAction>dialog1
Endif
if>result=102
Run Program>C:\Program Files\Mozilla Firefox\firefox.exe
  ResetDialogAction>dialog1
Endif
if>result=201
Run Program>C:\WINDOWS\system32\notepad.exe
  ResetDialogAction>dialog1
Endif
if>result=202
Run Program>C:\WINDOWS\system32\mspaint.exe
   ResetDialogAction>dialog1
Endif
 if>result=203
Run Program>C:\Documents and Settings\Jordan\Desktop\iTunes\iTunes Library.itl
  ResetDialogaction>dialog1
Endif
  if>result=301
Run Program>C:\Program Files\World of Warcraft\Launcher.exe
  ResetDialogaction>dialog1
Endif
 if>result=302
Run Program>C:\Program Files\Steam\steam.exe
  ResetDialogaction>dialog1
Endif
wait>0.01
If>result=10
  Exe>http://www.youtube.com
EndIf
If>result=11
  Exe>http://www.myspace.com
EndIf
If>result=12
  Exe>http://www.yahoo.com
EndIf
If>result=13
  Exe>http://www.mjtnet.com
Endif
If>result=14
  Exe>http://www.google.com
Endif
If>result=15
  Exe>http://www.itunes.com
Endif
If>result=16
  Exe>http://www.morrowind.com
Endif
If>result=17
  Exe>http://www.aol.com
Endif
if>result=2,End
if>result=3
if>dialog1.msCheckbox1=True,Del WoW Cache
if>dialog1.msCheckbox2=True,Start Disk Defrag
if>dialog1.msCheckbox3=True,Start Disk Clean
if>dialog1.msCheckbox4=True,Start Itunes
endif
let>result=1
Goto>MainLoop

Label>End

SRT>Del WoW Cache
IfDirExists>C:\Program Files\World of Warcraft\Cache
del>C:\Program Files\World of Warcraft\Cache
messagemodal>Cache Deleted
else
MessageModal>Cache Does Not Exsist
endif
END>Del WoW Cache

SRT>Start Disk Defrag
ExecuteFile>C:\WINDOWS\system32\dfrg.msc,
END>Start Disk Defrag

SRT>Start Disk Clean
ExecuteFile>C:\WINDOWS\system32\cleanmgr.exe,
END>Start Disk Clean

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