AutoHotkey Community

It is currently May 26th, 2012, 6:09 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 10 posts ] 
Author Message
PostPosted: February 5th, 2009, 8:57 pm 
Offline

Joined: September 28th, 2007, 3:56 am
Posts: 279
Location: New York
I have a program that about 100 people use, the problem I encounter is this: When I need to update the file I have to ask everyone to close the program so I can delete the old and put in the new file. Is there any way I can forcefully disconnect people from the program?

Some employees that use it are on other shifts and they leave it open on their locked computer. The program is on a network so what I have been doing is disconnecting the network cable which, in turn, disconnects them from my program. So, I just want to know if there is an alternative where I can control it from my PC.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 5th, 2009, 9:27 pm 
Offline

Joined: June 28th, 2007, 1:08 am
Posts: 662
Well, not sure about doing networked controlled stuff, but I wrote a script that would perform a version check against a file on one of my old servers upon startup.

If the file version matched, the program continued, if not, it asked if the user wished to update.

Upon selecting yes, the program would connect and download two more items. The first is a patcher and the second would be the new version of the script.

The program would then launch the patcher. The patcher would close out the program and delete it, then rename the new program and launch it before closing itself.

Upon the updated program launching, it would version check, and if correct, delete the patcher.

You could setup something like this using a time comparison to periodically check for a new version every 24 hours or so, then have the program show a popup with a timer. If the timer expired, the program would connect to your server and update itself.

My server is no longer in operation, but here is the source for the three components of the system I described.

Main program:
Code:
#SingleInstance Force
#NoEnv
SetBatchLines -1
SendMode Play
SetTimer, UpdateClock, 999

;<====================>
;<=====  Credit  =====>
;<====================>

; First off, I would like to thank all of the contributors at AutoHotKey.com, as I have learned quite a bit just by reading through the forums.
; Various bits and pieces of this script are pulled from other scripts that were posted there, though I don't remember exact authors for each piece.
; Special thanks to Laszlo, Lexikos, and Rajat for being those that I have seemed to learn the most from.
; And we can't forget Chris, without whom I would still be staring at the computer hoping that I could program(or script) without reading for months before getting something working.

;<==================>
;<=====  ToDo  =====>
;<==================>

; Implement script download on first run.
; Look into hotkey-fade in/out to show/hide UI.

;<======================>
;<=====  INI Read  =====>
;<======================>

IniRead, FFont, AOCO.ini, Font, FFont, MS Sans Serif
IniRead, FColor, AOCO.ini, Font, FColor, Lime
IniRead, Wide, AOCO.ini, UI, Wide, 100
IniRead, Tall, AOCO.ini, UI, Tall, 20
IniRead, CallColor, AOCO.ini, Callout, CallColor, AA0000
IniRead, Bot, AOCO.ini, Bot Settings, Bot, Ebot
IniRead, Hide, AOCO.ini, Hotkeys, Hide, PgDn
IniRead, Show, AOCO.ini, Hotkeys, Show, PgUp
IniRead, InstallDir, AOCO.ini, General, InstallDir
Loop, 12
  {
    IniRead, Bane%A_Index%, AOCO.ini, Bane, Bane%A_Index%, %A_Space%
  }

;<=======================>
;<=====  Ver Check  =====>
;<=======================>

Ver := 1.1 ; This program version

IfExist, curver.txt
  FileDelete, curver.txt
IfExist, AOCOup.exe
  FileDelete, AOCOup.exe
Sleep, 100
UrlDownloadToFile, http://eldarguild.org/aoco/curver.txt, curver.txt
Loop
  {
   IfExist, curver.txt
     Break
  }
FileRead, curver, curver.txt
If (curver < ver)
  {
   MsgBox,4,, You do not have the latest version. Do you want to update now? 
    IfMsgBox Yes
      {
       UrlDownloadToFile, http://eldarguild.org/aoco/program/AOCO.exe, AOCONew.exe
       UrlDownloadToFile, http://eldarguild.org/aoco/program/AOCOup.exe, AOCOup.exe
       Run, AOCOup.exe
       ExitApp
     }
  }
IfExist, curver.txt
  FileDelete, curver.txt
IfExist, AOCOup.exe
  FileDelete, AOCOup.exe
 
;<=======================>
;<=====  Variables  =====>
;<=======================>

;<=====  GUI  =====>

Thin := Wide / 2                     ;Width of thin buttons
ThinX := Thin + 12                     ;Placement of right thin buttons
XPos := A_ScreenWidth - (Wide + 15)         ;Placement on right side of screen
2XPos := A_ScreenWidth - (2 * Wide + 15)   ;Placement of secondary GUI windows next to primary
3XPos := A_ScreenWidth - (3 * Wide + 40)   ;Placement of third GUI windows next to secondary
SaveX := ThinX+25                     ;Placement of BaneList Save Button
TTall := Tall + 10                     ;Height of taller buttons
ClearColor = EEAA99                     ;Transparency color used to make UI background clear

FSize = 10                           ;Font size
FWeight = 450

;<==================>
;<=====  Menu  =====>
;<==================>

If InstallDir != ERROR
  {
    Menu, Tray, Icon, %InstallDir%\AgeOfConan.exe
  }
Menu, Tray, NoStandard
Menu, Tray, Add, Options,Options
Menu, Tray, Add
Menu, Tray, Standard

;<=======================>
;<=====  First Run  =====>
;<=======================>

If InstallDir = ERROR
  {
    Gui, 1:Add, Text, x13 y12 w220 h30 +Center vText1, Please select you Age of Conan installation.
    Gui, 1:Add, Text, x12 y52 w170 h20 vInstallDirLong,
    Gui, 1:Add, Button, x182 y42 w60 h30 vFDir gFDir, ...
    Gui, 1:Add, Button, x12 y82 w230 h30 vOK gFOK, OK
    Gui, 1:Show, xCenter yCenter h123 w250, AoC Install Browser
    Return
  }
Else
  GoSub, MainUI
Return

FDir:
  InstallDir =
  FileSelectFile, InstallDirLong, 3, ::{20d04fe0-3aea-1069-a2d8-08002b30309d}, Select AoC Installation.,Program File (AgeOfConan.exe)
  GuiControl, Text, InstallDirLong, %InstallDirLong%
  Return

FOK:
  StringTrimRight, InstallDir, InstallDirLong, 15
  IniWrite, %InstallDir%, AOCO.ini, General, InstallDir
  GuiControl, Text, Text1, Preparing to download required scripts.
  GuiControl, Hide, InstallDirLong
  GuiControl, Hide, FDir
  GuiControl, Disable, OK
  Sleep, 100
  Guicontrol,
 
  GoSub, Options
  Return
 
;<=================>
;<=====  GUI  =====>
;<=================>

;<=====  Main  =====>

MainUI:
  UISettings("2")
  Gui, 2:Add, Text, x12 y12 w%Wide% h20 +Center, AoC Tools

  Gui, 2:Add, Button, x12 y+5 w%Thin% h%Tall% gMax , Max
  Gui, 2:Add, Button, x%ThinX% yp+0 w%Thin% h%Tall% gMin , Min
  Gui, 2:Add, Button, x12 y+0 w%Wide% h%Tall% gKill , Kill AoC

  Gui, 2:Add, Button, x12 y+5 w%Wide% h%Tall% gRec , Recruit
  Gui, 2:Add, Button, x12 y+0 w%Wide% h%Tall% gVent , Vent Info

  Gui, 2:Add, Button, x12 y+5 w%Wide% h%Tall% gBotMenu , Bot Menu
  Gui, 2:Add, Button, x12 y+0 w%Wide% h%Tall% gRMenu , Raid Menu

  Gui, 2:Add, Text, x12 y+5 w%Wide% h20 +Center vClock, ;Clock Control

  Gui, 2:Show, x%XPos% yCenter NoActivate, AoC Overlay
  Return

;<=====  Options  =====>

Options:
  Gui, 3:Add, Text, x9 y2 w180 h20 +Center, AoC Overlay - Options
  Gui, 3:Add, Text, x12 y+5 w70 h20 , Font:
  Gui, 3:Add, DropDownList, x92 yp+0 w100 h20 r6 vFFont, Arial|Courier|Lucida Console|MS Sans Serif||Tahoma|Times New Roman
  Gui, 3:Add, Text, x12 y+10 w70 h20 , Font Color:
  Gui, 3:Add, ListView, x92 yp+0 w100 h20 ReadOnly 0x4000 +Background%FColor% vFColor gChangeFColor
  Gui, 3:Add, Text, x12 y+10 w70 h20 , UI Width:
  Gui, 3:Add, Edit, x92 yp+0 w100 h20,
  Gui, 3:Add, UpDown, x172 yp+0 w20 h20 vWide Range100-300, %Wide%
  Gui, 3:Add, Text, x12 y+10 w70 h20 , Button Height:
  Gui, 3:Add, Edit, x92 yp+0 w100 h20 ,
  Gui, 3:Add, UpDown, x172 yp+0 w20 h20 vTall Range20-50, %Tall%
  Gui, 3:Add, Text, x12 y+10 w70 h20 , Callout Color:
  Gui, 3:Add, ListView, x92 yp+0 w100 h20 ReadOnly 0x4000 +Background%CallColor% vCallColor gChangeCallColor
  Gui, 3:Add, Text, x12 y+10 w70 h20 , Bot Name:
  Gui, 3:Add, Edit, x92 yp+0 w100 h20 vBot , %Bot%
  Gui, 3:Add, Text, x12 y+10 w70 h20 , Show UI:
  Gui, 3:Add, Hotkey, x92 yp+0 w100 h20 0x8000000 vHide, %Hide%
  Gui, 3:Add, Text, x12 y+10 w70 h20 , Hide UI:
  Gui, 3:Add, Hotkey, x92 yp+0 w100 h20 0x8000000 vShow, %Show%
  Gui, 3:Add, Button, x12 y+10 w180 h20 gSaveOptions, Save
 
  Gui, 3:Show, xCenter yCenter, AoC Overlay Options
  Return
 
;<=====  Raid Menu  =====>

RMenu:
  Gui, 5:Destroy
  Gui, 6:Destroy
  Gui, 8:Destroy
  UISettings("4")
  Gui, 4:Add, Text, x12 y12 w%Wide% h20 +Center, Raid Menu

  Gui, 4:Add, Button, x12 y+5 w%Wide% h%Tall% gClicky , Clicky
  Gui, 4:Add, Button, x12 y+0 w%Wide% h%Tall% gVistrix , Vistrix

  Gui, 4:Add, Button, x12 y+5 w%Wide% h%Tall% gCRMenu , Close

  Gui, 4:Show, x%2XPos% yCenter NoActivate, Raids
 Return

CRMenu:
  Gui, 4:Destroy
  Gui4 = 0
  Return

;<=====  Clicky  =====>

Clicky:
  Gui, 4:Destroy
  UISettings("5")
  Gui, 5:Add, Text, x12 y12 w%Wide% h20 +Center, Clicky

  Gui, 5:Add, Button, x12 y+5 w%Wide% h%Tall% gRules , Raid Rules

  Gui, 5:Add, Button, x12 y+5 w%Wide% h%Tall% gCKill , Kill Order
  Gui, 5:Add, Button, x12 y+0 w%Wide% h%Tall% gHonor , Honor Strat

  Gui, 5:Add, Button, x12 y+0 w%Wide% h%Tall% gSpell , Spell Strat

  Gui, 5:Add, Button, x12 y+5 w%Thin% h%TTall% gDPSOff , DPS Off
  Gui, 5:Add, Button, x%ThinX% yp+0 w%Thin% h%TTall% gDPSOn , DPS On
  Gui, 5:Add, Button, x12 y+0 w%Wide% h%TTall% gChamp , Champion DPS

  Gui, 5:Add, Button, x12 y+5 w%Wide% h%Tall% gCCMenu , Close
 
  Gui, 5:Show, x%2XPos% yCenter NoActivate, Clicky
  Return

CCMenu:
  Gui, 5:Destroy
  Gui5 = 0
  Return
 
;<=====  Vistrix  =====>

Vistrix:
  Gui, 4:Destroy
  UISettings("6")
  Gui, 6:Add, Text, x12 y12 w%Wide% h20 +Center, Vistrix

  Gui, 6:Add, Button, x12 y+5 w%Wide% h%Tall% gRules , Raid Rules

  Gui, 6:Add, Button, x12 y+5 w%Wide% h%Tall% gVKill , Kill Order
  Gui, 6:Add, Button, x12 y+0 w%Wide% h%Tall% gVList , Make Bane List
  Gui, 6:Add, Button, x12 y+0 w%Wide% h%Tall% gBList , Bane List
  Gui, 6:Add, Button, x12 y+0 w%Thin% h%TTall% gDPSOff , DPS Off
  Gui, 6:Add, Button, x%ThinX% yp+0 w%Thin% h%TTall% gDPSOn , DPS On
  Gui, 6:Add, Button, x12 y+0 w%Wide% h%TTall% gBane , Next Bane
 
  Gui, 6:Add, Button, x12 y+5 w%Wide% h%Tall% gCVMenu , Close
 
  Gui, 6:Show, x%2XPos% yCenter NoActivate, Vistrix
  Return

CVMenu:
  Gui, 6:Destroy
  Gui6 = 0
  Return
 
;<=====  Bane Order  =====>

VList:
  UISettings("7") 
  Gui, 7:Add, Text, x20 y12 w%Wide% h20 +Center, Bane Order

  LYPos = 37
  Loop, 12
    {
     ThisBane := Bane%A_Index%
     Gui, 7:Add, Text, x12 y%LYPos% w20 h%Tall%, %A_Index%:
     Gui, 7:Add, Edit, x37 y%LYPos% w%Wide% h%Tall% vBane%A_Index%, %ThisBane%
     LYPos += %Tall%
    }
  Gui, 7:Add, Button, x37 y+0 w%Thin% h%Tall% gBSave, Save
  Gui, 7:Add, Button, x%SaveX% yp+0 w%Thin% h%Tall% gBClear, Clear

  Gui, 7:Add, Button, x37 y+5 w%Wide% h%Tall% gCBList, Close
 
  Gui, 7:Show, x%3XPos% yCenter NoActivate, Bane List
  Return
 
CBList:
  Gui, 7:Destroy
  Gui7 = 0
  Return

;<=====  Bot Menu  =====>

BotMenu:
  Gui, 4:Destroy
  Gui, 5:Destroy
  Gui, 6:Destroy
  UISettings("8")
  Gui, 8:Add, Text, x12 y12 w%Wide% h20 +Center, Bot Interaction
 
  Gui, 8:Add, Button, x12 y+5 w%Wide% h%Tall% gBReset, Reset Bot
 
  Gui, 8:Add, Button, x12 y+5 w%Wide% h%Tall% gBOnline, Online Member
  Gui, 8:Add, Button, x12 y+0 w%Wide% h%Tall% gBsm, Show Members
 
  Gui, 8:Add, Button, x12 y+5 w%Wide% h%Tall% gBNews, Check News
 
  Gui, 8:Add, Button, x12 y+5 w%Wide% h%Tall% gBShow, Show Mules
  Gui, 8:Add, Button, x12 y+0 w%Wide% h%Tall% gBAdd, Mule Add
  Gui, 8:Add, Button, x12 y+0 w%Wide% h%Tall% gBDel, Mule Delete

  Gui, 8:Add, Button, x12 y+5 w%Wide% h%Tall% gBItems, Item Search
 
  Gui, 8:Add, Button, x12 y+5 w%Wide% h%Tall% gBAsk, Ask Trivia
  Gui, 8:Add, Button, x12 y+0 w%Wide% h%Tall% gBAnswer, Answer
  Gui, 8:Add, Button, x12 y+0 w%Wide% h%Tall% gBGiveup, Giveup
 
  Gui, 8:Add, Button, x12 y+5 w%Wide% h%Tall% gBGems , Gem Info
   
  Gui, 8:Add, Button, x12 y+5 w%Wide% h%Tall% gCBMenu, Close
 
  Gui, 8:Show, x%2XPos% yCenter NoActivate, Bot Interaction
  Return

CBMenu:
  Gui, 8:Destroy
  Gui8 = 0
  Return

;<=======================>
;<=====  Functions  =====>
;<=======================>

UISettings(X)
{
  Global
  Gui, %X%:Color, %ClearColor%, Default
  Gui, %X%:+LastFound +AlwaysOnTop
  WinSet, TransColor, %ClearColor% 127
  Gui %X%:-Caption +ToolWindow
  Gui, %X%:Font, c%FColor% s%FSize% w%FWeight%, %FFont%
}

WinOrder()
{
  WinSet, AlwaysOnTop, Off, Age of Conan
  Gui 2:+AlwaysOnTop
  Gui 4:+AlwaysOnTop
  Gui 5:+AlwaysOnTop
  Gui 6:+AlwaysOnTop
  Gui 7:+AlwaysOnTop
}

Script(X)
{
  WinActivate, Age of Conan
  WinWaitActive, Age of Conan
  Send {Enter}
  Sleep, 10
  Send /%X%
  Sleep, 10
  Send {Enter}
  WinOrder()
}

BotInput(X)
{
  Global
  WinActivate, Age of Conan
  WinWaitActive, Age of Conan
  Send {Enter}
  Sleep, 10
  Send /tell %Bot%%A_Space%%X%
  WinOrder()
}

BotCmd(X)
{
  Global
  WinActivate, Age of Conan
  WinWaitActive, Age of Conan
  Send {Enter}
  Sleep, 10
  Send /tell %Bot%%A_Space%%X%
  Sleep, 10
  Send {Enter}
  WinOrder()
}

ChooseColor( Clr=0x0, Par=0x0 )
{
  Hex:="123456789ABCDEF0", VarSetCapacity(CC,36,0), RGB:=&CC+11, VarSetCapacity(D,64,0)
  NumPut(36,CC,0), NumPut(Par,CC,4), NumPut(Clr,CC,12), NumPut(&D,CC,16), NumPut(259,CC,20)
  If ! DllCall( "comdlg32\ChooseColorA", str,CC ) OR ErrorLevel
    Return -1
  Loop 3
    HexCC .=  SubStr(Hex, (*++RGB >> 4), 1) . SubStr(Hex, (*RGB & 15), 1)
  Return HexCC
}
   
;<====================================>
;<=====  Subs (Button Commands)  =====>
;<====================================>

;<=====  Options  =====>

ChangeCallColor:
  GuiControlGet, CurrentColor,, CallColor
  NewColor := ChooseColor(%CurrentColor%, WinExist() )
  GuiControl,,3:CallColor, +Background%NewColor%
  GuiControl, 3:+Background%NewColor%, CallColor,%NewColor%
  IniWrite, %NewColor%, AOCO.ini, Callout, CallColor
  Return

ChangeFColor:
  GuiControlGet, CurrentColor,, FColor
  NewColor := ChooseColor(%CurrentColor%, WinExist() )
  GuiControl,,3:FColor, +Background%NewColor%
  GuiControl, 3:+Background%NewColor%, FColor,%NewColor%
  IniWrite, %NewColor%, AOCO.ini, Font, FColor
  Return
   
SaveOptions:
  Gui, 3:Submit
  IniWrite, %FFont%, AOCO.ini, Font, FFont
  IniWrite, %FWeight%, AOCO.ini, Font, FWeight
  IniWrite, %Wide%, AOCO.ini, UI, Wide
  IniWrite, %Tall%, AOCO.ini, UI, Tall
  IniWrite, %Bot%, AOCO.ini, Bot Settings, Bot
  IniWrite, %Hide%, AOCO.ini, Hotkeys, Hide
  IniWrite, %Show%, AOCO.ini, Hotkeys, Show
  Reload
  Return
 
;<=====  Main GUI  =====>

Max:
  WinActivate Age of Conan
  WinWaitActive, Age of Conan
  WinSet, Style, -0x800000, Age of Conan
  WinSet, AlwaysOnTop, Off, Age of Conan
  WinMove, , , 0, 0, %A_ScreenWidth%, %A_ScreenHeight%
  Return

Min:
  WinMinimize, Age of Conan
  Return

Kill:
  MsgBox, 52, Kill AoC, Kill AoC process?
  IfMsgBox Yes
    Process, Close, AgeOfConan.exe
  IfMsgBox No
    Return
  Return

Rec:
  Script("recruit")
  Return
 
Vent:
  Script("vent")
  Return
 
UpdateClock:
  FormatTime, time,,h:mm:ss
  GuiControl,2:, Clock, %time%
  Return
   
;<=====  General Raid  =====>

Rules:
  Script("rules")
  Return

DPSOff:
  Script("7")
  Return
 
DPSOn:
  Script("6")
  Return
 
;<=====  Clicky  =====> 

CKill:
  Script("ckill")
  Return
 
Honor:
  Script("honor")
  Return
 
Spell:
  Script("spell")
  Return
 
Champ:
  Script("8")
  Return

;<=====  Vistrix  =====>

BClear:
  Loop, 12
    {
     IniWrite, %A_Space%, AOCO.ini, Bane, Bane%A_Index%
     GuiControl,, Bane%A_Index%,
    }
  Return
 
BSave:
  Gui, 7:Submit, NoHide
  Loop, 12
    {
     ThisBane := Bane%A_Index%
     IniWrite, %ThisBane%, AOCO.ini, Bane, Bane%A_Index%
    }
  Sleep, 10
  GoSub, ScriptGenerator
  NextBane = 1
  Return

ScriptGenerator:
  IfExist, %InstallDir%\scripts\9
    FileDelete, %InstallDir%\scripts\9
  IfExist, %InstallDir%\scripts\BaneList
    FileDelete, %InstallDir%\scripts\BaneList
  FileAppend,
    (
/raid <font face='HYBORIANLARGE' color='#%CallColor%'>%Bane1% is next on Bane!</font>
    ), %InstallDir%/scripts/9
  FileAppend,
    (
/raid <font face='HYBORIANLARGE' color='#%CallColor%'>Bane order list:</font> %Bane1% %Bane2% %Bane3% %Bane4% %Bane5% %Bane6% %Bane7% %Bane8% %Bane9% %Bane10% %Bane11% %Bane12%
    ), %InstallDir%/scripts/BaneList
  Return
 
Bane:
  Script("9")
  Sleep, 1000
  FileDelete, %InstallDir%/scripts/9
  NextBane++
  If NextBane = 2
    FileAppend, /raid <font face='HYBORIANLARGE' color='#%CallColor%'>%Bane2% is next on Bane!</font>, %InstallDir%/scripts/9
  If NextBane = 3
    FileAppend, /raid <font face='HYBORIANLARGE' color='#%CallColor%'>%Bane3% is next on Bane!</font>, %InstallDir%/scripts/9
  If NextBane = 4
    FileAppend, /raid <font face='HYBORIANLARGE' color='#%CallColor%'>%Bane4% is next on Bane!</font>, %InstallDir%/scripts/9
  If NextBane = 5
    FileAppend, /raid <font face='HYBORIANLARGE' color='#%CallColor%'>%Bane5% is next on Bane!</font>, %InstallDir%/scripts/9
  If NextBane = 6
    FileAppend, /raid <font face='HYBORIANLARGE' color='#%CallColor%'>%Bane6% is next on Bane!</font>, %InstallDir%/scripts/9
  If NextBane = 7
    FileAppend, /raid <font face='HYBORIANLARGE' color='#%CallColor%'>%Bane7% is next on Bane!</font>, %InstallDir%/scripts/9
  If NextBane = 8
    FileAppend, /raid <font face='HYBORIANLARGE' color='#%CallColor%'>%Bane8% is next on Bane!</font>, %InstallDir%/scripts/9
  If NextBane = 9
    FileAppend, /raid <font face='HYBORIANLARGE' color='#%CallColor%'>%Bane9% is next on Bane!</font>, %InstallDir%/scripts/9
  If NextBane = 10
    FileAppend, /raid <font face='HYBORIANLARGE' color='#%CallColor%'>%Bane10% is next on Bane!</font>, %InstallDir%/scripts/9
  If NextBane = 11
    FileAppend, /raid <font face='HYBORIANLARGE' color='#%CallColor%'>%Bane11% is next on Bane!</font>, %InstallDir%/scripts/9
  If NextBane = 12
    FileAppend, /raid <font face='HYBORIANLARGE' color='#%CallColor%'>%Bane12% is next on Bane!</font>, %InstallDir%/scripts/9
  Return
 
VKill:
  Script("vkill")
  Return

BList:
  Script("BaneList")
  Return

;<=====  Bot Interaction  =====>

BReset:
  MsgBox, 52, Restart Bot, Restart EBot?
  IfMsgBox Yes
    BotCmd("restart")
  IfMsgBox No
    Return
  Return

BOnline:
  BotCmd("online")
  Return
 
Bsm:
  BotCmd("sm")
  Return
 
BNews:
  BotCmd("news")
  Return
 
BShow:
  BotCmd("muleitem show")
  Return

BAdd:
  BotInput("muleitem add")
  Return
 
BDel:
  BotInput("muleitem del")
  Return

BItems:
  BotInput("items")
  Return
   
BAsk:
  BotCmd("trivia ask")
  Return
 
BAnswer:
  BotInput("trivia answer")
  Return
 
BGiveup:
  BotCmd("trivia giveup")
  Return
 
BGems:
  BotCmd("gems")
  Return
 
;<=====================>
;<=====  Hotkeys  =====>
;<=====================>

PgDn::            ;Hide all showing windows
  WindowList = AoC Install Browser|AoC Overlay|AoC Overlay Options|Raids|Clicky|Vistrix|Bane List|Bot Interaction
  StringSplit, WindowArray, WindowList, |
  Loop, %WindowArray0%
    {
     ThisWin := WindowArray%A_Index%
     IfWinExist, %ThisWin%
       {
        Gui, %A_Index%:Cancel
        Gui%A_Index% = 1
       }
    }
  Return

PgUp::            ;Show all windows that were showing before being hidden.
  Loop, 8
    {
     If Gui%A_Index% = 1
       {
        Gui, %A_Index%:Show
        Gui %A_Index%:+AlwaysOnTop
       }
    }
  WinActivate, Age of Conan
  Return

^PgUp::
  Reload
  Return


Installer (Downloads the latest version for first install)
Code:
#SingleInstance Force
#NoEnv
SetBatchLines -1

Gui, 1:Add, Text, x10 y10 w380 h20 +Center, Thank you for installing AOCO.
Gui, 1:Add, Button, x290 y160 w100 h30 gNext, Next
Gui, 1:Show, Center w400 h200, AOCO Installer
Return

Next:
  Gui, 1:Destroy
  Gui, 2:Add, Text, x10 y10 w380 h20 +Center, Please choose where to install AOCO.
  Gui, 2:Add, Text, x10 y40 w330 h20 vDir,
  Gui, 2:Add, Button, x340 y40 w50 h20 gBrowse, ...
  Gui, 2:Add, Button, x290 y160 w100 h30 gInstall, Install
  Gui, 2:Show, Center w400 h200, AOCO Installer
  Return
 
Browse:
  InstallDir =
  FileSelectFolder, Dir, ::{20d04fe0-3aea-1069-a2d8-08002b30309d}, 3, Select AOCO Installation Location.
  GuiControl, 2:Text, Dir, %Dir%
  Return

Install:
  Gui, 2:Submit
  UrlDownloadToFile, http://eldarguild.org/aoco/program/AOCO.exe, %Dir%\AOCO.exe
  FileCreateShortcut, %Dir%\AOCO.exe,%A_Desktop%\AoC Overlay.lnk, %Dir%, Age of Conan Overlay
  Run, %Dir%\AOCO.exe, %Dir%
  ExitApp


Updater:
Code:
#SingleInstance Force
#NoEnv
SetBatchLines -1

Gui, Add, Text, x6 y100 w388 +Center, Now updating Age of Conan Overlay. Please wait.
Gui, Font, s12 w700, MS Sans Serif
Gui, +ToolWindow
Gui, Show, Center w400 h200, AoC Overlay Updater
Process, Exist, AOCO.exe
If (ErrorLevel > 0)
  Process, Close, AOCO.exe
Sleep, 500
FileDelete, AOCO.exe
Sleep, 125
FileMove, AOCONew.exe, AOCO.exe
Sleep, 125
Run, AOCO.exe
ExitApp


The processes here could probably be cleaned up a bit and be made more reliable, but this worked very well for the period of time that I was maintaining this project.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 5th, 2009, 9:39 pm 
Offline

Joined: May 28th, 2008, 2:11 am
Posts: 739
Location: Minnesota, USA
You can control/disconnect people from files on your computer via Control Panel -> Administrative Tools -> Computer Management -> System Tools -> Shared Folders -> Sessions
(To get to Computer Management you can also run %SystemRoot%\system32\compmgmt.msc /s)

Here's a script I wrote a while ago that would alert me when anyone was looking at files on my computer using that window.
Code:
#SingleInstance, Ignore
#Persistent
DetectHiddenWindows, On
OnExit, Close
Win = Computer Management ahk_class MMCMainFrame
Show = 0

Run, %A_WinDir%\system32\compmgmt.msc
WinWait, % Win
Sleep, 10
WinGet, ID, ID, % Win
Win .= " ahk_id " ID
WinHide, % Win
GoSelection("System Tools")
GoSelection("Shared Folders")
GoSelection("Sessions")
;WinGet, Ctrl, ControlList, % Win
;Loop, Parse, Ctrl, `n
;   Control, Disable,, %A_LoopField%, % Win
;Control, Enable,, SysListView321, % Win
SetTimer, CheckSessions, 1000
CheckSessions:
   If (!Show)
      WinHide, % Win
   Else
      WinShow, % Win
   ControlGet, Lines, List, Count, SysListView321, % Win
   If (Lines > 0) {
      ControlGet, Test, List,, SysListView321, % Win
      Loop, Parse, Test, `n, `r
         Loop, Parse, A_LoopField, `t
         {
            If ((A_Index = 1 && A_LoopField <> "Administrator")
             or (A_Index = 2 && A_LoopFIeld <> "ROB-DTOP-WIN2K")
             and !Show) {
               MsgBox Alert! Unauthorized Network Connection(s)!
               WinShow, % Win
               Show = 1
            }
         }
   }
Return

Close:
   WinClose, % Win
   WinWaitClose, % Win
   ; Make sure we only get one window and one
   ; script instance running at a time... ever
   If (Reload)
      Reload
ExitApp

^F12::Show := !Show

; For some reason the control does not support
; Control, Choose   or   Control, ChooseString
; This is a workaround.
GoSelection(S) {
   Global Win, Reload
   ControlGet, Lines, List, Count, SysListView321, % Win
   Loop %Lines% {
      ControlGet, Var, List, Selected, SysListView321, % Win
      If (RegExMatch(Var, "^\Q" S "\E")) {
         ControlSend, SysListView321, {Enter}, % Win
         Found := 1
         Break
      }
      ControlSend, SysListView321, {Down}, % Win
   }
   ; Could not find search string
   If (!Found) {
      WinClose, % Win
      WinWaitClose, % Win
      Reload = 1
      ExitApp
   }
}

_________________
Unless otherwise stated, all code is untested

(\__/) This is Bunny.
(='.'=) Cut, copy, and paste bunny onto your sig.
(")_(") Help Bunny gain World Domination.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 6th, 2009, 10:09 pm 
Offline

Joined: September 28th, 2007, 3:56 am
Posts: 279
Location: New York
Well, unfortunately, when I meant server I meant it's on a drive on a server not a shared folder from my computer on the server. That is some interesting information though, I was not aware you could monitor who is accessing your shared files.

I, however, think I will be going with the idea of having the installer and updater. Rather than having users run the program from the server I will put an installer on the server and they can run the program from their computers. I already have a version checker so all I would have to do is add in the updater.

Thanks for everyone's assistance, this will definately pay off.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 10th, 2009, 4:12 pm 
Offline

Joined: November 6th, 2007, 7:24 pm
Posts: 24
I had the same problem, so I created this to close my program if they leave it open. This may or may not work for you. You just have to run it from your main program, I have this in my main program: Run \\nevada\drawings\revit\RevitTimer.exe
Which is this...

Code:
#SingleInstance force
#NoTrayIcon
#Persistent
Sleep 60000
Process Exist, Revit Local File.exe
if ErrorLevel = 0
   ExitApp
else
   Sleep 600000
   Process Close, Revit Local File.exe
ExitApp


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 9th, 2009, 5:22 pm 
There is a way to do this, I done it and my problem was the same.
For me the install option does not work since my app is runing on a Citrix so I need to kill the app for the users.

I did a easy app kill funktion in my script, it looks for a file every 2sec, if it does not exist it will self terminate. A simpel rename of the file will do it.

Code:
SetTimer, tryagain
Gui, 1:Add, Text, x10 y10 w380 h20 +Center, Just a GUI.
Gui, 1:Show, Center w400 h200, GUI Banner
tryagain:
sleep 2000
IfExist , ON.txt ;This can be a networkpath ie "X:\MyBossPornFiles\nudeSecreterypics\wifeno1.jpg
GoTo tryagain
IfNotExist ,  ON.txt ;This can be a networkpath ie "X:\MyBossPornFiles\nudeSecreterypics\wifeno1.jpg
Gui, 1:Add, Text, x10 y10 w380 h20 +Center, The program will close in 5 seconds.
Gui, 1:Show, Center w400 h200, GUI Banner
sleep 5000
ExitApp


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: September 9th, 2009, 5:38 pm 
Offline

Joined: July 6th, 2009, 9:58 pm
Posts: 678
Without reading the whole thread: I would just have it run a check every 15 minutes for the existence of a file on a UNC share, if found it returns ExitApp. Have it check on startup too (or it closes the app, to keep them from just opening it again).

Upload the check file, wait 15 minutes (or however long) and upload the new program.

Edit:

You could make it so that if the file is found, it returns RELOAD instead, that way they have the new version. Could also put a timer in, will exit in... etc...


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 9th, 2009, 8:23 pm 
Offline
User avatar

Joined: October 7th, 2006, 8:45 am
Posts: 3329
Location: Simi Valley, CA
Here's how I would approach the "non-synchronous script update" problem. Each new 'version' of the script should be saved with its version number appended to its filename. Then, in the same folder, use a launcher script to run the newest (automatically detected, of course) version. Don't worry about removing the old versions at all... in fact, it may be a good idea to keep them around in case there's something wrong with the new version.

just my ยข2.

_________________
Ternary (a ? b : c) guide     TSV Table Manipulation Library
Post code inside [code][/code] tags!


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 9th, 2009, 11:16 pm 
There is many ways to approach this, I use the version check in some of my other scrips.
in this specific case I'm restricted to a specific file name because it's on a citrix cluster witch I'm not the king over, so I can't use the version check.

This is just a another way to force the app to shoutdown so I can do the update. :)


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: September 10th, 2009, 12:22 am 
Offline
User avatar

Joined: August 30th, 2005, 8:43 pm
Posts: 8666
Location: Salem, MA
my not so elegant, but tested solution to this problem:

http://www.autohotkey.com/forum/viewtopic.php?t=18417

_________________
Image
(Common Answers) - New Tutorials Forum - Humongous FAQ


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: BrandonHotkey, hilalpro, just me, tic and 66 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group