Jump to content

Dampe

Active Members
  • Posts

    231
  • Joined

  • Last visited

Everything posted by Dampe

  1. Ah that would make sense
  2. I guess it would be possible but pretty impracticable. If you want to watch a movie at the same time, have a look at VLC Media player. Pretty sure you can right click and set window to be always on top which would allow you to do other things on the computer whilst watching a movie.. I use linux at home and quite a few linux desktop enviroments support virtual desktops, so I wanted one for work. I guess I learn the commands from years of programming and knowledge of the windows internal functions. I was originally using the autoit setwindowstate() function but it was too slow, hence using the user_32.dll function instead. Peace
  3. What? Yes it does. I fixed the script here. #include <array.au3> Local $Win_Max_Number = 4 Local $Key_Forward = "{PAUSE}" Local $Key_Backward = "{HOME}" Local $Window_Array[5][25] Local $Window_Current_Arr = 1 Local $Window_Current_Active = 1 OnAutoItExitRegister( "_Au3Exit" ) Local $Dll_User_32 = DllOpen("user32.dll") HotKeySet($Key_Forward, "_ScreenForward") HotKeySet($Key_Backward, "_ScreenBackward") _GenerateWindowArray() While 1 Sleep(50) _UpdateWindowArray() WEnd Func _GenerateWindowArray() $var = WinList() For $i = 1 To $var[0][0] If $var[$i][0] <> "" And IsVisible($var[$i][1]) Then If $var[$i][0] <> "Start" AND $var[$i][0] <> "Program Manager" Then $Window_Array[$Window_Current_Active][$Window_Current_Arr] = $var[$i][1] $Window_Current_Arr += 1 EndIf EndIf Next EndFunc ;==>_GenerateWindowArray Func _UpdateWindowArray() For $x = 1 to 4 For $i = 1 to 24 If not WinExists ($Window_Array[$x][$i]) Then $Window_Array[$x][$i] = "" $Window_Current_Arr -= 1 EndIf Next Next $var = WinList() For $i = 1 To $var[0][0] If $var[$i][0] <> "" And IsVisible($var[$i][1]) Then If $var[$i][0] <> "Start" AND $var[$i][0] <> "Program Manager" Then If _ArraySearch($Window_Array, $var[$i][1]) = -1 Then $Window_Array[$Window_Current_Active][$Window_Current_Arr] = $var[$i][1] $Window_Current_Arr += 1 EndIf EndIf EndIf Next EndFunc Func _ScreenForward() If $Window_Current_Active < $Win_Max_Number Then $Window_Current_Active += 1 ConsoleWrite ("Screen #: " & $Window_Current_Active & @CRLF) For $i = 1 to 24 If $Window_Array[$Window_Current_Active-1][$i] <> "" Then _SetWindowState($Window_Array[$Window_Current_Active-1][$i], 0) EndIf Next For $i = 1 to 24 If $Window_Array[$Window_Current_Active][$i] <> "" Then _SetWindowState($Window_Array[$Window_Current_Active][$i], 1) EndIf Next EndIf EndFunc ;==>_ScreenForward Func _ScreenBackward() If $Window_Current_Active > 1 Then $Window_Current_Active -= 1 ConsoleWrite ("Screen #: " & $Window_Current_Active & @CRLF) For $i = 1 to 24 If $Window_Array[$Window_Current_Active+1][$i] <> "" Then _SetWindowState($Window_Array[$Window_Current_Active+1][$i], 0) EndIf Next For $i = 1 to 24 If $Window_Array[$Window_Current_Active][$i] <> "" Then _SetWindowState($Window_Array[$Window_Current_Active][$i], 1) EndIf Next EndIf EndFunc ;==>_ScreenBackward Func _SetWindowState($hWnd, $sCode) DllCall($Dll_User_32, "bool", "ShowWindow", "HWND", $hWnd, "int", $sCode) EndFunc ;==>_SetWindowState Func IsVisible($handle) If BitAND(WinGetState($handle), 2) Then Return 1 Else Return 0 EndIf EndFunc ;==>IsVisible Func _Au3Exit() For $x = 1 to $Win_Max_Number For $i = 1 to 24 _SetWindowState($Window_Array[$x][$i], 1) Next Next DllClose ($Dll_User_32) EndFunc
  4. Wrote it to use at work. Change the hotkeys at the top. #include <array.au3> Local $Win_Max_Number = 4 Local $Key_Forward = "{PAUSE}" Local $Key_Backward = "{HOME}" Local $Window_Array[5][25] Local $Window_Current_Arr = 1 Local $Window_Current_Active = 1 Local $Dll_User_32 = DllOpen("user32.dll") HotKeySet($Key_Forward, "_ScreenForward") HotKeySet($Key_Backward, "_ScreenBackward") _GenerateWindowArray() While 1 Sleep(50) _UpdateWindowArray() WEnd Func _GenerateWindowArray() $var = WinList() For $i = 1 To $var[0][0] If $var[$i][0] <> "" And IsVisible($var[$i][1]) Then $Window_Array[$Window_Current_Active][$Window_Current_Arr] = $var[$i][1] $Window_Current_Arr += 1 EndIf Next EndFunc ;==>_GenerateWindowArray Func _UpdateWindowArray() For $x = 1 to 4 For $i = 1 to 24 If not WinExists ($Window_Array[$x][$i]) Then $Window_Array[$x][$i] = "" $Window_Current_Arr -= 1 EndIf Next Next $var = WinList() For $i = 1 To $var[0][0] If $var[$i][0] <> "" And IsVisible($var[$i][1]) Then If _ArraySearch($Window_Array, $var[$i][1]) = -1 Then $Window_Array[$Window_Current_Active][$Window_Current_Arr] = $var[$i][1] $Window_Current_Arr += 1 EndIf EndIf Next EndFunc Func _ScreenForward() If $Window_Current_Active < $Win_Max_Number Then $Window_Current_Active += 1 ConsoleWrite ("Screen #: " & $Window_Current_Active & @CRLF) For $i = 1 to 24 If $Window_Array[$Window_Current_Active-1][$i] <> "" Then _SetWindowState($Window_Array[$Window_Current_Active-1][$i], 0) EndIf Next For $i = 1 to 24 If $Window_Array[$Window_Current_Active][$i] <> "" Then _SetWindowState($Window_Array[$Window_Current_Active][$i], 1) EndIf Next EndIf EndFunc ;==>_ScreenForward Func _ScreenBackward() If $Window_Current_Active > 1 Then $Window_Current_Active -= 1 ConsoleWrite ("Screen #: " & $Window_Current_Active & @CRLF) For $i = 1 to 24 If $Window_Array[$Window_Current_Active+1][$i] <> "" Then _SetWindowState($Window_Array[$Window_Current_Active+1][$i], 0) EndIf Next For $i = 1 to 24 If $Window_Array[$Window_Current_Active][$i] <> "" Then _SetWindowState($Window_Array[$Window_Current_Active][$i], 1) EndIf Next EndIf EndFunc ;==>_ScreenBackward Func _SetWindowState($hWnd, $sCode) DllCall($Dll_User_32, "bool", "ShowWindow", "HWND", $hWnd, "int", $sCode) EndFunc ;==>_SetWindowState Func IsVisible($handle) If BitAND(WinGetState($handle), 2) Then Return 1 Else Return 0 EndIf EndFunc ;==>IsVisible
  5. Nevermind, resolved.
  6. Hey all, trying to automate an office 2010 install. Working fine on XP but no-go on Win7. Even though I am forcing admin execution, the script still refuses to actually launch the batch script as admin. #include <GUIConstants.au3> #NoTrayIcon #RequireAdmin #NoAutoIt3Execute $hWnd = GUICreate ("Processing..", 300, 150) $Edit = GUICtrlCreateEdit ("Webster Computers Office 2010 Auto-Installer" & @CRLF & "Starting installation process" & @CRLF, 5, 5, 290, 140) GUISetState (@SW_SHOW) $TempDir = @HomeDrive & "\" & Random (1, 99999, 1) DirCreate ($TempDir) If @error Then MsgBox (48, "Error", "Could not create directory at " & $TempDir) Exit 0 EndIf _LOG("Created temp directory at " & $TempDir) _LOG("Copying files to " & $TempDir & " please wait..") DirCopy (@ScriptDir, $TempDir, 1) _LOG("Finished cache file copy, installing Office 2010") If IsAdmin() Then $PID = Run ($TempDir & "\oemsetup.en-us.bat", $TempDir) Else While 1 $user = InputBox ("Admin-Logon", "You must be an Administrator to continue setup." & @CRlf & "Please enter your username:", "Administrator") $pass = InputBox ("Admin-Logon", "Please enter your password", "", "*") If $user <> "" AND $pass <> "" Then $PID = RunAs ($user, @ComputerName, $pass, 0, $TempDir & "\oemsetup.en-us.bat", $TempDir) If @error Then MsgBox (48, "Authentication Error", "You have entered an invalid username / password") EndIf ExitLoop EndIf WEnd EndIf While 1 If not ProcessExists ($PID) Then ExitLoop EndIf Sleep (50) WEnd Sleep (1000) _LOG("Installer Finished, removing Temp directory at " & $TempDir) DirRemove ($TempDir, 1) MsgBox (32, "Success", "Finished installing successfully") Func _LOG($string) GUICtrlSetData ($Edit, GUICtrlRead ($Edit) & $string & @CRLF) ConsoleWrite ($string & @CRLF) EndFunc
  7. Sorry, didn't mean to hard rage. Just was frustrated. Thanks, it seems assigning the value to a variable and then reading it works.
  8. First of all, I have about 150 posts more than you. Second of all, I'm not asking for help with writing a bot, I'm asking for help with a GUI Function. You have absolutely no idea what the rest of the script does. It could just be a knowledge database or something similar. And thirdly, before you go bossing people around, you should really think more before you post. You're just making yourself look stupid. If anyone doesn't want me to post this, I can re-post the same problem without battleground names for values, But I really didn't think it was necessary. Now if we could go back on topic that would be excellent.
  9. Howdy. I cannot seem to read any value from my combo box except 0. Example: $System_Drop = GUICtrlCreateCombo ("Alterac Valley", 170, 5, 145, 20) GUICtrlSetData (-1, "Arathi Basin|Warsong Gulch|Eye of the Storm", "Alterac Valley") MsgBox (32, "test", GUICtrlRead($System_Drop)) And even $System_Drop = GUICtrlCreateCombo ("Alterac Valley", 170, 5, 145, 20) GUICtrlSetData (-1, "Arathi Basin|Warsong Gulch|Eye of the Storm", "Alterac Valley") MsgBox (32, "test", _GUICtrlComboBox_GetCurSel($System_Drop)) Thanks
  10. Another program / service may be running listening on that port on your computer. Do a netstat -a or try another port
  11. Look up _FileListToArray() _ArraySearch() Easily done.
  12. I'm not blaming you for this, just suggesting what may become of it. I was more or less refering to the fact that people could use the yahoo messenger protocol to help spread their virus's. E.g. Load .exe -> steal account info from yahoo messenger -> log on to account -> send link of malicious file to all contacts.
  13. This is awesome. Although, It introduces a new level of virus's and malware to autoit.
  14. Sorry my mistake, I always get the two mixed up. Most other program I use modules for music hence my habbit of saying bassMOD.
  15. Wow that's nice! Hope all the best for the project.
  16. Anyone written a function that lists all computers on a domain / network? similar to how net view works? P.s, I'm looking for a function that uses queries to find the results, not a function that reads / dumps a cmd screen.
  17. Haha, more than happy for someone to do that!
  18. $TStart = TimerInit() ;Main Loop While 1 $Timer = TimerDiff($TStart) If $Timer >= 1000 Then MsgBox(0, "", "Time!!") EndIf Sleep(30) WEnd Considering there is a sleep(30) there, it would be impossible to get an exact value of 1000, so use >= instead of =
  19. Well, was bored and wrote a simple game using AutoIt, Bass.dll and GDIPlus. It's CPU heavy due to AutoIt's speed. Don't think an old computer would cope with this too well. It's buggy, but a proof of concept and a bit of fun. Aim: Eat fish only your size or smaller, Do this 100 times, you'll grow in size. Once you reach size 3, you can eat anything, and the game will never end. Hints: Control your fish with the mouse Your fish is always RED Blue spikey fish are bigger than green fish Things to do: Add a timer to eat 100 fish or gameover to slightly make the game harder Fix bugs Etc Some screens: Download (bin+src;Messy code ) http://sharebee.com/abeb4795 Thanks to: Everyone for all the help since my time here; BrettF - BASS.dll UDF UEZ - Your examples taught me GDIPlus
  20. Someone could go to the effort of finding a way to calculate the scores address via pointers that will run everytime on every computer xD
  21. Wow impressive design. It chews a little bit of CPU when changing column size though
  22. Hmm that's weird, here is my AdLib UDF #AutoIt3Wrapper_AU3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 #cs ;#=#INDEX#===================================================# ;# Title .........: _Adlib.au3 ;# Description ...: Enhanced Adlib functionality, enables multiple adlib instances, function parameters, limited adlibs, and adlib pausing ;# Date ..........: 6.11.08 ;# Version .......: 1.0 ;# Author ........: jennico (jennicoattminusonlinedotde) ;# Main Functions : _AdlibEnable ( "function" [, time [, count [, param]]] ) ;# _AdlibDisable ( $al_ID = 0 ) ;# _AdlibPause ( $al_ID = 0 ) ;# _AdlibResume ( $al_ID = 0 ) ;# _AdlibMainFreq ( ) ;# _AdlibFreq ( $al_ID ) ;# _AdlibFunc ( $al_ID ) ;# _AdlibID ( $func ) ;# _AdlibParams ( $al_ID ) ;# _AdlibActive ( $al_ID = 0 ) ;# Subfunctions ..: __AdlibAdd ( $al_ID [, $time] ) ;# __AdlibMain ( ) ;# __AdlibKill ( ) ;# __Euclid ( $a, $b ) ;#===========================================================# #ce #include-once #Region;--------------------------Global declarations __AdlibKill() Local $al_current, $al_count, $al_func, $al_ID, $al_next, $al_param, $al_time, $al_timer Global $al_timer = TimerInit() #EndRegion;--------------------------Global declarations #region;--------------------------Main Functions #region;--------_AdlibEnable #cs ;#=#Function#================================================# ;# Name ..........: _AdlibEnable ( "function" [, time [, count [, param]]] ) ;# Description....: Enables Multi Adlib functionality and starts a new adlib instance. ;# Parameters.....: function = The name of the adlib function to call. ;# time [optional] = frequency how often in milliseconds (> 0) to call the function. Default is 250 ms. ;# count [optional] = how many times (> 0) the function shall be call. Default is -1 (=continuous). ;# param [optional] = parameter or array of parameters passed to "function". ;# Return Value ..: Returns Adlib-ID to be used in the other functions ;# Author ........: jennico ;# Date ..........: 4.11.08 ;# Remarks .......: When using _AdlibEnable, the built-in AdlibEnable and AdlibDisable MUST not be used at the same time. ;# "function" has to be passed without parentheses. ;# When using count, the adlib instance will be stopped after count times and the Adlib_ID will be invalid. ;# To pass multiple parameters to function, pass a 1-based array. Element 0 is used internally and will be overwritten. ;# For an example on multiple arrays, refer to Function "Call" in help file. ;# A hint : If param is declared globally it can be updated dynamically. ;# To skip one parameter, use "-1". ;# Theoretical limit of Alib instances is 15,999,999. ;# Every 250 ms (or time ms) the specified "function" is called. ;# The adlib function should be kept simple as it is executed often and during this time the main script is paused. ;# Also, the time parameter should be used carefully to avoid CPU load. ;# If a previously registered function is passed, the adlib frequency will be updated and the corresponding already existing Adlib-ID will be returned. ;# Thus it is not possible to call the same function twice. ;# Important recommendation: ;# If possible, please use round (multiples of each others) time frequencies to avoid CPU load . The main calling frequency of multiple adlibs is their greatest common divisor. ;# E.g. for two adlib instances, better choose 100 and 50 (main=50) for time than 99 and 51 (main=3). ;# If you choose two primes instead, the main frequency will be 1 ms and your CPU will be locked. ;# Related........: AdlibEnable, AdlibDisable, Call, _AdlibDisable, _AdlibPause, _AdlibResume ;# Example........: yes ;#===========================================================# #ce Func _AdlibEnable($func, $time = 250, $count = -1, $param = "") If $time <= 0 Then $time = 250 If $count = 0 Then $count = -1 For $al_ID = 1 To $al_func[0] If $al_func[$al_ID] = $func Then ExitLoop Next If $al_ID > $al_func[0] Then ReDim $al_func[$al_ID + 1], $al_time[$al_ID + 1], $al_current[$al_ID + 1], _ $al_next[$al_ID + 1], $al_param[$al_ID + 1], $al_count[$al_ID + 1] If IsArray($param) Then $param[0] = "CallArgArray" $al_func[0] = $al_ID $al_func[$al_ID] = $func EndIf $al_count[$al_ID] = $count $al_param[$al_ID] = $param $al_current[$al_ID] = $time __AdlibAdd($al_ID, $time) Return $al_ID EndFunc ;==>_AdlibEnable #EndRegion;--------_AdlibEnable #region;--------_AdlibDisable #cs ;#=#Function#================================================# ;# Name ..........: _AdlibDisable ( $al_ID = 0 ) ;# Description....: Stops specified adlib instance or disables entire adlib functionality. ;# Parameters.....: $al_ID [optional] = The Adlib-ID returned by a previous _AdlibEnable call. ;# If omitted or 0, all instances will be stopped and adlib functionality disabled. ;# Return Value ..: Success: Returns 1 ;# Failure: Returns 0 if Adlib-ID is not valid (<0, not defined or stopped before). ;# Author ........: jennico ;# Date ..........: 4.11.08 ;# Remarks .......: NOT the same as AdlibDisable, do not use it when you use (Multi) _Adlib ! ;# Instead of the Adlib-ID, the function name can be passed as an argument, if the name is not valid, 0 will be the return value. ;# When passing the Adlib-ID, make sure that it is a number ! ;# Related........: AdlibEnable, AdlibDisable, Call, _AdlibEnable, _AdlibPause, _AdlibResume ;# Example........: yes ;#===========================================================# #ce Func _AdlibDisable($al_ID = 0);noch fehler in count ! If IsInt($al_ID) = 0 Then $al_ID = _AdlibID($al_ID) If $al_ID = 0 Then Return 0 EndIf If $al_ID > $al_func[0] Or $al_ID < 0 Then Return 0 If $al_ID = 0 Then __AdlibKill() Return 1 EndIf $al_next[$al_ID] = 0 $al_count[$al_ID] = 0 $al_current[$al_ID] = 0 $al_param[$al_ID] = "" $al_func[$al_ID] = "" __AdlibAdd($al_ID, 0) Return 1 EndFunc ;==>_AdlibDisable #EndRegion;--------_AdlibDisable #region;--------_AdlibPause #cs ;#=#Function#================================================# ;# Name ..........: _AdlibPause ( $al_ID = 0 ) ;# Description....: Pauses specified or all adlib instance(s). ;# Parameters.....: $al_ID = The Adlib-ID returned by a previous _AdlibEnable call. ;# Return Value ..: Success: Returns 1 ;# Failure: Returns 0 if Adlib-ID is not valid (<0, not defined or stopped before). ;# Author ........: jennico ;# Date ..........: 4.11.08 ;# Remarks .......: If $al_ID omitted or 0, all instances will be paused. ;# Main frequency will not be updated on _AdlibPause. ;# Instead of the Adlib-ID, the function name can be passed as an argument. ;# Related........: AdlibEnable, AdlibDisable, Call, _AdlibEnable, _AdlibDisable, _AdlibResume, _AdlibActive ;# Example........: yes ;#===========================================================# #ce Func _AdlibPause($al_ID) If IsInt($al_ID) = 0 Then $al_ID = _AdlibID($al_ID) If $al_ID > $al_func[0] Or $al_ID < 0 Then Return 0 If $al_ID = 0 Then For $i = 1 To $al_func[0] $al_current[$i] = 0 Next Return 1 EndIf $al_current[$al_ID] = 0 Return 1 EndFunc ;==>_AdlibPause #EndRegion;--------_AdlibPause #region;--------_AdlibResume #cs ;#=#Function#================================================# ;# Name ..........: _AdlibResume ( $al_ID = 0 ) ;# Description....: Resumes specified or all (paused) adlib instance(s). ;# Parameters.....: $al_ID = The Adlib-ID returned by a previous _AdlibEnable call. ;# Return Value ..: Success: Returns 1 ;# Failure: Returns 0 if Adlib-ID is not valid (<0, not defined or stopped before). ;# Author ........: jennico ;# Date ..........: 4.11.08 ;# Remarks .......: If $al_ID omitted or 0, all instances will be resumed. ;# Instead of the Adlib-ID, the function name can be passed as an argument. ;# Related........: AdlibEnable, AdlibDisable, Call, _AdlibEnable, _AdlibDisable, _AdlibPause ;# Example........: yes ;#===========================================================# #ce Func _AdlibResume($al_ID = 0) If IsInt($al_ID) = 0 Then $al_ID = _AdlibID($al_ID) If $al_ID > $al_func[0] Or $al_ID < 0 Then Return 0 If $al_ID = 0 Then For $i = 1 To $al_func[0] $al_current[$i] = $al_time[$i] $al_next[$i] = TimerDiff($al_timer) + $al_time[$i] - _ Mod(TimerDiff($al_timer), $al_time[$i]) Next Return 1 EndIf $al_current[$al_ID] = $al_time[$al_ID] $al_next[$al_ID] = TimerDiff($al_timer) + $al_time[$al_ID] - _ Mod(TimerDiff($al_timer), $al_time[$al_ID]) Return 1 EndFunc ;==>_AdlibResume #EndRegion;--------_AdlibResume #region;--------_AdlibMainFreq #cs ;#=#Function#================================================# ;# Name ..........: _AdlibMainFreq ( ) ;# Description....: Returns the current main (overall) adlib frequency. ;# Parameters.....: none ;# Return Value ..: Success: the current main (overall) adlib frequency in ms. Minimum is 1. ;# Failure: Returns 0 if Multi adlib functionality is disabled. ;# Author ........: jennico ;# Date ..........: 4.11.08 ;# Remarks .......: Designed to observe and prevent CPU load. Highest possible load is on 1. ;# Related........: AdlibEnable, AdlibDisable, Call, _AdlibEnable, _AdlibDisable, _AdlibPause, _AdlibResume, _AdlibFreq, _AdlibFunc, _AdlibParams, _AdlibActive ;# Example........: yes ;#===========================================================# #ce Func _AdlibMainFreq() If $al_func[0] = 0 Then Return 0 Local $t For $i = 1 To $al_func[0] If $al_func[$i] Then $t = $al_time[$i] For $al_ID = $i + 1 To $al_func[0] If $al_current[$al_ID] Then $t = __Euclid($t, $al_time[$al_ID]) Next Return $t EndIf Next __AdlibKill() EndFunc ;==>_AdlibMainFreq #EndRegion;--------_AdlibMainFreq #region;--------_AdlibPause #cs ;#=#Function#================================================# ;# Name ..........: _AdlibFreq ( $al_ID ) ;# Description....: Returns the specified adlib frequency. ;# Parameters.....: $al_ID = The Adlib-ID returned by a previous _AdlibEnable call. ;# Return Value ..: Success: Returns the specified adlib frequency in ms. ;# Failure: Returns 0 if Adlib-ID is not valid (0, not defined or stopped before). ;# Author ........: jennico ;# Date ..........: 4.11.08 ;# Remarks .......: Instead of the Adlib-ID, the function name can be passed as an argument. ;# Related........: AdlibEnable, AdlibDisable, Call, _AdlibEnable, _AdlibDisable, _AdlibPause, _AdlibResume, _AdlibMainFreq, _AdlibFunc, _AdlibID, _AdlibParams, _AdlibActive ;# Example........: yes ;#===========================================================# #ce Func _AdlibFreq($al_ID) If IsInt($al_ID) = 0 Then $al_ID = _AdlibID($al_ID) If $al_ID > $al_func[0] Then Return 0 Return $al_time[$al_ID] EndFunc ;==>_AdlibFreq #EndRegion;--------_AdlibFreq #region;--------_AdlibFunc #cs ;#=#Function#================================================# ;# Name ..........: _AdlibFunc ( $al_ID ) ;# Description....: Returns the specified adlib function name. ;# Parameters.....: $al_ID = The Adlib-ID returned by a previous _AdlibEnable call. ;# Return Value ..: Success: Returns the specified adlib function name. ;# Failure: Returns "" (blank string) if Adlib-ID is not valid (not defined or stopped before). ;# Author ........: jennico ;# Date ..........: 4.11.08 ;# Remarks .......: If Sal_ID = 0 then the number of _Adlib instances (incl. stopped and paused) is returned. ;# Related........: AdlibEnable, AdlibDisable, Call, _AdlibEnable, _AdlibDisable, _AdlibPause, _AdlibResume, _AdlibMainFreq, _AdlibFreq, _AdlibID, _AdlibParams, _AdlibActive ;# Example........: yes ;#===========================================================# #ce Func _AdlibFunc($al_ID) If $al_ID > $al_func[0] Then Return "" Return $al_func[$al_ID] EndFunc ;==>_AdlibFunc #EndRegion;--------_AdlibFunc #region;--------_AdlibID #cs ;#=#Function#================================================# ;# Name ..........: _AdlibID ( $func ) ;# Description....: Returns the Adlib-ID specified by passed function name. ;# Parameters.....: $func = The function name registered in a previous _AdlibEnable call. ;# Return Value ..: Success: Returns the Adlib-ID. ;# Failure: Returns 0 if specified function is not registered in previous _AdlibEnable call. ;# Author ........: jennico ;# Date ..........: 4.11.08 ;# Remarks .......: none ;# Related........: AdlibEnable, AdlibDisable, Call, _AdlibEnable, _AdlibDisable, _AdlibPause, _AdlibResume, _AdlibMainFreq, _AdlibFreq, _AdlibFunc, _AdlibParams, _AdlibActive ;# Example........: yes ;#===========================================================# #ce Func _AdlibID($func) For $al_ID = 1 To $al_func[0] If $al_func[$al_ID] = $func Then Return $al_ID Next EndFunc ;==>_AdlibID #EndRegion;--------_AdlibID #region;--------_AdlibParams #cs ;#=#Function#================================================# ;# Name ..........: _AdlibParams ( $al_ID ) ;# Description....: Returns an array of parameters and stats of the specified Adlib-ID. ;# Parameters.....: $al_ID = The Adlib-ID returned by a previous _AdlibEnable call. ;# Return Value ..: Success: Returns a 0 based 6 element array. ;# Failure: Returns "" (blank string) if Adlib-ID is not valid (not defined or = 0). ;# Author ........: jennico ;# Date ..........: 5.11.08 ;# Remarks .......: The returned array contains: ;# Array[0] = (More or less) proper function name incl. parenthesis and parameters (if given and not an array). ;# Array[1] = current instance Status: 1 for active, 0 for stopped, 2 for paused. ;# Array[2] = the corresponding function name ("" (blank) if instance is stopped). ;# Array[3] = the corresponding frequency (0 if instance is stopped). ;# Array[4] = (> 0) amount of times the corresponding function has been called. ;# (< 0) If count was specified, element contains the count left. ;# (= 0) Instance has been stopped. ;# Array[5] = corresponding function parameters (can be an array itself) ("" (blank) if instance is stopped). ;# Related........: AdlibEnable, AdlibDisable, Call, _AdlibEnable, _AdlibDisable, _AdlibPause, _AdlibResume, _AdlibMainFreq, _AdlibFreq, _AdlibFunc, _AdlibID, _AdlibActive ;# Example........: yes ;#===========================================================# #ce Func _AdlibParams($al_ID) If $al_ID > $al_func[0] Or $al_ID = 0 Then Return "" Local $ret[6] $ret[1] = 1 If $al_func[$al_ID] = "" Then $ret[1] = 0 If $al_current[$al_ID] = 0 Then $ret[1] = 2 $ret[2] = $al_func[$al_ID] $ret[3] = $al_time[$al_ID] $ret[4] = $al_count[$al_ID] * - 1 If $ret[4] < 0 Then $ret[3] += 1 If $al_func[$al_ID] = "" Then $ret[4] = 0 $ret[5] = $al_param[$al_ID] $ret[0] = $ret[2] & "(" & $ret[3] & "," & $ret[4] & "," & $ret[5] & ")" Return $ret EndFunc ;==>_AdlibParams #EndRegion;--------_AdlibParams #region;--------_AdlibActive #cs ;#=#Function#================================================# ;# Name ..........: _AdlibActive ( $al_ID = 0 ) ;# Description....: Checks if _Adlib instance is active / paused. Or: Retrieves all active _Adlib instances. ;# Parameters.....: $al_ID [optional] = The Adlib-ID returned by a previous _AdlibEnable call. ;# Return Value ..: Success: Returns 1 if instance is active, 0 if stopped, and 2 if paused. ;# If parameter omitted or = 0 : Returns a 0 based array containing all active _Adlib instances. ;# Failure: Returns -1 and sets @error to 1 if Adlib-ID is not valid. ;# Author ........: jennico ;# Date ..........: 4.11.08 ;# Remarks .......: If parameter omitted or = 0 : ;# Array[0] contains total numbers, elements 1 - Array[0] the active Adlib_IDs. ;# @extended contains the number of paused _Adlib instances. Paused instances are active, too. ;# Related........: AdlibEnable, AdlibDisable, Call, _AdlibEnable, _AdlibDisable, _AdlibPause, _AdlibResume, _AdlibMainFreq, _AdlibFreq, _AdlibFunc, _AdlibParams, _AdlibParams ;# Example........: yes ;#===========================================================# #ce Func _AdlibActive($al_ID = 0) If $al_ID > $al_func[0] Then Return SetError(1, 0, -1) If $al_ID Then Local $ret = 0 If $al_func[$al_ID] Then $ret = 1 If $al_current[$al_ID] = 0 Then $ret = 2 EndIf Return $ret EndIf Local $ret1 = "", $ret2 = 0 For $al_ID = 1 To $al_func[0] If $al_func[$al_ID] Then $ret1 &= $al_ID & "*" If $al_current[$al_ID] = 0 Then $ret2 += 1 EndIf Next Return SetExtended($ret2, StringSplit(StringTrimRight($ret1, 1), "*")) EndFunc ;==>_AdlibActive #EndRegion;--------_AdlibActive #EndRegion;--------------------------Main Functions #Region;--------------------------Internal Functions #cs ;#=#Function#================================================# ;# Name ..........: __AdlibAdd ( $al_ID [, $time] ) ;# Author ........: jennico ;# Date ..........: 4.11.08 ;# Remarks .......: internal use only ;# Example........: no ;#===========================================================# #ce Func __AdlibAdd($al_ID, $time) $al_time[$al_ID] = $time Local $t = _AdlibMainFreq() If $t = 0 Then Return If $time Then $al_next[$al_ID] = TimerDiff($al_timer) + $time AdlibEnable("__AdlibMain", $t) EndFunc ;==>__AdlibAdd #cs ;#=#Function#================================================# ;# Name ..........: __AdlibMain ( ) ;# Author ........: jennico ;# Date ..........: 4.11.08 ;# Remarks .......: internal use only ;# Example........: no ;#===========================================================# #ce Func __AdlibMain() For $al_ID = 1 To $al_func[0] If $al_current[$al_ID] And TimerDiff($al_timer) >= $al_next[$al_ID] Then If $al_param[$al_ID] Then Call($al_func[$al_ID], $al_param[$al_ID]) Else Call($al_func[$al_ID]) EndIf $al_count[$al_ID] -= 1 $al_next[$al_ID] += $al_time[$al_ID] If $al_count[$al_ID] = 0 Then _AdlibDisable($al_ID) EndIf Next EndFunc ;==>__AdlibMain #cs ;#=#Function#================================================# ;# Name ..........: __AdlibKill ( ) ;# Author ........: jennico ;# Date ..........: 4.11.08 ;# Remarks .......: internal use only ;# Example........: no ;#===========================================================# #ce Func __AdlibKill() Global $al_func[1] = [0], $al_time[1] = [0], $al_current[1] = [0], _ $al_next[1] = [0], $al_param[1] = [0], $al_count[1] = [0] EndFunc ;==>__AdlibKill #cs ;#=#Function#================================================# ;# Name ..........: __Euclid ( $a, $b ) ;# Description....: Calculates the Greatest Common Divisor ;# Parameters.....: $a = 1st Integer ;# $b = 2nd Integer ;# Return Value ..: Returns GCD ;# Author ........: jennico ;# Date ..........: 4.11.08 ;# Remarks .......: internal use only ;# taken from _Primes.au3 ;# Example........: no ;#===========================================================# #ce Func __Euclid($a, $b) If $b = 0 Then Return $a Return __Euclid($b, Mod($a, $b)) EndFunc ;==>__Euclid #EndRegion;--------------------------Internal Functions Im running non-beta 3.3.0.0
  23. Well, there are many ways it can be done. A few possible ways could be: Program reads a .txt file from a webserver which contains the version and a download url for the new one, Program connects to a server, sends a version check message, the server sends the new version back and download url Program has set dates of release for the update, so it won't trigger until the computers clock is at the date or later. Internet server ways are usually best to do.
  24. Updated again. Added total bytes received and sent.. Would really appreciate some feedback
×
×
  • Create New...