Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 12/09/2015 in all areas

  1. I was looking for a way to find out how long my PC had been running a few weeks ago and had trouble finding something that satisfied my needs, I found a Visual Basic Script that worked but found it too long. But searching trough AutoIt WINAPI help found that it really was as simple as the following little script. #include <WinAPISys.au3> #include <WinAPIMisc.au3> Local $Uptime = _WinAPI_StrFromTimeInterval(_WinAPI_GetTickCount()) MsgBox(0, '', "PC Uptime ==> " & $UpTime) Hope it helps...
    1 point
  2. You can also use something like this : MsgBox(0, "", _ProfilesDir() ) Func _ProfilesDir() $iPreviousMode = Opt("ExpandEnvStrings", 1) $sRegVal = RegRead("HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList", "ProfilesDirectory") $sProfilesDir = $sRegVal Opt("ExpandEnvStrings", $iPreviousMode) Return $sProfilesDir EndFunc
    1 point
  3. Melba23

    String to icon

    Mingre, Do you mean this one? Unfortunately the code has been corrupted by the forum software - perhaps someone else can help correct the errors. M23 Fixed it: #include <WindowsConstants.au3> #include <GDIPlus.au3> #include <WinAPI.au3> Global Const $tagNOTIFYICONDATA = "dword Size;" & _ "hwnd Wnd;" & _ "uint ID;" & _ "uint Flags;" & _ "uint CallbackMessage;" & _ "ptr Icon;" & _ "wchar Tip[128];" & _ "dword State;" & _ "dword StateMask;" & _ "wchar Info[256];" & _ "uint Timeout;" & _ "wchar InfoTitle[64];" & _ "dword InfoFlags;" & _ "dword Data1;word Data2;word Data3;byte Data4[8];" & _ "ptr BalloonIcon" Global Const $NIM_ADD = 0 Global Const $NIM_MODIFY = 1 Global Const $NIF_MESSAGE = 1 Global Const $NIF_ICON = 2 Global Const $AUT_WM_NOTIFYICON = $WM_USER + 1 ; Application.h Global Const $AUT_NOTIFY_ICON_ID = 1 ; Application.h AutoItWinSetTitle("this is a test 123") Global $TRAY_ICON_GUI = WinGetHandle(AutoItWinGetTitle()) ; Internal AutoIt GUI ;;; _GDIPlus_Startup() Local $hBitmap, $hImage, $hGraphic, $hIcon $hBitmap = _WinAPI_CreateSolidBitmap(0, 0xFFFFFF, 16, 16) $hImage = _GDIPlus_BitmapCreateFromHBITMAP($hBitmap) $hGraphic = _GDIPlus_ImageGetGraphicsContext($hImage) For $i = 99 To 1 Step -1 _GDIPlus_GraphicsClear($hGraphic, 0xFFFFFFFF) _GDIPlus_GraphicsDrawString($hGraphic, $i, (StringLen($i) - 2) * - 3, 2, "Arial", 8) $hIcon = _GDIPlus_BitmapCreateHICONFromBitmap($hImage) _Tray_SetHIcon($hIcon) _WinAPI_DestroyIcon($hIcon) Sleep(200) Next _GDIPlus_ImageDispose($hImage) _GDIPlus_GraphicsDispose($hGraphic) _WinAPI_DeleteObject($hBitmap) _GDIPlus_Shutdown() ;;; Func _Tray_SetHIcon($hIcon) Local $tNOTIFY = DllStructCreate($tagNOTIFYICONDATA) DllStructSetData($tNOTIFY, "Size", DllStructGetSize($tNOTIFY)) DllStructSetData($tNOTIFY, "Wnd", $TRAY_ICON_GUI) DllStructSetData($tNOTIFY, "ID", $AUT_NOTIFY_ICON_ID) DllStructSetData($tNOTIFY, "Icon", $hIcon) DllStructSetData($tNOTIFY, "Flags", BitOR($NIF_ICON, $NIF_MESSAGE)) DllStructSetData($tNOTIFY, "CallbackMessage", $AUT_WM_NOTIFYICON) Local $aRet = DllCall("shell32.dll", "int", "Shell_NotifyIconW", "dword", $NIM_MODIFY, "ptr", DllStructGetPtr($tNOTIFY)) If (@error) Then Return SetError(1, 0, 0) Return $aRet[0] <> 0 EndFunc ;==>_Tray_SetHIcon Func _GDIPlus_BitmapCreateHICONFromBitmap($hBitmap) Local $hIcon = DllCall($ghGDIPDll, "int", "GdipCreateHICONFromBitmap", "hwnd", $hBitmap, "int*", 0) If @error Or Not $hIcon[0] Then Return SetError(@error, @extended, $hIcon[2]) Return $hIcon[2] EndFunc ;==>_GDIPlus_BitmapCreateHICONFromBitmap
    1 point
  4. BrettF

    MultiLang.au3

    MultiLang.au3 V1.0.0.0- 14 AUG 2010 MultiLang.zip This is a UDF version of how I chose to load different languages into my GUI for AAMP. It uses different XML language files to provide multi-language support. The download includes the UDF, example GUI with 3 languages (English, German, French) to play with. Languages were translated using Google Translate. Don't expect it to be correct. In your programs try not to do this. Wherever possible find a fluent speaker and give them a cookie. Change Log: 1.0.0.0 - 14 AUG 2010 Inital Version Released Comments and Criticism welcome.
    1 point
×
×
  • Create New...