Sign in to follow this  
Followers 0
CrewXp

Connectivity Suggestions / Multi-Tasking Suggestions? Program Delayed for 4 years bc of it. Need Smart Gurus.

3 posts in this topic

#1 ·  Posted (edited)

First of all, let me say thanks for reading this thread and trying to help me out. I've been stuck on this for about 4-5 years, as I have common sense, but lack the computer-science knowledge to follow through. You're doing me a big help. I've tried all I can, but face it... I need some help.. otherwise it'll never get finished.

Yea... I've finally found the time to continue with my personal program, expanding on it, but I'm still lacking a core part of it....

...Connectivity. It's the hardest part, and is the reason why I've always put off this side-project.

It goes like this:

[Server ------(MYSQL)---------] <- Contains User Information and Data
                   |               |
            Program        | <- 'Program' Contains User Data (Main Program). Access/Verifies user info against SQL Server
                   |-------Addon-Program (Module)  <-'Addon' makes sure Program is running (bc its an ADDON), then has to get user info from 'Program'
                   |-------Addon-Program (Example Chat-Module) <-Seperate Chat Server as another example of an addon

Note:

1.) 'Modules' can be installed individually. When I make a new program, I don't want to have to re-code and have the user update their main program. I need some sort of way for the Main Program to know that the 'module' is loaded, and can send data from the main program to the addon. As well as the addon being able to send data to the main program. (Vise-Versa)

Why I need this (What I need the connectivity for...)

Example 1.) Lets say I make another 'addon'. The main program sql's the server to get the install info. Downloads it, then installs.

Example 2.) New Chat msg On Chat server Module. Need the module to send a variable-change in the main program, so that the main program changes colors or something.

Example 3.) Chat server has to constantly monitor for new chat msgs. If I hard-encoded that in the main program, it would be listening for chat 24/7, and could not perform other functions (Stuck in While Loop).

Example 4.) When the program is closed, I need the 'Launch Module X' button on the main program to be enabled again. (How can I let the main program know what the module is doing, running, stopped).

What I'm on now: Right now I'm trying out the SQL stuff, as I know where to go with that.

Main Program Purpose: Everything. Useful tool that simplifies everything I do.

Module Example: One of the addons I'm making for the main program is a Staff Manager. I manage a fansub group (We work on 5 shows total now. We wait for a show to air in Japan, Download it, Put time placements for the subtitles, Translate it, Style-ize fonts, Add Karaoke, Encode the Video, Then Distribute). We have about 10 total people on staff, and with 5 shows and all different kinds of jobs to do, we lose track of who's doing what. I'm making the addon have a place so users can login to the main program, and the module shows their jobs. The user can then update their Job-Status (What they're doing), and the staff module sends it to the sql server. And everyone elses program updates with that info too (Just use an auto sql-query every 5 seconds or so?)

IMPORTANT NOTE THATS SET ME BACK :: is that my Main Program is basically a giant GUI. It's sitting in a While Loop (GUIGetmsg) waiting for a button to be clicked on. The buttons perform different functions hard-coded into the program. Once the button is clicked, and the function is performed, it goes back to the loop. During that time, the main program can not do anything else. That's the main problem with me.... I can't get the program to do other things while it's in the loop.

Sry this is so long, I'll summarize it up.

1.) Being able for my modules to request data from the main program (user info), and send data (letting the main program know that its running)

2.) I can't get the main program to do other things while it's in the loop. (Noting to important note above, as its a giant While Loop Program). Need it to constantly check to see if a module is running, if it is, adds a Tray Item to the task bar, and greys out the Launch button on the GUI, when module is closed, removed tray item and enabled Launch Button. checking my http server for a version_file to see if it has an update would also be another use for the multi-tasking).

3.) SIDE QUESTION: Since I'm using separate programs as my 'modules' for the main program.... is there any way to embed the modules into the program? Or hide the modules from the task manager? (So that the task manager doesn'tshow 20 modules running at the same time).

It's 6am, im going to bed. Hopefully I can get a lot of work done on this tomorrow with your suggestions.

Thanks a LOT, I really appreciate it.

Main Program Example:

Func MainGui()
$maingui =GUICreate("MyKit - MODULE",240,180);Main GUI Program
$secondarygui =GUICreate("MyKit Secondary",240,180,-1,-1,$WS_EX_TOOLWINDOW);Hidden GUI Window, used for later as I can't GUICreate in functions, then have it go back to the main while loop.
$infoGUI =GUICreate("CrewKit - Info",480,360,-1,-1,$WS_EX_TOOLWINDOW);Hidden GUI Window, used for later as I can't GUICreate in functions, then have it go back to the main while loop.
GuiSetState(@SW_HIDE,$infogui)
GuiSetState(@SW_HIDE,$secondarygui)
GuiSetState(@SW_ENABLE,$maingui)

;
;CREATE BUTTONS
$c=1
    For $b = 1 To 42
        If $c = 1 Then $x = 0
        $Button[$b] = GUICtrlCreateButton ($SPN[$b], $x, 0, 40, 40,$BS_ICON)
        GUICtrlSetTip(-1, $SPN[$b])
      ;If $b >= 7 Then GUICtrlSetState(-1, $GUI_HIDE + $GUI_DISABLE)
        $x += 40
        $c=$c+1
        If $c=7 Then $c=1
    Next
;
Draw();Hides unused buttons, and only shows main buttons. When main button clicked on, disables main buttons and enabled unused other buttons.
$background=0
$background = GUICtrlCreatePic ("C:\Program Files\CrewKit\Bin\back.jpg", 0, 40, 240, 180)
GUICtrlSetState(-1, $GUI_DISABLE)
GUISetState(@SW_SHOW, $maingui)

While 1
        $msg = GUIGetMsg()
        Select
        Case $msg = $GUI_EVENT_CLOSE Or $msg = $Button[6]; Exit/ Close
            GuiSetState(@SW_HIDE,$maingui);ExitLoop
        Case $msg = $Button[1];X-Net - 1
            aToggleXnet()
        Case $msg = $Button[2];X-Media - 2
            bToggleXmedia()
        Case $msg = $Button[3];Misc - 3
            cToggleMisc()
        Case $msg = $Button[4];Games - 4
            dToggleGames()
        Case $msg = $Button[5];Settings - 5
            eSettings()
        Case $msg = $Button[6];Close - 6
            GuiSetState(@SW_HIDE,$maingui);ExitLoop
        Case $msg = $Button[7];Network - 7
            aNetwork()
        Case $msg = $Button[8];Chat - 8
            aChat()
        Case $msg = $Button[9];File Manager - 9
            aFileManager()
        Case $msg = $Button[10];Member Sites - 10
            aMemberSites()
        Case $msg = $Button[11];Settings - 11
            aSettings()
        Case $msg = $Button[12];Back - 12
            aBack()
        Case $msg = $Button[13];X-Media Home - 13
            bMediaHome()
        Case $msg = $Button[14];Categories - 14
            bCategories()
        Case $msg = $Button[15];Search - 15
            bSearch()
        Case $msg = $Button[16];Status - 16
            bStatus()
        Case $msg = $Button[17];Add - 17
            bAdd()
        Case $msg = $Button[18];Back - 18
            bBack()
        Case $msg = $Button[19];Install Packages - 19
            cInstallPackages()
        Case $msg = $Button[20];Links - 20
            cLinks()
        Case $msg = $Button[21];Sticky Notes - 21
            cStickyNotes()
        Case $msg = $Button[22];Calendar - 22
            cCalendar()
        Case $msg = $Button[23];More - 23
            cMore()
        Case $msg = $Button[24];Back - 24
            cBack()
        Case $msg = $Button[25];PC Info - 25
            c2PcInfo()
        Case $msg = $Button[26];Torrent Search - 26
            c2TorrentSearch()
        Case $msg = $Button[27];Staff Manager - 27
            c2Anime()
        Case $msg = $Button[28];HotKeys - 28
            c2IRC()
        Case $msg = $Button[29];More - 29
            c2More()
        Case $msg = $Button[30];Back - 30
            c2Back()
        Case $msg = $Button[31];Chess - 31
            Blank()
        Case $msg = $Button[32];Sudoku - 32
            Blank()
        Case $msg = $Button[33];Tic-Tac-Toe - 33
            Blank()
        Case $msg = $Button[34];BLANK - 34
            Blank()
        Case $msg = $Button[35];Game Tools - 35
            Blank()
        Case $msg = $Button[36];Back - 36
            eBack()
        Case $msg = $Button[37];Find CS-Scrim - 37
            Blank()
        Case $msg = $Button[38];Find Player - 38
            Blank()
        Case $msg = $Button[39];BLANK
            Blank()
        Case $msg = $Button[40];BLANK
            Blank()
        Case $msg = $Button[41];BLANK
            Blank()
        Case $msg = $Button[42];BLANK
            Blank()
        Case $msg = $btn; Declare the btn
            bProcessCode($btn)
        EndSelect
    WEnd
;END NEW WHILE SECTION

GUIDelete()
EndFunc

;Other Functions Removed as my script is 11,000 lines long.

While 1
WEnd
Edited by CrewXp

Share this post


Link to post
Share on other sites



I say go with GUIOnEventMode() if you want things to run while in the loop. You have to remember autoit is single threaded so there can only be one task at a time, GUIOnEventMode() will allow you to check for new tasks even while in a loop but it will interrupt the current task to execute the new one. As for connectivity I say look at the TCP functions. There are a lot of good examples on the forums and you can send a messages back and forth that way. You could also use _SendMessage() which I have no real experience with but that would also allow your program and your addons to communicate.

Share this post


Link to post
Share on other sites

Are you needing a simple way of 2 scripts communicating with eachother or are you refering to a over the network communication?

If you want to have 2 (or more) scripts talk to each on the same computer then look in my signature I have a UDF for doing just that.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0