Okay, my "System Menu".

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

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

Okay, my "System Menu".

Post by jj45410 » Mon Jul 06, 2009 2:03 pm

Code: Select all

Dialog>dialog1
    Caption=System Control Pannel
    WIDTH=
    HEIGHT=
    TOP=
    LEFT=
    MAINMENU=File,Exit(2)
    MAINMENU=Browsers,Google Chrome(101),IE7(102),Opera(103),Firefox(104)
    MAINMENU=Applications,Hex Workshop(201),NO-IP DUC(202),SCAR(203),WinUHA(204),WinRAR(205),SwiftKit(206),Codeblocks(207),TeamViewer(208),ProcEXP(209),Script Editor(210),Turkojan(211)
    MAINMENU=Social APPS,AIM(301),Teamspeak(302),MSN(303)
    
    
    
    
    
    
    
    
    
    
EndDialog>dialog1
Show>dialog1,result





Label>MainLoop
//Browsers
If>result=2
Endif
If>result=101
Run Program>C:\Users\Jordan\Desktop\MacroCalls\Google Chrome
    ResetDialogAction>dialog1
Endif
If>result=102
Run Program>C:\Users\Jordan\Desktop\MacroCalls\Internet Explorer (2)
    ResetDialogAction>dialog1
Endif
If>result=103
Run Program>C:\Opera
    ResetDialogAction>dialog1
Endif
If>result=104
Run program>C:\Firefox
    ResetDialogAction>dialog1
Endif
****
****
****
****
****
****
****
//Applications
If>result=201
Run program>C:\Hexwork
    ResetDialogAction>dialog1
Endif
If>result=202
Run program>C:\No-IP
    ResetDialogAction>dialog1 
Endif
If>result=203
Run program>C:\SCAR
    ResetDialogAction>dialog1
Endif
If>result=204
Run program>C:\WinUHA
    ResetDialogAction>dialog1
Endif
If>result=205
Run program>C:\Users\Jordan\Desktop\MacroCalls\WinRAR
    ResetDialogAction>dialog1  
Endif
If>result=206
Run program>C:\Swiftkit
    ResetDialogAction>dialog1
Endif
If>result=207
Run program>C:\Codeblocks
    ResetDialogAction>dialog1
Endif
If>result=208
Run program>C:\TeamViewer
    ResetDialogAction>dialog1
Endif
If>result=209
Run program>C:\ProcEXP
    ResetDialogAction>dialog1
Endif
If>result=210
Run program>C:\Script Editior
    ResetDialogAction>dialog1
Endif
If>result=211
Run program>C:\Turkojan
    ResetDialogAction>dialog1
Endif
****
****
****
****
//Social APPS
If>result=301
Run program>C:\AIM
    ResetDialogAction>dialog1
Endif
If>result=302
Run program>C:\Teamspeak
    ResetDialogAction>dialog1
Endif
If>result=303
Run program>C:\MSN
    ResetDialogAction>dialog1
Endif
let>result=1
Goto>MainLoop

Alright, So pretty much this is my menu that I'm going to make that will "Erase" if you will the need for icons all over my desktop so pretty much everything I need to click will be where I need it. So, The file paths are all fake at the moment because I haven't put them in but the WinRAR one IS correct and when I click on the WinRAR option on the menu and nothing at all happens. Help please, thank you.
[/code]

gdyvig
Automation Wizard
Posts: 447
Joined: Fri Jun 27, 2008 7:57 pm
Location: Seattle, WA

Missing statement?

Post by gdyvig » Mon Jul 06, 2009 2:44 pm

Hi jj45410,

I think you forgot this statement at the beginning of your MainLoop:

Code: Select all

GetDialogAction,result

Gale

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

Post by jj45410 » Tue Jul 07, 2009 10:53 pm

That didn't work, but I did forget that and thank you.

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

Post by JRL » Wed Jul 08, 2009 3:27 am

Hi jj45410,

First thing is that the MainMenu object only works in a non-modal dialog and you have a modal dialog. The difference between creating a modal or non-modal dialog is simply whether or not the Show> function includes a result variable. See help for dialogs for a more thorough explanation.

Show>dialog1,result should be Show>dialog1

Next is as Gale pointed out, you need the GetDialogAction Line

Third thing I noticed is you have misstyped the "RunProgram>" function (one word) as "Run Program>" (Two words). The function fails if you make it two words.



Actually, I've done this already and found it is easier to understand and add more items later if you use a subroutine. So I took the liberty of rewriting your script in a manner with which I am familiar.

Hope you don't mind and hope this is helpful,
Dick

Code: Select all

Dialog>dialog1
    Caption=System Control Panel
    WIDTH=250
    HEIGHT=60
    TOP=CENTER
    LEFT=CENTER
    MAINMENU=File,Exit(2)
    MAINMENU=Browsers,Google Chrome(101),IE7(102),Opera(103),Firefox(104)
    MAINMENU=Applications,Hex Workshop(201),NO-IP DUC(202),SCAR(203),WinUHA(204),WinRAR(205),SwiftKit(206),Codeblocks(207),TeamViewer(208),ProcEXP(209),Script Editor(210),Turkojan(211)
    MAINMENU=Social APPS,AIM(301),Teamspeak(302),MSN(303)
EndDialog>dialog1

Show>dialog1

Label>MainLoop
  GetDialogAction>Dialog1,result
  If>result<>0,OpenSelection
  Wait>0.01
Goto>MainLoop

//This subroutine runs any app sent to it
SRT>Open
  If>result=%Open_var_1%
    //For demo purposes opening a message.
    //Unremark the RunProgram> line and remove or remark
    //The MDL> line to execute for real.
    //RunProgram>%Open_var_2%
    MDL>%Open_var_2%
    ResetDialogAction>dialog1
  Endif
END>Open

Label>OpenSelection
If>result=2
  Exit>0
Endif

//Open Subroutine Usage:
//GoSub>Open,Result number,Application path and name

//Browsers

GoSub>Open,101,C:\Users\Jordan\Desktop\MacroCalls\Google Chrome
GoSub>Open,102,C:\Users\Jordan\Desktop\MacroCalls\Internet Explorer (2)
GoSub>Open,103,C:\Opera
GoSub>Open,104,C:\Firefox

****
****

//Applications

GoSub>Open,201,C:\Hexwork
GoSub>Open,202,C:\No-IP
GoSub>Open,203,C:\SCAR
GoSub>Open,204,C:\WinUHA
GoSub>Open,205,C:\Users\Jordan\Desktop\MacroCalls\WinRAR
GoSub>Open,206,C:\Swiftkit
GoSub>Open,207,C:\Codeblocks
GoSub>Open,208,C:\TeamViewer
GoSub>Open,209,C:\ProcEXP
GoSub>Open,210,C:\Script Editior
GoSub>Open,211,C:\Turkojan

****
****

//Social APPS

GoSub>Open,301,C:\AIM
GoSub>Open,302,C:\Teamspeak
GoSub>Open,303,C:\MSN

Goto>MainLoop

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

Post by Marcus Tettmar » Wed Jul 08, 2009 6:49 am

Third thing I noticed is you have misstyped the "RunProgram>" function (one word) as "Run Program>" (Two words). The function fails if you make it two words.
It shouldn't do. It is backward compatible for old versions that used "Run Program".
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

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

Post by JRL » Wed Jul 08, 2009 3:06 pm

Oops.... my mistake. I was going by the syntax highlight and made the assumption that the two word version would fail because the syntax highlight on the two word version failed.

I've always used just Run> and never noticed that the function had changed from "Run Program>" to "RunProgram>". I'll have to look in history to see when that happened.

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