Leaderboard
Popular Content
Showing content with the highest reputation on 07/06/2015 in all areas
-
New SciTE4AutoIt3 available with the updated SciTE v3.5.4 release.
argumentum reacted to Jos for a topic
Understand you are passioned about this but I am not that convinced this is something I am willing to support for just you. The thing is that I need to be able to maintain and document this and honestly want to avoid adding even more options to the many that are there already unless it would serve a larger portion of the community. Jos1 point -
There is this: https://support.microsoft.com/en-us/kb/977357 and there may be other issues with it. I used WMI inside a 1 second loop to get CPU usage, and ended up with gigabytes of private memory. It took me a long time to suspect WMI, but simply moving the ObjGet outside the loop fixed the problem. You can put a WMI ObjGet inside a tight loop yourself, as a test, and watch the memory run up.1 point
-
GUICreate("GUI") GUISetState() Do If GUIGetMsg() = -3 Then Exit Until not "JohnOne"1 point
-
How to get the selected text at any application without send("^c")
drquochoai reacted to water for a topic
First you should insert a Sleep statement into your loop. Else it will eat up all available CPU. While 1 Sleep(10) WEndSecond: You are sure that the application where you marked the text does support Ctrl+c?1 point -
How to get the selected text at any application without send("^c")
drquochoai reacted to JohnOne for a topic
You should see if you can find a help forum section.1 point -
Actually I take that back, it appears you can. #AutoIt3Wrapper_Run_AU3Check=n #include <Array.au3> For $i = 0 To 2 Assign("Array" & $i, _CreateArray()) Next _ArrayDisplay($Array0) _ArrayDisplay($Array1) _ArrayDisplay($Array2) Func _CreateArray() Local $a[3] Return $a EndFunc ;==>_CreateArrayI'm unsure about the wisdom of such code but it does work.1 point
-
-or- just add this in your properties file assuming you have the full version: save.session.advanced=1Jos1 point
-
GUICTRLGET-LEFT, TOP, WIDTH AND HEIGHT
argumentum reacted to guinness for a topic
Because I don't feel it's my responsibility to write dumb wrappers such as this and add to the UDF library, thus bloating an already extensive library of user functions. If you want me to hold you hand then I am afraid this isn't the place for you, I mean we have done enough already to make your life that more comfortable. Or go away, learn C and then come back here. Maybe your attitude will be that much different. I know mine is.1 point -
_ProcessListProperties()
DrLarch reacted to francoiste for a topic
please ignore my previous question on COM error 80020009. i have answered my own question (as to what might be wrong and how to troubleshoot): it turned out that on this particular system my performance counter registry was corrupt! i was also getting errors when running "perfmon.msc". eventually i solved it by following the steps in https://support.microsoft.com/en-us/kb/2554336 : open an elevated command promptCD /D C:\windows\system32lodctr.exe /RCD /D C:\windows\sysWOW64lodctr.exe /RWINMGMT.EXE /RESYNCPERF<reboot>1 point -
stackoverflow, AutoIt & Voting
argumentum reacted to TheSaint for a topic
That's very true. There are times where I don't necessarily like a person, but do like the odd thing they say. I also see Like as encouragement to say more things in that vein, and to show I'm forgiving or open minded, and prepared to believe that most people are inherently good, and can change given the right impetus. None of us are perfect. Good things should always be encouraged, regardless of who says them. As mothers are often want to say - If you don't have something positive to say, then don't say anything at all. Using Like is like saying something nice and positive. Dislike or No Voting is inherently negative, though undoubtedly useful at times. Giving Yes or No votes, is inherently flawed because there is no judgment on the person doing the vote. It could be a moron or a bunch of morons, and so has no value, but others might mistakenly grant it value. Like says you Like it, but gives no other judgment aside from that. You are not saying it is the best or perfect etc.1 point -
stackoverflow, AutoIt & Voting
argumentum reacted to trancexx for a topic
Let me rephrase then. "Like" button, in essence, likes content (post) and not user. I would click like for the other part of your post. But I'm afraid you'd think I actually like you, and not what you wrote.1 point -
vaishnavi, welcome!You can try to use the window class instead window title. Suppose the window class in question is "CreativeCloud", you can use: WinWaitActive("[CLASS:CreativeCloud]")You can use the "AutoIt Window Info" tool to check the correct name of the window class, besides all other valuable information.1 point
-
Spend a few minutes to search the internet and found this article by Microsoft: https://msdn.microsoft.com/en-us/magazine/dd942846.aspx According to it, your problem can be solve if you are using Windows 7 or later, using its new 'Taskbar Button' feature. It seems that you are currently using Windows 7, so all we need to do is start writting (porting) code. Yep, porting 6 lines of code in C++ to AutoIt PROPVARIANT pv; InitPropVariantFromString(L"MyAppID", &pv); IPropertyStore* pps; VERIFY(SHGetPropertyStoreForWindow(hwnd, IID_PPV_ARGS(&pps))); VERIFY(pps->SetValue(PKEY_AppUserModel_ID, pv)); VERIFY(pps->Commit()); Unluckily, its not easy as it seems to be. Using COM interface in C++ is fast and easy but convert to AutoIt is quite complex. But thanks to tracexx's great ObjCreateInterface function, we can do it much easier. But since it is an experimental function, we want a fallback, which is the boring work. Addition to that, a function is inlined so we cannot using DllCall but rewrite from C++ source. Not much difficult but take a little more time. But here is all you need: #include <StructureConstants.au3> #include <WinAPI.au3> Global Enum $VT_EMPTY, $VT_NULL, $VT_I2, $VT_I4, $VT_R4, $VT_R8, _ $VT_CY, $VT_DATE, $VT_BSTR, $VT_DISPATCH, $VT_ERROR, _ $VT_BOOL, $VT_VARIANT, $VT_UNKNOWN, $VT_DECIMAL, _ $VT_I1 = 16, $VT_UI1, $VT_UI2, $VT_UI4, $VT_I8, $VT_UI8, $VT_INT, $VT_UINT, _ $VT_VOID, $VT_HRESULT, $VT_PTR, $VT_SAFEARRAY, $VT_CARRAY, $VT_USERDEFINED, _ $VT_LPSTR, $VT_LPWSTR, _ $VT_RECORD = 36, $VT_INT_PTR, $VT_UINT_PTR, _ $VT_FILETIME = 64, $VT_BLOB, $VT_STREAM, $VT_STORAGE, _ $VT_STREAMED_OBJECT, $VT_STORED_OBJECT, $VT_BLOB_OBJECT, _ $VT_CF, $VT_CLSID, $VT_VERSIONED_STREAM, $VT_BSTR_BLOB = 0XFFF, _ $VT_VECTOR = 0X1000, $VT_ARRAY = 0X2000, $VT_BYREF = 0X4000, $VT_RESERVED = 0X8000, _ $VT_ILLEGAL = 0XFFFF, $VT_ILLEGALMASKED = 0XFFF, $VT_TYPEMASK = 0XFFF Global $tagPROPVARIANT = 'USHORT vt;' & _ ;typedef unsigned short VARTYPE; - in WTypes.h 'WORD wReserved1;' & _ 'WORD wReserved2;' & _ 'WORD wReserved3;' & _ 'LONG;PTR' ;union, use the largest member (BSTRBLOB, which is 96-bit in x64) Global Const $tagPROPERTYKEY = $tagGUID & ';DWORD pid' ; Optinal setting. Default to True (use newer, experimental method). Set to False to use old, stupid but safe method. Global Const $__OPT_EXPERIMENTAL_OBJCREATEINTERFACE = True ; This function is not exposed in any dll, but inlined in propvarutil.h so we need to rewrite it entirely in AutoIt Func _WinAPI_InitPropVariantFromString($sUnicodeString, ByRef $tPROPVARIANT) Static $nPropVariantDataIndex = 8 ; = DllStructGetSize(DllStructCreate('USHORT vt;WORD wReserved1;WORD wReserved2;WORD wReserved3')) DllStructSetData($tPROPVARIANT, 'vt', $VT_LPWSTR) Local $aRet = DllCall('Shlwapi.dll', 'LONG', 'SHStrDupW', _ 'WSTR', $sUnicodeString, 'PTR', DllStructGetPtr($tPROPVARIANT) + $nPropVariantDataIndex) If @error Then Return SetError(@error, @extended, False) Local $bSuccess = $aRet[0] = 0? True : False ; If fails, zero memory of the current PROPVARIANT struct If (Not $bSuccess) Then $tPROPVARIANT = DllStructCreate($tagPROPVARIANT) Return SetExtended($aRet[0], $bSuccess) EndFunc Func _WinAPI_SHGetPropertyStoreForWindow($hWnd, $sIID, ByRef $tPointer) Local $tIID = _WinAPI_GUIDFromString($sIID) Local $pp = IsPtr($tPointer)? $tPointer : DllStructGetPtr($tPointer) Local $aRet = DllCall('Shell32.dll', 'LONG', 'SHGetPropertyStoreForWindow', _ 'HWND', $hWnd, 'STRUCT*', $tIID, 'PTR', $pp) If @error Then Return SetError(@error, @extended, False) Return SetExtended($aRet[0], ($aRet[0] = 0)) EndFunc Global Const $tagPointer = 'PTR' Global Const $tagIUnknown = 'PTR QueryInterface;PTR AddRef;PTR Release' Global Const $tagIPropertyStore = $tagIUnknown & _ ';PTR GetCount;' & _ ;HRESULT GetCount([Out] DWORD* cProps) 'PTR GetAt;' & _ ;HRESULT GetAt([In] DWORD iProp, [Out] PROPERTYKEY* pKey) 'PTR GetValue;' & _ ;HRESULT GetValue([In] PROPERTYKEY& key, [Out] PROPVARIANT * pv) 'PTR SetValue;' & _ ;HRESULT SetValue([In] PROPERTYKEY& key, [In] PROPVARIANT& propvar) 'PTR Commit' ;HRESULT Commit() Func _Win7Helper_PKEY_AppUserModel_ID() Local $tPROPERTYKEY = DllStructCreate($tagPROPERTYKEY) ;PKEY_AppUserModel_ID = { {0x9F4C2855, 0x9F79, 0x4B39, ; {0xA8, 0xD0, 0xE1, 0xD4, 0x2D, 0xE1, 0xD5, 0xF3}}, 5 } _WinAPI_GUIDFromStringEx('{9F4C2855-9F79-4B39-A8D0-E1D42DE1D5F3}', _ DllStructGetPtr($tPROPERTYKEY)) DllStructSetData($tPROPERTYKEY, 'pid', 5) Return $tPROPERTYKEY EndFunc ; The application id is an up-to-128-characters string Func _Win7Helper_SetWindowAppId($hWnd, $sId) ; This variable is not change. You can use a global const but a local static is prefered due to it scope Local Static $tPROPERTYKEY = _Win7Helper_PKEY_AppUserModel_ID() ; Create and int PROPVARIANT variable Local $tPROPVARIANT = DllStructCreate($tagPROPVARIANT) _WinAPI_InitPropVariantFromString($sId, $tPROPVARIANT) ; Now create an instance of IPropertyStore interface. We must pass a void** (pointer to pointer) ; We can do it in AutoIt by using a pointer to a struct which have only 1 pointer member. Local $tpIPropertyStore = DllStructCreate($tagPointer) $ret = _WinAPI_SHGetPropertyStoreForWindow($hWnd, '{886D8EEB-8CF2-4446-8D02-CDBA1DBDCF99}', $tpIPropertyStore) ; Retrieve the IPropertyStore pointer from result Local $pPropertyStoreObject = DllStructGetData($tpIPropertyStore, 1) ; Now we have a pointer to an IPropertyStore object. ; If you use a new AutoIt version, thank to elegant ObjCreateInterface by tracexx,; ; we can easily call method from the pointer we have If ($__OPT_EXPERIMENTAL_OBJCREATEINTERFACE) Then Local $oPropertyStoreObject = ObjCreateInterface($pPropertyStoreObject, _ '{886D8EEB-8CF2-4446-8D02-CDBA1DBDCF99}', _ 'GetCount HRESULT(PTR);GetAt HRESULT(DWORD; PTR);GetValue HRESULT(PTR; PTR);' & _ 'SetValue HRESULT(PTR; PTR);Commit HRESULT()') $oPropertyStoreObject.SetValue(DllStructGetPtr($tPROPERTYKEY), DllStructGetPtr($tPROPVARIANT)) $oPropertyStoreObject.Commit() Else ; But if you don't want to use an experimental function, we can do it manually ; First retrieve the v-table of the object. IPropertyStore is directly inherited from IUnknown ; so we have only one v-table data, merge of IUnknown and IPropertyStore, ; located at the beginning of the object address Local $pIPropertyStore = DllStructGetData(DllStructCreate($tagPointer, $pPropertyStoreObject), 1) Local $tIPropertyStore = DllStructCreate($tagIPropertyStore, $pIPropertyStore) ; With the v-table, we can call methods (yes we use another advanced function, ; but not a beta function so its safe as much as we use it correctly ; We simulate a c++ method, first parameter should be pointer to object itself. ; SetValue DllCallAddress('LONG', DllStructGetData($tIPropertyStore, 'SetValue'), _ 'PTR', $pPropertyStoreObject, _ ; pThis 'PTR', DllStructGetPtr($tPROPERTYKEY), _ 'PTR', DllStructGetPtr($tPROPVARIANT)) DllCallAddress('LONG', DllStructGetData($tIPropertyStore, 'Commit'), 'PTR', $pPropertyStoreObject) EndIf EndFunc ; Demo $hWnd1 = GUICreate('Test1') $hWnd2 = GUICreate('Test2') $hWnd3 = GUICreate('Test3') ; The application id should be unique so it not effect any other application. ; Better use a format like MyCompany(orMyName).MyApplication.WindowId _Win7Helper_SetWindowAppId($hWnd1, 'MyGreatCompany.MyAwesomeApplication.MyElegantWindow1') _Win7Helper_SetWindowAppId($hWnd2, 'MyGreatCompany.MyAwesomeApplication.OhImNotAWindowImAnAlien') _Win7Helper_SetWindowAppId($hWnd3, 'MyGreatCompany.MyAwesomeApplication.MyElegantWindow1') GUISetState(@SW_SHOW, $hWnd1) GUISetState(@SW_SHOW, $hWnd2) GUISetState(@SW_SHOW, $hWnd3) Sleep(10000)1 point
-
GUI design concepts.
argumentum reacted to guinness for a topic
This is a place to post GUI examples that other users may find interesting. Try to code clearly and concisely please for example DON'T USE MAGIC NUMBERS! Splash Screen: #include <GUIConstantsEx.au3> #include <SendMessage.au3> #include <WindowsConstants.au3> Global Const $SC_DRAGMOVE = 0xF012 Example() ; Idea by prizm1 Func Example() Local $iHeight = 250, $iWidth = 400 Local $hGUI = GUICreate('', $iWidth, $iHeight, Default, Default, BitOR($WS_POPUP, $WS_BORDER), $WS_EX_TOPMOST) GUICtrlCreateGroup('', 0, -5, $iWidth, $iHeight + 5, $WS_THICKFRAME) GUICtrlCreateGroup('', -99, -99, 1, 1) Local $iClose = GUICtrlCreateButton('Close', $iWidth - 100, $iHeight - 40, 85, 25) GUISetState(@SW_SHOW, $hGUI) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $iClose ExitLoop Case $GUI_EVENT_PRIMARYDOWN _SendMessage($hGUI, $WM_SYSCOMMAND, $SC_DRAGMOVE, 0) EndSwitch WEnd GUIDelete($hGUI) EndFunc ;==>Example1 point -
I found an old snippet in my GDI+ folder: #include <GDIPlus.au3> _GDIPlus_Startup() $iBGColor = 0xFFFFFF $iW = 880 $iH = 150 $hgui = GUICreate("Outlined Text Effect", $iW, $iH) GUISetBkColor($iBGColor, $hgui) GUISetState() $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI) $hBitmap = _GDIPlus_BitmapCreateFromGraphics($iW, $iH, $hGraphic) $hBackbuffer = _GDIPlus_ImageGetGraphicsContext($hBitmap) _GDIPlus_GraphicsSetSmoothingMode($hBackbuffer, 2) _GDIPlus_GraphicsSetTextRenderingHint($hBackbuffer, 4) _GDIPlus_GraphicsClear($hBackbuffer, 0xFF000000 + $iBGColor) $hFamily = _GDIPlus_FontFamilyCreate("Verdana") $hFormat = _GDIPlus_StringFormatCreate() $tLayout = _GDIPlus_RectFCreate(0, 0, 0, 0) $hPath = _GDIPlus_PathCreate() _GDIPlus_PathAddString($hPath, "Outlined Text", $tLayout, $hFamily, 0, 90 * 1.333333, $hFormat) $hPen = _GDIPlus_PenCreate(0xF0000000, 8) _GDIPlus_GraphicsDrawPath($hBackbuffer, $hPath, $hPen) $hBrush = _GDIPlus_BrushCreateSolid(0xFFFF0000) _GDIPlus_GraphicsFillPath($hBackbuffer, $hPath, $hBrush) _GDIPlus_GraphicsDrawImageRect($hGraphic, $hBitmap, 0, 0, $iW, $iH) _GDIPlus_PathDispose($hPath) _GDIPlus_PenDispose($hPen) _GDIPlus_BrushDispose($hBrush) _GDIPlus_FontFamilyDispose($hFamily) _GDIPlus_StringFormatDispose($hFormat) _GDIPlus_GraphicsDispose($hBackbuffer) _GDIPlus_BitmapDispose ($hBitmap) _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_Shutdown() Do Until GUIGetMsg() = -3 GUIDelete() Exit Br, UEZ1 point
-
SplashMadeSimple UDF
Klexur reacted to Dragonlair for a topic
hello, this is my second post and my first UDF, its function is to create a Splash Screen, similar to CorelDraw or Sony Vegas for now is functions are very limited but I hope will be useful FUNCTIONS: _SplashCreate() creates the splash itself whit the initial params and show it _SplashUpdate() Update the message text in the splash _SplashUpdateProgress() Update the ProgressBar in the splash, else this function includes a smoothing of the progressbar so the update time from 0 to 100% is of 1-2 sec. _SplashDelete() Delete the Splash, Both functions _SplashCreate() and _SplashDelete() transitions in a fade effect Notes: all comments are welcome, as well as suggestions for adding new functions to UDF Tested in Windows Xp Service Pack 3 Spanish(México) using Autoit 3.3.6.1 PS: sorry for my English is not my native language TO DO: I have to add functions "Error checking returns" but still the UDF works properly. OK here is the UDF #include-once #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <ProgressConstants.au3> ; #INDEX# ======================================================================================================================= ; Title .........: Splash Made Simple ; AutoIt Version : 3.3.6.1 ; Description ...: Functions to easily create a boot splash ; Author(s) .....: Dragonlair ; =============================================================================================================================== Global $Splash, $SplashUpdate, $FadeEffectTime, $Progress Func _SplashCreate($Pic, $Authorcopy, $Widht = 480, $Height = 272, $Loadmsg = "loading.", $FontColor = 0xFFFFFF, $ProgressBKColor = 0xFFFFFF, $ProgressColor = 0xC0C0C0, $FadeEffectTime = 300) DllCall("uxtheme.dll", "none", "SetThemeAppProperties", "int", 0) $Splash = GUICreate("", $Widht, $Height, -1, -1, BitOR($WS_SYSMENU, $WS_POPUP), BitOR($WS_EX_TOPMOST, $WS_EX_WINDOWEDGE, $WS_EX_TOOLWINDOW)) GUICtrlCreatePic($Pic, 0, 0, $Widht, $Height) GUICtrlCreateLabel($Loadmsg, 15, ($Height - 62), 438, 17) GUICtrlSetColor(-1, $FontColor) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) $SplashUpdate = GUICtrlCreateLabel("", 15, ($Height - 49), 438, 17) GUICtrlSetColor(-1, $FontColor) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) $Progress = GUICtrlCreateProgress(15, ($Height - 33), 198, 7, $PBS_SMOOTH) GUICtrlSetColor(-1, $ProgressColor) GUICtrlSetBkColor(-1, $ProgressBKColor) GUICtrlCreateLabel("Copyright © " & @YEAR & " " & $Authorcopy, 16, ($Height - 20), 438, 14) GUICtrlSetFont(-1, 6, 800, 0, "Arial") GUICtrlSetColor(-1, $FontColor) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $Splash, "int", $FadeEffectTime, "long", 0x00080000) GUISetState() EndFunc ;==>_SplashCreate Func _SplashUpdate($updatemsg) GUICtrlSetData($SplashUpdate, $updatemsg) EndFunc ;==>_SplashUpdate Func _SplashProgressUpdate($ProgValue) if $ProgValue < GUICtrlRead($Progress) Then GUICtrlSetData($Progress, 0) For $i = GUICtrlRead($Progress) To $ProgValue Step 1 Sleep(10) GUICtrlSetData($Progress, $i) Next EndFunc ;==>_SplashProgressUpdate Func _SplashDelete() DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $Splash, "int", $FadeEffectTime, "long", 0x00090000) GUIDelete($Splash) EndFunc ;==>_SplashDelete And an example #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <Misc.au3> #include <SplashMadeSimple.au3> ;Include the UDF Global $Picture = @ScriptDir & "\background.jpg", $TextColor = 0xFFFFFF, $ProgressBarBGColor = 0xFFFFFF, $ProgressBarColor = 0xC0C0C0 #region ### START Koda GUI section ### Form= $Form1 = GUICreate("Splash Made Simple Example", 334, 216, -1, -1) GUICtrlCreateLabel("Loading Message", 8, 8, 88, 17) $Input1 = GUICtrlCreateInput("Loading...", 96, 8, 233, 21) GUICtrlCreateLabel("Module name 1", 8, 40, 77, 17) $Input2 = GUICtrlCreateInput("Main Executable modules", 96, 32, 233, 21) GUICtrlCreateLabel("Module name 2", 8, 64, 77, 17) $Input3 = GUICtrlCreateInput("Network Support", 96, 56, 233, 21) GUICtrlCreateLabel("Module name 3", 8, 88, 77, 17) $Input4 = GUICtrlCreateInput("Multimedia Support", 96, 80, 233, 21) $Button1 = GUICtrlCreateButton("Font Color", 8, 176, 75, 33) GUICtrlCreateLabel("Author info", 8, 112, 55, 17) $Input5 = GUICtrlCreateInput("Dragonlair Software. OpenSource Code...", 96, 104, 233, 21) $Button2 = GUICtrlCreateButton("Progress bar bk color", 88, 176, 75, 33, $BS_MULTILINE) $Button3 = GUICtrlCreateButton("Progress bar color", 168, 176, 75, 33, $BS_MULTILINE) $Button4 = GUICtrlCreateButton("Preview", 248, 176, 75, 33) GUICtrlCreateLabel("Width", 8, 152, 32, 17) $Input6 = GUICtrlCreateInput("480", 40, 144, 49, 21, BitOR($GUI_SS_DEFAULT_INPUT, $ES_NUMBER)) GUICtrlCreateLabel("height", 104, 152, 33, 17) $Input7 = GUICtrlCreateInput("272", 144, 144, 33, 21, BitOR($GUI_SS_DEFAULT_INPUT, $ES_NUMBER)) GUICtrlCreateLabel("image used in background", 184, 136, 129, 17) GUICtrlCreateLabel("will be automatically stretched", 184, 152, 144, 17) GUISetState(@SW_SHOW) #endregion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 $TextColor = _ChooseColor(2, 0xFFFFFF, 2, $Form1) Case $Button2 $ProgressBarBGColor = _ChooseColor(2, 0xFFFFFF, 2, $Form1) Case $Button3 $ProgressBarColor = _ChooseColor(2, 0xC0C0C0, 2, $Form1) Case $Button4 ; If Button Preview Is Pressed GUICtrlSetState($Button4, $Gui_Disable) GUISetState(@SW_MINIMIZE, $Form1) ;we read the values from the GUI $inputloadmsg = GUICtrlRead($Input1) $loadmsg1 = GUICtrlRead($Input2) $loadmsg2 = GUICtrlRead($Input3) $loadmsg3 = GUICtrlRead($Input4) $authormsg = GUICtrlRead($Input5) $inputWidth = GUICtrlRead($Input6) $inputheigh = GUICtrlRead($Input7) ;~ here is dscribes how is used the UDF itself ;~ Create the splash whith the default provided parameters _SplashCreate($Picture, $authormsg, $inputWidth, $inputheigh, $inputloadmsg, $TextColor, $ProgressBarBGColor, $ProgressBarColor) ;~ we wait 2 secs for the first message in splash update Sleep(2000) ;~ here We update the message in the splash _SplashUpdate($loadmsg1) ;~ this bucle is to show how progress bar works, the maximun values is 100 For $i = 0 To 100 Step 25 Sleep(1000) _SplashProgressUpdate($i) Next ;~ same as above Sleep(2000) _SplashUpdate($loadmsg2) _SplashProgressUpdate(60) Sleep(500) _SplashProgressUpdate(100) Sleep(2000) _SplashUpdate($loadmsg3) _SplashProgressUpdate(60) Sleep(500) _SplashProgressUpdate(70) Sleep(1000) _SplashProgressUpdate(100) Sleep(1000) _Splashdelete() GUISetState(@SW_RESTORE, $Form1) GUICtrlSetState($Button4, $Gui_Enable) EndSwitch WEnd also here is at your disposal the rar with the source code and a test image I hope not to forget anything else. bye bye1 point -
INetGetSource UTF-8 Problem
drquochoai reacted to KaFu for a topic
The error is in the function INetGetSource(). It utilizes BinaryToString() without the UTF8 flag = 4, default flag is 1=ANSI. #include <INet.au3> consolewrite(0,"",_INetGetSourceEx('http://russia.ru/video/news_9508/')) Func _INetGetSourceEx($s_URL, $bString = True) Local $sString = InetRead($s_URL, 1) Local $nError = @error, $nExtended = @extended If $bString Then $sString = BinaryToString($sString,4) Return SetError($nError, $nExtended, $sString) EndFunc ;==>_INetGetSource1 point -
Label with border display no text
behdadsoft reacted to SmOke_N for a topic
Same concept:#include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> LabelEx() Func LabelEx() GUICreate("My GUI state"); will create a dialog box that when displayed is centered _GUICtrlCreateLabel_ColorBorder(0xFF0000, "aaaa", 125, 100, 186, 95) GUISetState() ; Run the GUI until the dialog is closed While GUIGetMsg() <> -3 WEnd EndFunc Func _GUICtrlCreateLabel_ColorBorder($i_color, $s_text, $i_left, $i_top, $i_width = -1, $i_height = -1, $i_style = -1, $i_exstyle = -1) GUICtrlCreateLabel("", $i_left - 1, $i_top - 1, $i_width + 2, $i_height + 2) GUICtrlSetBkColor(-1, 0xFF0000) Return GUICtrlCreateLabel($s_text, $i_left, $i_top, $i_width, $i_height, $i_style, $i_exstyle) EndFunc1 point -
I've created an include file for extending the functionality of SplashText. My new function is called "SplashIt". Features - Borderless window which is automatically sized to length of text (handles multiple lines) - Window becomes movable (with a title) when the mouse is moved within the window, and goes back to borderless when mouse moves outside of window - If text is changed, window stays where it was put The key to the auto window sizing is using a fixed width font, in this case Lucida Console. Usage Show the splash screen: _SplashIt ("some text") Hide the splash screen: _SplashIt ("") Things to note - Uses Adlib to monitor the mouse, so can't be used with other Adlib functions - Default title of window when moved is "Message Window" but this can be changed using the global variable $_SplashItTitle - Don't change the $_SplashItTitle variable while window is open (Adlib function will error) Download include file from: http://www.autoitscript.com/fileman/users/public/seanhart/splashit.au3 #include-once ; ---------------------------------------------------------------------------- ; ; AutoIt Version: 3.0 ; Language: English ; Author: Sean Hart <autoit@hartmail.ca> ; Function: Borderless, auto-sizing, movable splash window ; Notes: Variable $_SplashItTitle holds the title of the spash ; window, which is only displayed while it is being moved. ; Set that variable in your code to change it from the ; default. ; ; WARNING - Make sure splash window is closed if changing ; $_SplashItTitle variable! ; ; ; Following global variables are needed: ; $_SplashItMouse = 1 - Mouse is within splash window ; 0 - Mouse is outside of splash window ; $_SplashItTitle = string - Title of splash window ; ; ---------------------------------------------------------------------------- Dim $_SplashItMouse, $_SplashItTitle $_SplashItMouse = 0 $_SplashItTitle = "Message Window" ; ---------------------------------------------------------------------------- ; ; Description: Creates / changes / hides splash window ; Syntax: _SplashIt ($sText) ; Parameter(s): $sText - Text to display (set to "" to close window) ; Requirement(s): None ; Return Value(s): None ; ; ---------------------------------------------------------------------------- Func _SplashIt ($sText) ; Declare variables Dim $width, $height, $split, $x, $maxlen ; Turn of splash text if blank and stop adlib If $sText = "" Then AdlibDisable () SplashOff () Else ; Determine height using number of lines of text and width using the longest line $maxlen = 0 $split = StringSplit ($sText, @CR & @LF) For $x = 1 to $split[0] If StringLen ($split[$x]) > $maxlen Then $maxlen = StringLen ($split[$x]) Next $height = ($split[0] + 2) * 12 $width = ($maxlen * 8) + 16 ; Add a line feed to text to space it nicely $sText = @LF & $sText ; If the window already exists, change the text (so window doesn't move) if WinExists ($_SplashItTitle, "") then ControlSetText($_SplashItTitle, "", "Static1", $sText) else SplashTextOn ($_SplashItTitle, $sText, $width, $height, -1, -1, 17, "Lucida Console", "10") endif ; Use adlib function to monitor mouse AdlibEnable ("_MoveSplash", 500) EndIf EndFunc ; ---------------------------------------------------------------------------- ; ; Description: Adlib function to change the splash window type when the ; mouse cursor enters the coordinates of the window. Allows ; the splash window to be moved. ; Syntax: _MoveSplash () ; Parameter(s): None ; Requirement(s): None ; Return Value(s): None ; ; ---------------------------------------------------------------------------- Func _MoveSplash () ; Declare variables Dim $winpos, $mousepos, $text, $width, $height, $maxlen, $x ; Get coordinates of window and position of mouse $winpos = WinGetPos ($_SplashItTitle) $mousepos = MouseGetPos () ; Get contents of text from window $text = ControlGetText ($_SplashItTitle, "", "Static1") ; Determine height using number of lines of text and width using the longest line $maxlen = 0 $split = StringSplit ($text, @CR & @LF) For $x = 1 to $split[0] If StringLen ($split[$x]) > $maxlen Then $maxlen = StringLen ($split[$x]) Next $height = ($split[0] + 1) * 12 $width = ($maxlen * 8) + 16 ; If mouse is has just moved within window coordinates, change window type to 16 to allow it to move if ($mousepos[0] > $winpos[0]) and ($mousepos[0] < $winpos[0] + $winpos[2]) and ($mousepos[1] > $winpos[1]) and ($mousepos[1] < $winpos[1] + $winpos[3]) then if not $_SplashItMouse then $_SplashItMouse = 1 SplashTextOn ($_SplashItTitle, $text, $width, $height, $winpos[0], $winpos[1], 16, "Lucida Console", "10") endif ; If mouse has just left window coordinates, change window type back to 17 (borderless) else if $_SplashItMouse then $_SplashItMouse = 0 SplashTextOn ($_SplashItTitle, $text, $width, $height, $winpos[0], $winpos[1], 17, "Lucida Console", "10") endif endif EndFunc1 point