Sign in to follow this  
Followers 0
Pieter

Right-click menu doesn't work

4 posts in this topic

; ------------------------------------------------------------------------------
;
; Program name: MediaSync
; Version: 0.3 (UNFINISHED)
;
; Component name: MediaSync Watcher
; Function: keeping an eye on all inserted devices
;
; ------------------------------------------------------------------------------

#Include <Constants.au3>
#include <GuiConstants.au3>
$version = "0.3 (UNFINISHED)"
Break(0)

; Set up system tray menu
Opt("TrayMenuMode",1)
TraySetToolTip("MediaSync Watcher")
$menu_plugged       = TrayCreateItem("Device status")
$menu_sep1          = TrayCreateItem("")
$menu_syncnow       = TrayCreateItem("Synchronize now")
$menu_hotkeys       = TrayCreateItem("View hotkeys")
$menu_sep2          = TrayCreateItem("")
$menu_about         = TrayCreateItem("About")
$menu_exit          = TrayCreateItem("Exit")
TraySetState()

; Check if the settings file is present
$checksetfile = IniRead( "Settings.ini", "general", "present", "0")

If ($checksetfile = "0") Then
; Initiate first time wizard
    
    MsgBox(64,"MediaSync Watcher","It looks like this is the first time that you are using MediaSync. You'll need to configure it first. Press OK to start the Settings Wizard.")
    RunWait("SettingsWizard.exe")
    MsgBox(64,"MediaSync Watcher","You can start using MediaSync now. Thank you for trying it.")
    $asksync = MsgBox(36,"MediaSync Watcher", "Would you like to synchronize now? Please make sure your removable drive is plugged in. Otherwise, the synchronization might fail.")
    
    If ($asksync = 6) Then
    ; Start synchronizing for the first time
        Call("startsync")
    EndIf
    
    $prvstate = "plugged"
Else
    $prvstate = "unplugged"
EndIf

; Register hotkeys and load settings
Call("registerhotkeys")
$srcfldr = IniRead( "Settings.ini", "sync", "src", "0")
$destfldr = IniRead( "Settings.ini", "sync", "dest", "0")
$destdrive = IniRead( "Settings.ini", "sync", "drive", "0")

; Check if all settings are present
If ($srcfldr = "0") Or ($destfldr = "0") Or ($destdrive = "0") Then
; If ...
    
    MsgBox(48,"MediaSync Watcher","It looks like there is something wrong with the configuration of MediaSync. Press OK to start the Settings Wizard.")
    
; ... run the Settings Wizard again
    RunWait("SettingsWizard.exe")
    
; Reload the settings - UPDATED IN 0.3 DUE TO BUG
    $srcfldr = IniRead( "Settings.ini", "sync", "src", "0")
    $destfldr = IniRead( "Settings.ini", "sync", "dest", "0")
    $destdrive = IniRead( "Settings.ini", "sync", "drive", "0")
    
; Check if they are valid now
    If $srcfldr = "0" Or $destfldr = "0" Or $destdrive = "0" Then
    ; If not...
        
        MsgBox(48,"MediaSync Watcher","It looks like we weren't able to fix the problem. MediaSync cannot continue running now. Please write to pdedecker@gmail.com and tell him what you were doing with MediaSync before you got this message. Sorry for the inconvenience.")
        
    ; ... quit.
        Exit
    Else
        MsgBox(64, "MediaSync Watcher","Everything seems to be fixed. MediaSync Watcher can now continue running. We apologize for the inconvenience.")
    EndIf
EndIf

; Post-bootup stuff
$exit = 0
TrayTip("Welcome to MediaSync Watcher v" & $version, "Press CTRL+ALT+SHIFT+C to see a list of hotkeys.", 5, 1)

; Start the endless loop
Do
    Select
        Case FileExists($destdrive & "MediaSync.ini") AND $prvstate = "unplugged"
        ; Drive is found AND its state was unplugged
        ; The drive might need to be synchronized... but not without permission
            
            $asksync = MsgBox(36, "MediaSync Watcher","Removable drive " & $destdrive & ", which is configured for synchronization, is plugged in. Would you like to synchronize now?")
            
            If ($asksync = 6) Then
            ; User says 'Yes'
                Call("startsync")
            EndIf
            
        ; Set drive to plugged
            $prvstate = "plugged"
            
        Case NOT FileExists($destdrive & "MediaSync.ini")
        ; Nothing was found, so set the state to unplugged
            $prvstate = "unplugged"
    EndSelect
    
; Wait five seconds
Sleep(2500)

; Check if the hotkeys are still registered
Call("registerhotkeys")

; Right-click menu changes checker
$msg = TrayGetMsg()
Select
    Case $msg = 0
        ContinueLoop
    Case $msg = $menu_about
        Call("about")
    Case $msg = $menu_exit
        Exit
EndSelect

; Start all over again
Until $exit = 1

; Define the commands window
Func showCommands()
        MsgBox( 64, "MediaSync Watcher", "Here is a list of available commands: CTRL+ALT+SHIFT+Q: Quit, CTRL+ALT+SHIFT+S: Synchronize now")
EndFunc

; Define the exit command
Func exitWatcher()
    $exit = 1
    Exit
EndFunc

; Define the hotkey register function
Func registerhotkeys()
    HotKeySet("^!+q", "exitWatcher")
    HotKeySet("^!+c", "showCommands")
    HotKeySet("^!+s", "startsync")
EndFunc

; Define the sync started
Func startsync()
    Opt("TrayIconHide", 1)
    RunWait("MediaSync.exe")
    Opt("TrayIconHide", 0)
EndFunc
What's wrong here?


iPod + Online calendars = iPodCALsync

Share this post


Link to post
Share on other sites



Well I doubt it works when theres a popup, and

C:\Documents and Settings\Rad\My Documents\testa.au3 (35) : ==> Unable to execute the external program.: 
RunWait("SettingsWizard.exe") 
The system cannot find the file specified.

Disable t hat and

C:\Documents and Settings\Rad\My Documents\testa.au3 (149) : ==> Unable to execute the external program.: 
RunWait("MediaSync.exe") 
The system cannot find the file specified.

Disable that and...

C:\Documents and Settings\Rad\My Documents\testa.au3 (62) : ==> Unable to execute the external program.: 
RunWait("SettingsWizard.exe") 
The system cannot find the file specified.

Finally it can run error free, but after all those popups it closes anyway.. so... cant really test it

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Yeah, you need to change the .exe to .au3. I didn't compile these files yet. I will include the nessecary .au3's with this post. I'm still working on them, so they could be a bit buggy.

Edit: also, don't choose important folders while setting up the sync process. It might just mess up. You never know.

Edited by Pieter

iPod + Online calendars = iPodCALsync

Share this post


Link to post
Share on other sites

Did you find anything yet? :P


iPod + Online calendars = iPodCALsync

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