Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 05/11/2015 in all areas

  1. Melba23

    Fibonacci Clock

    The Fibonacci clock lets you know the time by changing colours and requiring you do some adding up. The Fibonacci sequence is the sequence beginning 1, 1 and where each number is the sum of the previous two. Its first five digits are: 1, 1, 2, 3, 5. These numbers are all you need to express all the numbers from 1 to 12. 1 = 1 1+1 = 2 ... 1 + 1 + 2 + 3 + 5 = 12 which means that it is possible to use them to describe the twelve positions on a clock, and therefore tell the time in 5 minute intervals. Philippe Chrétien of Montreal Canada made such a clock with squares of side length 1, 1, 2, 3, and 5 (the numbers in the Fibonacci sequence) arranged into a "golden rectangle". The squares lit up in red tell you the hour, and in green give you the minutes (in multiples of five). A square lit up in blue meant it is to be added for both hour and minute. Transparent squares are ignored. The first example below decodes as follows: Hours, red 5, red 1 and blue 3 = 5 + 1 + 3 = 9 hours Minutes: green 2 and blue 3 = 2 + 3 = 5. 5 x 5 = 25 minutes. So, the time is 9.25. And here is a little script to show how you can create a Fibonacci clock of your own - by default it shows the current time (which you can reset at any time using the "Reset" button) or you can test it by entering a time in the combos: #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> #include <Date.au3> $iMargin_X = 10 $iMargin_Y = 10 $iMargin_Inter = 5 $iSize = 50 $iButton_Level = ($iSize * 5) + $iMargin_Inter + 20 $hGUI = GUICreate("Fibonacci Clock", ($iSize * 8) + ($iMargin_X * 2), $iButton_Level + 100) GUISetBkColor(0xC4C4C4) $cBack = GUICtrlCreateLabel("", $iMargin_X - $iMargin_Inter, $iMargin_Y - $iMargin_Inter, _ ($iSize * 8) + ($iMargin_Inter * 2), ($iSize * 5) + $iMargin_Inter) GUICtrlSetBkColor($cBack, 0x000000) $cLabel_1A = GUICtrlCreateLabel("", $iMargin_X + ($iSize * 2), $iMargin_Y, $iSize - $iMargin_Inter, $iSize - $iMargin_Inter) $cLabel_1B = GUICtrlCreateLabel("", $iMargin_X + ($iSize * 2), $iMargin_Y + $iSize, $iSize - $iMargin_Inter, $iSize - $iMargin_Inter) $cLabel_2 = GUICtrlCreateLabel("", $iMargin_X, $iMargin_Y, ($iSize * 2) - $iMargin_Inter, ($iSize * 2) - $iMargin_Inter) $cLabel_3 = GUICtrlCreateLabel("", $iMargin_X, $iMargin_Y + ($iSize * 2), ($iSize * 3) - $iMargin_Inter, ($iSize * 3) - $iMargin_Inter) $cLabel_5 = GUICtrlCreateLabel("", $iMargin_X + ($iSize * 3), $iMargin_Y, $iSize * 5, ($iSize * 5) - $iMargin_Inter) $cUserSet = GUICtrlCreateButton("Set User Time", $iMargin_X, $iButton_Level, 100, 30) $cUserHour = GUICtrlCreateCombo("", $iMargin_X + 120, $iButton_Level, 40, 20) GUICtrlSetData($cUserHour, "00|01|02|03|04|05|06|07|08|09|10|11|12") $cUserMin = GUICtrlCreateCombo("", $iMargin_X + 160, $iButton_Level, 40, 20) GUICtrlSetData($cUserMin, "00|05|10|15|20|25|30|35|40|45|50|55") $cReset = GUICtrlCreateButton("Reset Current Time", $iMargin_X, $iButton_Level + 50, 120, 30) GUICtrlCreateLabel("Hours:" & @CRLF & @CRLF & "Mins:" & @CRLF & @CRLF & "Both:", 250, $iButton_Level, 150, 80) GUICtrlCreateLabel("", 300, $iButton_Level, 50, 20) GUICtrlSetBkColor(-1, 0xFF0000) GUICtrlCreateLabel("", 300, $iButton_Level + 25, 50, 20) GUICtrlSetBkColor(-1, 0x00FF00) GUICtrlCreateLabel("", 300, $iButton_Level + 50, 50, 20) GUICtrlSetBkColor(-1, 0x0000FF) GUISetState() _Reset() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $cReset _Reset() Case $cUserSet $iHour = GUICtrlRead($cUserHour) $iMin = GUICtrlRead($cUserMin) / 5 _Set_Clock($iHour, $iMin) EndSwitch WEnd Func _Reset() $sDTG = _NowCalc() $iHour = StringRegExpReplace($sDTG, "^.*\s(\d\d):.*", "$1") $iHour = (($iHour > 12) ? ($iHour - 12) : ($iHour)) $iMin = Int(StringRegExpReplace($sDTG, "^.*:(\d\d):.*", "$1") / 5) _Set_Clock($iHour, $iMin) EndFunc ;==>_Reset Func _Set_Clock($iH, $iM) $iH = Number($iH) $iM = Number($iM) ;ConsoleWrite("Entry: " & $iH & " - " & $iM & @CRLF) GUICtrlSetBkColor($cLabel_1A, 0xC4C4C4) GUICtrlSetBkColor($cLabel_1B, 0xC4C4C4) GUICtrlSetBkColor($cLabel_2, 0xC4C4C4) GUICtrlSetBkColor($cLabel_3, 0xC4C4C4) GUICtrlSetBkColor($cLabel_5, 0xC4C4C4) $iState_1A = 0 $iState_1B = 0 $iState_2 = 0 $iState_3 = 0 $iState_5 = 0 While $iH ;ConsoleWrite($iH & @CRLF) Switch $iH Case 5 To 12 ;;ConsoleWrite("5-12" & @CRLF) If Not $iState_5 Then ;;ConsoleWrite("- 5" & @CRLF) $iH -= 5 GUICtrlSetBkColor($cLabel_5, 0XFF0000) $iState_5 = 1 Else ContinueCase EndIf Case 3 To 12 ;;ConsoleWrite("3-12" & @CRLF) If Not $iState_3 Then ;;ConsoleWrite("- 3" & @CRLF) $iH -= 3 GUICtrlSetBkColor($cLabel_3, 0XFF0000) $iState_3 = 1 Else ContinueCase EndIf Case 2 To 12 ;;ConsoleWrite("2-12" & @CRLF) If Not $iState_2 Then ;;ConsoleWrite("- 2" & @CRLF) $iH -= 2 GUICtrlSetBkColor($cLabel_2, 0XFF0000) $iState_2 = 1 Else ContinueCase EndIf Case Else ;;ConsoleWrite("Else" & @CRLF) If $iState_1A Then ;;ConsoleWrite("- 1B" & @CRLF) $iH -= 1 GUICtrlSetBkColor($cLabel_1B, 0XFF0000) $iState_1B = 1 Else ;;ConsoleWrite("- 1A" & @CRLF) $iH -= 1 GUICtrlSetBkColor($cLabel_1A, 0XFF0000) $iState_1A = 1 EndIf EndSwitch WEnd While $iM Switch $iM Case 5 To 12 $bContinueCase = False ;ConsoleWrite("5-12" & @CRLF) Switch $iState_5 Case 0 ;ConsoleWrite("-5:G" & @CRLF) $iM -= 5 GUICtrlSetBkColor($cLabel_5, 0X00FF00) $iState_5 = 2 Case 1 ;ConsoleWrite("-5:B" & @CRLF) $iM -= 5 GUICtrlSetBkColor($cLabel_5, 0X0000FF) $iState_5 = 2 Case 2 $bContinueCase = True EndSwitch If $bContinueCase Then ContinueCase Case 3 To 12 ;ConsoleWrite("3-12" & @CRLF) $bContinueCase = False Switch $iState_3 Case 0 ;ConsoleWrite("-3:G" & @CRLF) $iM -= 3 GUICtrlSetBkColor($cLabel_3, 0X00FF00) $iState_3 = 2 Case 1 ;ConsoleWrite("-3:B" & @CRLF) $iM -= 3 GUICtrlSetBkColor($cLabel_3, 0X0000FF) $iState_3 = 2 Case 2 $bContinueCase = True EndSwitch If $bContinueCase Then ContinueCase Case 2 To 12 ;ConsoleWrite("2-12" & @CRLF) $bContinueCase = False Switch $iState_2 Case 0 ;ConsoleWrite("-2:G" & @CRLF) $iM -= 2 GUICtrlSetBkColor($cLabel_2, 0X00FF00) $iState_2 = 2 Case 1 ;ConsoleWrite("-2:B" & @CRLF) $iM -= 2 GUICtrlSetBkColor($cLabel_2, 0X0000FF) $iState_2 = 2 Case 2 $bContinueCase = True EndSwitch If $bContinueCase Then ContinueCase Case Else Switch $iState_1A Case 2 $iM -= 1 If $iState_1B Then ;ConsoleWrite("-1B:B" & @CRLF) GUICtrlSetBkColor($cLabel_1B, 0X0000FF) Else ;ConsoleWrite("-1B:G" & @CRLF) GUICtrlSetBkColor($cLabel_1B, 0X00FF00) EndIf Case 1 ;ConsoleWrite("-1A:B" & @CRLF) $iM -= 1 If $iState_1B = 0 Then GUICtrlSetBkColor($cLabel_1B, 0x00FF00) $iState_1B = 1 Else GUICtrlSetBkColor($cLabel_1A, 0x0000FF) $iState_1A = 2 EndIf Case Else ;ConsoleWrite("-1A:G" & @CRLF) $iM -= 1 GUICtrlSetBkColor($cLabel_1A, 0x00FF00) $iState_1A = 1 EndSwitch EndSwitch WEnd EndFunc ;==>_Set_ClockIf anyone can produce shorter internal code to colour the labels, please do post it - I found that quite a difficult problem to crack and I am certain I do not have an optimal solution. M23 P.S. The original clock:
    2 points
  2. Jon

    Forum Upgrade Status

    I've got an implementation of the code collapse/expand/popup buttons working. This was the main thing missing from the new forum in my mind. ; ; Checks the documentation for various errors #Region Includes #include "include\OutputLib.au3" #EndRegion Includes #Region Global Variables #EndRegion Global Variables #Region Main body of code Global $g_nExitCode = Main() Exit $g_nExitCode #EndRegion Main body of code #Region Main() ; =================================================================== ; Main() ; ; The main program body. ; Parameters: ; None. ; Returns: ; None. ; =================================================================== Func Main() Local $nReturn = 0 ; Create the output window and initial message. _OutputWindowCreate() _OutputProgressWrite("==== Output for " & StringTrimRight(@ScriptName, StringLen(".exe")) & " (Help Check) ====" & @CRLF) _OutputProgressWrite("Checking... ") ; The path to the Help Check directory. Local Const $sPath = @ScriptDir & "\include\Help Check" ; The path to the Help Check script. Local Const $sScript = $sPath & "\Help File Check.au3" ; Build the full command to execute. Local Const $sCmd = '"' & @AutoItExe & '" /AutoIt3ExecuteScript "' & $sScript & '"' ; Run the script. $nReturn = _RunWaitForwardOutput("_OutputBuildWrite", $sCmd, $sPath) ; Check the return value. If $nReturn Then _OutputProgressWrite("failed (" & $nReturn & ")." & @CRLF) Else _OutputProgressWrite("complete." & @CRLF) EndIf ; Write closing message and wait for close (if applicable). _OutputProgressWrite("Finished." & @CRLF & @CRLF) ; Two CRLF's in case of chained output. _OutputWaitClosed($nReturn) ; Return the value. Return $nReturn EndFunc ;==>Main #EndRegion Main()
    2 points
  3. This is a question which gets asked quite a bit >> How to add my program to the Startup Folder? Or How can I make my program run when the PC starts? So for those who want to call a simple Function e.g. _StartupFolder_Install() this UDF is for you. UDF: #include-once ; #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w 7 ; #INDEX# ======================================================================================================================= ; Title .........: _Startup ; AutoIt Version : v3.3.10.0 or higher ; Language ......: English ; Description ...: Create startup entries in the startup folder or registry. The registry entries can be Run all the time (Run registry entry) or only once (RunOnce registry entry.) ; Note ..........: ; Author(s) .....: guinness ; Remarks .......: Special thanks to KaFu for EnumRegKeys2Array() which I used as inspiration for enumerating the Registry Keys. ; =============================================================================================================================== ; #INCLUDES# ==================================================================================================================== #include <StringConstants.au3> ; #GLOBAL VARIABLES# ============================================================================================================ Global Enum $STARTUP_RUN = 0, $STARTUP_RUNONCE, $STARTUP_RUNONCEEX ; #CURRENT# ===================================================================================================================== ; _StartupFolder_Exists: Checks if an entry exits in the 'All Users/Current Users' startup folder. ; _StartupFolder_Install: Creates an entry in the 'All Users/Current Users' startup folder. ; _StartupFolder_Uninstall: Deletes an entry in the 'All Users/Current Users' startup folder. ; _StartupRegistry_Exists: Checks if an entry exits in the 'All Users/Current Users' registry. ; _StartupRegistry_Install: Creates an entry in the 'All Users/Current Users' registry. ; _StartupRegistry_Uninstall: Deletes the entry in the 'All Users/Current Users' registry. ; =============================================================================================================================== ; #INTERNAL_USE_ONLY#============================================================================================================ ; See below. ; =============================================================================================================================== ; #FUNCTION# ==================================================================================================================== ; Name ..........: _StartupFolder_Exists ; Description ...: Checks if an entry exits in the 'All Users/Current Users' startup folder. ; Syntax ........: _StartupFolder_Exists([$sName = @ScriptName[, $bAllUsers = False]]) ; Parameters ....: $sName - [optional] Name of the program. Default is @ScriptName. ; $bAllUsers - [optional] Add to Current Users (False) or All Users (True) Default is False. ; Return values .: Success - True ; Failure - False ; Author ........: guinness ; Example .......: Yes ; =============================================================================================================================== Func _StartupFolder_Exists($sName = @ScriptName, $bAllUsers = False) Local $sFilePath = Default __Startup_Format($sName, $sFilePath) Return FileExists(__StartupFolder_Location($bAllUsers) & '\' & $sName & '.lnk') EndFunc ;==>_StartupFolder_Exists ; #FUNCTION# ==================================================================================================================== ; Name ..........: _StartupFolder_Install ; Description ...: Creates an entry in the 'All Users/Current Users' startup folder. ; Syntax ........: _StartupFolder_Install([$sName = @ScriptName[, $sFilePath = @ScriptFullPath[, $sCommandline = ''[, ; $bAllUsers = False]]]]) ; Parameters ....: $sName - [optional] Name of the program. Default is @ScriptName. ; $sFilePath - [optional] Location of the program executable. Default is @ScriptFullPath. ; $sCommandline - [optional] Commandline arguments to be passed to the application. Default is ''. ; $bAllUsers - [optional] Add to Current Users (False) or All Users (True) Default is False. ; Return values .: Success - True ; Failure - False & sets @error to non-zero ; Author ........: guinness ; Example .......: Yes ; =============================================================================================================================== Func _StartupFolder_Install($sName = @ScriptName, $sFilePath = @ScriptFullPath, $sCommandline = '', $bAllUsers = False) Return __StartupFolder_Uninstall(True, $sName, $sFilePath, $sCommandline, $bAllUsers) EndFunc ;==>_StartupFolder_Install ; #FUNCTION# ==================================================================================================================== ; Name ..........: _StartupFolder_Uninstall ; Description ...: Deletes an entry in the 'All Users/Current Users' startup folder. ; Syntax ........: _StartupFolder_Uninstall([$sName = @ScriptName[, $sFilePath = @ScriptFullPath[, $bAllUsers = False]]]) ; Parameters ....: $sName - [optional] Name of the program. Default is @ScriptName. ; $sFilePath - [optional] Location of the program executable. Default is @ScriptFullPath. ; $bAllUsers - [optional] Was it added to Current Users (False) or All Users (True) Default is False. ; Return values .: Success - True ; Failure - False & sets @error to non-zero ; Author ........: guinness ; Example .......: Yes ; =============================================================================================================================== Func _StartupFolder_Uninstall($sName = @ScriptName, $sFilePath = @ScriptFullPath, $bAllUsers = False) Return __StartupFolder_Uninstall(False, $sName, $sFilePath, Default, $bAllUsers) EndFunc ;==>_StartupFolder_Uninstall ; #FUNCTION# ==================================================================================================================== ; Name ..........: _StartupRegistry_Exists ; Description ...:Checks if an entry exits in the 'All Users/Current Users' registry. ; Syntax ........: _StartupRegistry_Exists([$sName = @ScriptName[, $bAllUsers = False[, $iRunOnce = $STARTUP_RUN]]]) ; Parameters ....: $sName - [optional] Name of the program. Default is @ScriptName. ; $bAllUsers - [optional] Add to Current Users (False) or All Users (True) Default is False. ; $iRunOnce - [optional] Always run at system startup $STARTUP_RUN (0), run only once before explorer is started $STARTUP_RUNONCE (1) ; or run only once after explorer is started $STARTUP_RUNONCEEX (2). Default is $STARTUP_RUN (0). ; Return values .: Success - True ; Failure - False ; Author ........: guinness ; Example .......: Yes ; =============================================================================================================================== Func _StartupRegistry_Exists($sName = @ScriptName, $bAllUsers = False, $iRunOnce = $STARTUP_RUN) Local $sFilePath = Default __Startup_Format($sName, $sFilePath) RegRead(__StartupRegistry_Location($bAllUsers, $iRunOnce) & '\', $sName) Return @error = 0 EndFunc ;==>_StartupRegistry_Exists ; #FUNCTION# ==================================================================================================================== ; Name ..........: _StartupRegistry_Install ; Description ...: Creates an entry in the 'All Users/Current Users' registry. ; Syntax ........: _StartupRegistry_Install([$sName = @ScriptName[, $sFilePath = @ScriptFullPath[, $sCommandline = ''[, ; $bAllUsers = False[, $iRunOnce = $STARTUP_RUN]]]]]) ; Parameters ....: $sName - [optional] Name of the program. Default is @ScriptName. ; $sFilePath - [optional] Location of the program executable. Default is @ScriptFullPath. ; $sCommandline - [optional] Commandline arguments to be passed to the application. Default is ''. ; $bAllUsers - [optional] Add to Current Users (False) or All Users (True) Default is False. ; $iRunOnce - [optional] Always run at system startup $STARTUP_RUN (0), run only once before explorer is started $STARTUP_RUNONCE (1) ; or run only once after explorer is started $STARTUP_RUNONCEEX (2). Default is $STARTUP_RUN (0). ; Return values .: Success - True ; Failure - False & sets @error to non-zero ; Author ........: guinness ; Example .......: Yes ; =============================================================================================================================== Func _StartupRegistry_Install($sName = @ScriptName, $sFilePath = @ScriptFullPath, $sCommandline = '', $bAllUsers = False, $iRunOnce = $STARTUP_RUN) Return __StartupRegistry_Uninstall(True, $sName, $sFilePath, $sCommandline, $bAllUsers, $iRunOnce) EndFunc ;==>_StartupRegistry_Install ; #FUNCTION# ==================================================================================================================== ; Name ..........: _StartupRegistry_Uninstall ; Description ...: Deletes the entry in the 'All Users/Current Users' registry. ; Syntax ........: _StartupRegistry_Uninstall([$sName = @ScriptName[, $sFilePath = @ScriptFullPath[, $bAllUsers = False[, ; $iRunOnce = Default]]]]) ; Parameters ....: $sName - [optional] Name of the program. Default is @ScriptName. ; $sFilePath - [optional] Location of the program executable. Default is @ScriptFullPath. ; $bAllUsers - [optional] Was it added to the current users (0) or all users (1). Default is 0. ; $iRunOnce - [optional] Was it run at system startup $STARTUP_RUN (0), run only once before explorer is started $STARTUP_RUNONCE (1) ; or run only once after explorer is started $STARTUP_RUNONCEEX (2). Default is $STARTUP_RUN (0). ; Return values .: Success - True ; Failure - False & sets @error to non-zero ; Author ........: guinness ; Example .......: Yes ; =============================================================================================================================== Func _StartupRegistry_Uninstall($sName = @ScriptName, $sFilePath = @ScriptFullPath, $bAllUsers = False, $iRunOnce = $STARTUP_RUN) Return __StartupRegistry_Uninstall(False, $sName, $sFilePath, Default, $bAllUsers, $iRunOnce) EndFunc ;==>_StartupRegistry_Uninstall ; #INTERNAL_USE_ONLY#============================================================================================================ Func __Startup_Format(ByRef $sName, ByRef $sFilePath) If $sFilePath = Default Then $sFilePath = @ScriptFullPath EndIf If $sName = Default Then $sName = @ScriptName EndIf $sName = StringRegExpReplace($sName, '\.[^.\\/]*$', '') ; Remove extension. Return Not (StringStripWS($sName, $STR_STRIPALL) == '') And FileExists($sFilePath) EndFunc ;==>__Startup_Format Func __StartupFolder_Location($bAllUsers) Return $bAllUsers ? @StartupCommonDir : @StartupDir EndFunc ;==>__StartupFolder_Location Func __StartupFolder_Uninstall($bIsInstall, $sName, $sFilePath, $sCommandline, $bAllUsers) If Not __Startup_Format($sName, $sFilePath) Then Return SetError(1, 0, False) ; $STARTUP_ERROR_EXISTS EndIf If $bAllUsers = Default Then $bAllUsers = False EndIf If $sCommandline = Default Then $sCommandline = '' EndIf Local Const $sStartup = __StartupFolder_Location($bAllUsers) Local Const $hSearch = FileFindFirstFile($sStartup & '\' & '*.lnk') Local $vReturn = 0 If $hSearch > -1 Then Local Const $iStringLen = StringLen($sName) Local $aFileGetShortcut = 0, _ $sFileName = '' While 1 $sFileName = FileFindNextFile($hSearch) If @error Then ExitLoop EndIf If StringLeft($sFileName, $iStringLen) = $sName Then $aFileGetShortcut = FileGetShortcut($sStartup & '\' & $sFileName) If @error Then ContinueLoop EndIf If $aFileGetShortcut[0] = $sFilePath Then $vReturn += FileDelete($sStartup & '\' & $sFileName) EndIf EndIf WEnd FileClose($hSearch) ElseIf Not $bIsInstall Then Return SetError(2, 0, False) ; $STARTUP_ERROR_EMPTY EndIf If $bIsInstall Then $vReturn = FileCreateShortcut($sFilePath, $sStartup & '\' & $sName & '.lnk', $sStartup, $sCommandline) > 0 Else $vReturn = $vReturn > 0 EndIf Return $vReturn EndFunc ;==>__StartupFolder_Uninstall Func __StartupRegistry_Location($bAllUsers, $iRunOnce) If $iRunOnce = Default Then $iRunOnce = $STARTUP_RUN EndIf Local $sRunOnce = '' Switch $iRunOnce Case $STARTUP_RUNONCE $sRunOnce = 'Once' Case $STARTUP_RUNONCEEX $sRunOnce = 'OnceEx' Case Else $sRunOnce = '' EndSwitch Return ($bAllUsers ? 'HKEY_LOCAL_MACHINE' : 'HKEY_CURRENT_USER') & _ ((@OSArch = 'X64') ? '64' : '') & '\SOFTWARE\Microsoft\Windows\CurrentVersion\Run' & $sRunOnce EndFunc ;==>__StartupRegistry_Location Func __StartupRegistry_Uninstall($bIsInstall, $sName, $sFilePath, $sCommandline, $bAllUsers, $iRunOnce) If Not __Startup_Format($sName, $sFilePath) Then Return SetError(1, 0, False) ; $STARTUP_ERROR_EXISTS EndIf If $bAllUsers = Default Then $bAllUsers = False EndIf If $sCommandline = Default Then $sCommandline = '' EndIf Local Const $sRegistryKey = __StartupRegistry_Location($bAllUsers, $iRunOnce) Local $iInstance = 1, _ $sRegistryName = '', _ $vReturn = 0 While 1 $sRegistryName = RegEnumVal($sRegistryKey & '\', $iInstance) If @error Then ExitLoop EndIf If ($sRegistryName = $sName) And StringInStr(RegRead($sRegistryKey & '\', $sRegistryName), $sFilePath, $STR_NOCASESENSEBASIC) Then $vReturn += RegDelete($sRegistryKey & '\', $sName) EndIf $iInstance += 1 WEnd If $bIsInstall Then $vReturn = RegWrite($sRegistryKey & '\', $sName, 'REG_SZ', $sFilePath & ' ' & $sCommandline) > 0 Else $vReturn = $vReturn > 0 EndIf Return $vReturn EndFunc ;==>__StartupRegistry_UninstallExample 1: #include '_Startup.au3' Example() Func Example() _StartupFolder_Install() ; Add the running EXE to the Current Users startup folder. ShellExecute(@StartupDir & '\') Sleep(5000) _StartupFolder_Uninstall() ; Remove the running EXE from the Current Users startup folder. EndFunc ;==>ExampleExample 2: #include '_Startup.au3' Example() Func Example() _StartupRegistry_Install() ; Add the running EXE to the Current Users Run registry key. Sleep(5000) _StartupRegistry_Uninstall() ; Remove the running EXE from the Current Users Run registry key. EndFunc ;==>ExampleAll of the above has been included in a ZIP file. Startup.zipPrevious: 1447+ downloads.
    1 point
  4. Since the recent SciTE update, I’ve been on a quest to upgrade the appearance (fonts and colors) of my SciTE installation. After viewing several “Best Programming Fonts” articles—and after trying a dozen new fonts—I happened upon something rather amazing: Input, a “free for personal use” font that lets you build your own “family”. With respect to SciTE use, you get to specify exactly which style/weight is deemed as Regular and which is Bold. SciTE is then happy with whatever two choices you make.* For me, it solves the three biggest font problems I’ve had: 1) I like a font that’s slightly heavier, so that it conveys colors well. 2) I’m really particular about the vertical line spacing. “Too sparse” ruins the look, no matter how well-formed the letters are. 3) I’ve never liked squiggly g descenders, which rules out a lot of fonts. I found my perfect solution in a custom 4-style family (see attachment). You can learn all about the font family here: http://input.fontbureau.com/info/ and can test your own preferences here: http://input.fontbureau.com/preview/ Here’s a good review: http://typographica.org/typeface-reviews/input/ ... that includes this: “When it comes to writing and reading code, the user’s preference is paramount and Input offers plenty of ways to hit their sweet spot.” Enjoy. *One minor flaw: the tops of 14-pt 0’s were malformed slightly in SciTE ... but are OK at 13-pt and 15-pt. Likely, it’s something in the way SciTE makes its font calls. 14-pt seems to work OK in a full word processor program.
    1 point
  5. wakillon

    Bitmap2AscII

    Bitmap2AscII use Lucida Console font with a size set to 8, so Windows 8/8.1 users need to change their notepad font and size for get a correct display. Image Rescale slider is only available when saving as image. A click on the "PreviewEdit" open AscII string in Notepad. You can save as Text, Html or Image (add the extension you want) Each setting change is immediately applied. Downloads available in the download section Hope you like it !
    1 point
  6. Your explanation is not clear enough... If I understand, you want to prevent the execution of your AutoIt program by refering to an URL at the startup of the script ? You can make out the url returns a single number (0 or 1), and put this kind of code at the beginning of your script : $sState = BinaryToString( InetRead("http://site.com/active.php") ) If Number($sState) = 0 Then MsgBox(16, "Error", "This program is inactive") Exit EndIf
    1 point
  7. The forum's getting better every day.
    1 point
  8. I feel like I wrote this JS once?
    1 point
  9. Downloading from the link in BrewManNH's post right above yours worked just fine. Please try again; there may have been some forum work going on over the weekend.
    1 point
  10. Jon

    Need some javascript wizardry

    Boom (function() { preTags = document.querySelectorAll('pre.ipsCode'); for(var i=0;i<preTags.length;i++) { oldPre = preTags[i].outerHTML; autoitCodeTop = '<button type="button" onclick="autoitExpand(this);">expand</button>'; autoitCodeTop += '<button type="button" onclick="autoitCollapse(this)" style="display: none">collapse</button>'; autoitCodeTop += ' <button type="button" onclick="autoitPopup(this)">popup</button>'; output = '<div class="autoitCodeTop">' + autoitCodeTop + '</div>' + oldPre; preTags[i].outerHTML = output; } })(); function autoitExpand(node) { div_autoitCodeTop = node.parentNode; pre_ipscode = div_autoitCodeTop.nextSibling; // First sibling will should be the pre tag if (pre_ipscode.nodeName === 'PRE' && pre_ipscode.className.indexOf("ipsCode") > -1) { pre_ipscode.style.maxHeight = 'none'; // Hide this node and display nextSibling (Collapse) node.style.display = "none"; node.nextSibling.style.display = ""; } } function autoitCollapse(node) { div_autoitCodeTop = node.parentNode; pre_ipscode = div_autoitCodeTop.nextSibling; // First sibling will should be the pre tag if (pre_ipscode.nodeName === 'PRE' && pre_ipscode.className.indexOf("ipsCode") > -1) { pre_ipscode.style.maxHeight = '500px'; // Hide this node and display nextSibling (Collapse) node.style.display = "none"; node.previousSibling.style.display = ""; } } function autoitPopup(node) { div_autoitCodeTop = node.parentNode; pre_ipscode = div_autoitCodeTop.nextSibling; // First sibling will should be the pre tag if (pre_ipscode.nodeName === 'PRE' && pre_ipscode.className.indexOf("ipsCode") > -1) { // Remove html formatting and change <br /> into \r\n text = pre_ipscode.innerHTML; text = text.replace(/<br.?\/?>/g, "\r\n"); text = text.replace(/<\/?[^>]+(>|$)/g, ""); node = '<pre>' + text + "</pre>"; popup = window.open("", "Code", "width=800,height=600,scrollbars=yes,resizable=yes"); popup.document.write(node); popup.document.close(); } }
    1 point
  11. [NEW VERSION] - 11 May 15 Changed: New code to cater for multiple monitors. Thanks to argumentum for the idea. New UDF in the first post. M23
    1 point
  12. There are apparently different definitions of struct RASCONN, thank Danyfirex. Moreover, the length of MAX_PATH was wrong. Stupid that I can not test it! #include <Array.au3> Global Const $RAS_MaxAreaCode = 10 Global Const $RAS_MaxPhoneNumber = 128 Global Const $RAS_MaxDeviceType = 16 Global Const $RAS_MaxDeviceName = 128 Global Const $RAS_MaxPadType = 32 Global Const $RAS_MaxX25Address = 200 Global Const $RAS_MaxFacilities = $RAS_MaxX25Address Global Const $RAS_MaxUserData = $RAS_MaxFacilities Global Const $RAS_MaxDnsSuffix = 256 Global Const $RAS_MaxEntryName = 256 Global Const $WM_RASDIALEVENT = 0xCCCD Global Const $RASCS_DONE = 0x2000 Global Const $WAIT_OBJECT_0 = 0 Global $hConection = 0 Global Const $MAX_PATH = 260 Global Const $tagGUID = "struct;DWORD GUID_Data1;WORD GUID_Data2;WORD GUID_Data3;BYTE GUID_Data[8];endstruct" Global Const $tagLUID = "struct;DWORD LUID_LowPart;LONG LUID_HighPart;endstruct" Global Const $tagRASCONN = "align 4;struct;dword dwSize;handle hrasconn;wchar szEntryName[" & $RAS_MaxEntryName + 1 & "];wchar szDeviceType[" & $RAS_MaxDeviceType + 1 & "];wchar szDeviceName[" & $RAS_MaxDeviceName + 1 & "];wchar szPhonebook[" & $MAX_PATH & "];DWORD dwSubEntry;" & $tagGUID; & ";DWORD dwFlags;" & $tagLUID & ";" & $tagGUID & ";endstruct" Global Const $tagREC_lpcb = "dword lpcb" Global Const $tagRec_lpcConns = "dword lpcConns" Local $tREC_lpcb = DllStructCreate($tagREC_lpcb) Local $tREC_lpcConns = DllStructCreate($tagRec_lpcConns) Sleep(100) ; get the required buffer size DllStructSetData($tREC_lpcb, "lpcb", 0) DllStructSetData($tREC_lpcConns, "lpcConns", 0) Local $aRet = DllCall("Rasapi32.dll", "dword", "RasEnumConnections", "ptr", Null, "ptr", DllStructGetPtr($tREC_lpcb), "ptr", DllStructGetPtr($tREC_lpcConns)) MsgBox(0, "get buffer size", "Error Code: " & $aRet[0] & @CRLF & "required buffer size: " & DllStructGetData($tREC_lpcb, "lpcb") & @CRLF & "number of RASCONN Structures: " & DllStructGetData($tREC_lpcConns, "lpcConns") & @CRLF ) ConsoleWrite("required buffer size: " & DllStructGetData($tREC_lpcb, "lpcb") & @CRLF) ; the required buffer size ConsoleWrite("Number of RASCON Structures: " & DllStructGetData($tREC_lpcConns, "lpcConns") & @CRLF) ; mumber of RASCON Structures If $aRet[0] = 603 Then ; ERROR_BUFFER_TOO_SMALL $iConns = DllStructGetData($tREC_lpcConns, "lpcConns") $tagRASCONNS = "" For $iStructs = 1 To $iConns $tagRASCONNS &= StringRegExpReplace($tagRASCONN, "\s+(.*?);", " RC" & $iStructs & "_$1" & ";") & ";" Next ;~ ConsoleWrite($tagRASCONNS & @CRLF) $tRASCONNS = DllStructCreate($tagRASCONNS) $iRASCONN_size = DllStructGetSize(DllStructCreate($tagRASCONN)) ;~ ConsoleWrite($iRASCONN_size & @CRLF) For $iStructs = 1 To $iConns DllStructSetData($tRASCONNS, "RC" & $iStructs & "_dwSize", $iRASCONN_size) Next ConsoleWrite("Size of Struct:" & DllStructGetSize($tRASCONNS) & @CRLF) DllStructSetData($tREC_lpcb, "lpcb", DllStructGetSize($tRASCONNS)) $aRet = DllCall("Rasapi32.dll", "dword", "RasEnumConnections", "ptr", DllStructGetPtr($tRASCONNS), "ptr", DllStructGetPtr($tREC_lpcb), "ptr", DllStructGetPtr($tREC_lpcConns)) MsgBox(0, "get data", "Error Code: " & $aRet[0] & @CRLF & "Size of Struct:" & DllStructGetSize($tRASCONNS) & @CRLF) For $iStructs = 1 To $iConns ConsoleWrite("EntryName of Conn " & $iStructs & ": " & DllStructGetData($tRASCONNS, "RC" & $iStructs & "_szEntryName") & @CRLF) Next EndIf Edit: In https://msdn.microsoft.com/en-us/library/windows/desktop/aa376725(v=vs.85).aspx is the following comment: I have inserted also times in the struct
    1 point
  13. I search in my work and house and I could no find my usb. so I write the example again. #include <Array.au3> Global Const $ERROR_SUCCESS = 0x0 Global Const $ERROR_BUFFER_TOO_SMALL = 603 Global Const $RAS_MaxAreaCode = 10 Global Const $RAS_MaxPhoneNumber = 128 Global Const $RAS_MaxDeviceType = 16 Global Const $RAS_MaxDeviceName = 128 Global Const $RAS_MaxPadType = 32 Global Const $RAS_MaxX25Address = 200 Global Const $RAS_MaxFacilities = $RAS_MaxX25Address Global Const $RAS_MaxUserData = $RAS_MaxFacilities Global Const $RAS_MaxDnsSuffix = 256 Global Const $RAS_MaxEntryName = 256 Global Const $WM_RASDIALEVENT = 0xCCCD Global Const $RASCS_DONE = 0x2000 Global Const $WAIT_OBJECT_0 = 0 Global $hConection = 0 Global Const $MAX_PATH = 256 Global Const $tagGUID = "struct;DWORD GUID_Data1;USHORT GUID_Data2;USHORT GUID_Data3;BYTE GUID_Data[8];endstruct" Global Const $tagLUID = "struct;DWORD LUID_LowPart;LONG LUID_HighPart;endstruct" ;Your $tagRASCONN was wrong (I think you're over window 7 or 8 you should see respective declaration using macros. I'll add you the C++ typedef at the end. Global Const $tagRASCONN = "struct;dword dwSize;handle hrasconn;wchar szEntryName[" & $RAS_MaxEntryName + 1 & "];wchar szDeviceType[" & $RAS_MaxDeviceType + 1 & "];wchar szDeviceName[" & $RAS_MaxDeviceName + 1 & "]" Local $iRet = DllCall("Rasapi32.dll", "dword", "RasEnumConnectionsW", "ptr", 0, "dword*", Null, "ptr*", 0) ;Call For get the required buffer size If $iRet[0] = $ERROR_BUFFER_TOO_SMALL Then Local $tpcbSize = $iRet[2] MsgBox(0, "required buffer size", $tpcbSize) Local $tBuffer = DllStructCreate("dword dwSize;byte[" & $tpcbSize - 4 & "]") ;create a Buffer this is the array of RASCONN Structures Local $tRASCONNSize = DllStructCreate($tagRASCONN);Just For Get The Size Local $iRASCONNSize = DllStructGetSize($tRASCONNSize) ;Just For Get The Size $tRASCONNSize = 0 ;Free $tBuffer.dwSize = $iRASCONNSize ;Fill the first dwSize of the array of RASCONN Structures $iRet = DllCall("Rasapi32.dll", "dword", "RasEnumConnectionsW", "ptr", DllStructGetPtr($tBuffer), "dword*", $tpcbSize, "dword*", 0) ;call For Get the Datas If $iRet[0] = $ERROR_SUCCESS Then Local $iConnections = $iRet[3] Local $atRasConn[$iConnections] ;Create an array of RASCONN Structures ;This is not the best way to do it :) (I gone fast) For $i = 1 To $iConnections $atRasConn[$i - 1] = DllStructCreate($tagRASCONN, DllStructGetPtr($tBuffer) + (($i - 1) * $iRASCONNSize)) ;Create the array of structure supplying the buffer Pointer using as index the RASCONN size MsgBox(0, "Conection " & $i, "szEntryName: " & $atRasConn[$i - 1].szEntryName) Next EndIf Else MsgBox(0, "", "There are no active RAS connections") EndIf ;then Free everything :) here is the type def for unicode. typedef struct tagRASCONNW { DWORD dwSize; HRASCONN hrasconn; WCHAR szEntryName[RAS_MaxEntryName + 1]; #if (WINVER >= 0x400) WCHAR szDeviceType[RAS_MaxDeviceType + 1]; WCHAR szDeviceName[RAS_MaxDeviceName + 1]; #endif #if (WINVER >= 0x401) WCHAR szPhonebook[MAX_PATH]; DWORD dwSubEntry; #endif #if (WINVER >= 0x500) GUID guidEntry; #endif #if (WINVER >= 0x501) DWORD dwFlags; LUID luid; #endif } RASCONNW, *LPRASCONNW; Saludos
    1 point
  14. Let me see If I found my usb flash memory I think I have an example i write some time ago. Saludos
    1 point
  15. this is an Open File Dialog Box and will (depending on the program) normally default back to whatever folder was used last. I couldn't find ( on the fly ) how to change this part of the settings, although it is more than likely a registry setting... But if you have a look here it will show you how to change the Links on the left side (Places Bar) Bill
    1 point
  16. Haven't had the time to create a script for it. But I can think it could work this way: Use function _XLChart_ChartsGet from my ExcelChart UDF to get a list of charts and use the returned object to copy the chart to the clipboard. In Outlook use the method described in the example script _OL_ItemCreate.au3 (Example 1) that comes with the OutlookEX UDF. This exampel uses MS Word to edit the mail body. Another approach would be to save the chart and insert it into an HTML mail as described in _OL_ItemCreate.au3 (Example 4).
    1 point
  17. UEZ

    GDI+ Text Transparency

    Instead of creating a background pic control create a bitmap with that image and copy it everytime to $backbuffer instead of using _GDIPlus_GraphicsClear($backbuffer, 0xFFF0F0F0). Otherwise it is directly not possible to move a transparent image over another.
    1 point
  18. You only need to use admin rights when the application is using admin rights.
    1 point
×
×
  • Create New...