-
Posts
1,025 -
Joined
-
Last visited
Content Type
Forums
Downloads
Forum Articles
Events
Everything posted by ResNullius
-
How to make Toast - New version 2 Aug 18
ResNullius replied to Melba23's topic in AutoIt Example Scripts
see the example at the bottom of this post: -
Howdy Saint, I had occasion to test your fine project and I'd like to share a two-line speed up tip that took me a while to discover when I first started with SQLite. I tested your script with the additions on the largest ini file I could find on my system and my log reads as follows: Sorry I don't have a "before" log, I got tired of waiting.... The only problem is that it's so fast your Splash progress messages don't show up properly The "secret"? Add this line after you open your db (line 281 in v 1.4 of your code) $DBhandle = _SQLite_Open($DBfile) ; original code opening db _SQLite_Exec($DBhandle, "BEGIN;") ; <<<< Add this line And add the following line before you close your database (line 360 of your version 1.4 code) _SQLite_Exec($DBhandle, "COMMIT;") ; <<< Add this line _SQLite_Close($DBhandle) ; original code closing db PS: I also had to add a check on reading empty ini sections to prevent the script from crashing (line 327 of your v 1.4 code) $keys = IniReadSection($srcfle, $section) ; original code If Not (IsArray($keys)) Then ContinueLoop ; <<< Insert this line to prevent crashing on reading an empty section $entries = $keys[0][0] ; original code Hope these help, Cheers.
-
How to make Toast - New version 2 Aug 18
ResNullius replied to Melba23's topic in AutoIt Example Scripts
Melba23, Had occasion to make use of your very excellent Toast UDF in a recent project. Don't know if's been addressed in the 14 pages of posts so far, but I required the ability to use specific icons from the compiled exe and so I made a slight modification beginning at line 279 of your source where you check to see if an exe or ico file was passed to the function as the $vIcon parameter. ;Replace lines 279 to 286 in 01 April 17 verion of TOAST.AU3 ;Added by ResNullius to accomodate choice of multiple icons in exe, dll If StringInStr($vIcon, "|") Then $iIcon_Style = StringRegExpReplace($vIcon, "(.*)\|", "") $sDLL = StringRegExpReplace($vIcon, "\|.*$", "") Else ;End Added by ResNullius to accomodate numbered icons in exe Switch StringLower(StringRight($vIcon, 3)) Case "exe", "ico" $sDLL = $vIcon $iIcon_Style = 0 Case "bmp", "jpg", "gif", "png" $sImg = $vIcon EndSwitch EndIf EndIf I call it from the compiled script like this: _Toast_Show(@AutoItExe & "|203", "My Program", "My Message",3) ;or _ToastShow("C:\CoolScripts\MyCoolScript.exe|201","My Cool Script", "My Cool Message",3) The pipe symbol "|" is used to separate the file name from the icon's resource/ordinal name. Not tested extensively, but worked a treat for my purposes. Thanks again for all you do for this community! -
OK, found the problem: with versions of AutoIt after 3.3.10.2 you have to do an explicit DllOpen() for setupapi.dll before any of the subsequent DllCall() statements Found the solution in a post by Biatu https://www.autoitscript.com/forum/topic/77731-device-management-api/?do=findComment&comment=1186109 in another thread.
-
@guinness, Your rewritten script no longer works with the current 3.3.14.2 or beta 3.3.15.0 AutoIt versions. The latest version I can get it to work with is release 3.3.10.2 (I don't have all the betas since then, but the ones I do have don't work either). I've tested on Win 7 Pro x86 and x64 versions on different physical machines.. If you run the script with both using your built in example, you will see that when you hit the _ArrayDisplay($hDriveEject) that some info is missing running with later versions of AutoIt. Further debugging shows that 3.3.10.2 yields the following values in my testing: $aQueryDrive[$DRIVE_EJECT_DEVICEINSTANCE] = USBSTOR\DISK&VEN_KINGSTON&PROD_DATATRAVELER_3.0&REV_PMAP\00147854488EBE51E75C40C2&0 $aQueryDrive[$DRIVE_EJECT_DEVICEINSTANCEPARENT] = 2472 and any AutoIt version after that that yields no values for those: $aQueryDrive[$DRIVE_EJECT_DEVICEINSTANCE] = $aQueryDrive[$DRIVE_EJECT_DEVICEINSTANCEPARENT] = Looks like something failing with the DLL call If $aQueryDrive[$DRIVE_EJECT_DEVICEID] > 0 Then $aReturn = DllCall('setupapi.dll', 'dword', 'CM_Get_Device_IDW', _ 'ptr', $aQueryDrive[$DRIVE_EJECT_DEVICEID], _ 'wstr', '', _ 'ulong', DllStructGetSize($tBuffer), _ ; Was once 1024. 'ulong', 0) but I can't figure it out. Perhaps you can cast your expert eye over it, and confirm whether it is indeed a problem. I seem to recall it stopped working with the 3.3.11.0 beta, but couldn't find anything in the change logs that set would lead me to the solution. Thanks
-
Writing DPI Awareness App - workaround
ResNullius replied to mLipok's topic in AutoIt Example Scripts
KaFu posted a wrapper for GuiSetFont/GuiCtrlSetFont that has a Dpi Ratio function (by Phillip123Adams) using straight dll call without GDI+. See -
How about something like this, based on Holger's example @ Creates a tray menu that will popup on the screen wherever your cursor is when you press your hotkey combo. I used the concept to create an app that would paste predefined items into different programs #include <Constants.au3> Opt("TrayMenuMode", 1) Opt("WinTitleMatchMode", 4) Global Const $TPM_BOTTOMALIGN = 0x0020 $item1 = TrayCreateItem("item_1") $item2 = TrayCreateItem("item_2") TrayCreateItem("") ; spacer $aboutItem = TrayCreateItem("About") $exitItem = TrayCreateItem("Exit") HotKeySet("^+v", "ShowTrayMenu") ; Ctrl + Shift + V While 1 $Msg = TrayGetMsg() Switch $Msg Case $item1 MsgBox(4096, "", "Item 1...") Case $item2 MsgBox(4096, "", "Item 2...") Case $exitItem ExitLoop Case $aboutItem MsgBox(4096, "Info", "Just for fun...") EndSwitch WEnd Exit Func ShowTrayMenu() Local $stPoint = DllStructCreate("int;int") DllCall("user32.dll", "int", "GetCursorPos", _ "ptr", DllStructGetPtr($stPoint)) DllCall("user32.dll", "int", "TrackPopupMenuEx", _ "hwnd", TrayItemGetHandle(0), _ "int", $TPM_BOTTOMALIGN, _ "int", DllStructGetData($stPoint, 1), _ "int", DllStructGetData($stPoint, 2), _ "hwnd", WinGetHandle("classname=AutoIt v3"), _ "ptr", 0) EndFunc ;==>ShowTrayMenu
-
how to determine the "current" GUI? (not "active window")
ResNullius replied to orbs's topic in AutoIt GUI Help and Support
Of course, binhnx is right. My bad for not testing/researching fully... -
how to determine the "current" GUI? (not "active window")
ResNullius replied to orbs's topic in AutoIt GUI Help and Support
Along the lines of binhnx's solution, but doesn't require creating a dummy control. Does require that at least one control be present on the Gui though... Func _FindCurrentGUI() ;requires at least one control currently exists on the Gui before this function is called Local $hCurrGui = _WinAPI_GetParent(GUICtrlGetHandle(-1)) Return $hCurrGui EndFunc ;==>_FindCurrentGUI -
Simplified (?) version of a function originally posted by guinness @ Improvements (?): Does not require Date.au3 include and Date string can be passed with or without separators ConsoleWrite(_IsDateOrAboveEx(@YEAR & "/" & @MON & '/' & @MDAY-3) & @CRLF) ; Returns False ConsoleWrite(_IsDateOrAboveEx(@YEAR & @MON & @MDAY+1) & @CRLF) ; Returns True Func _IsDateOrAboveEx($sDateString) ;Check if a date is equal to/or has passed the current date. ;Pass the string as YYYYMMDD, with or without separators e.g. 20140815 or 2014/08/15, or 2014-08-15, or 2014.08.15 ;Original concept by guinness http://www.autoitscript.com/forum/topic/139260-autoit-snippets/#entry1005153 Return Number(StringRegExpReplace($sDateString, "\D|$", "")) >= NUMBER(@YEAR & @MON & @MDAY) EndFunc
-
GUIFrame UDF - Melba23 version - 19 May 14
ResNullius replied to Melba23's topic in AutoIt Example Scripts
@Melba23, Maybe I'm just daft, but there seems to be a problem with the individual GUI frames created in terms of, shall I say, their "stickiness". If I fire up your "GUIFrame_Example_1.au3" as included in the current download and click and drag say the green background in the upper left frame, the whole thing moves. If I now click and drag on some of the exposed "white" space where the green used to be, I can clcik and drag the whole left half of the GUI, top, bottom, and horizontal split. If I click and drag the red right half of the GUI and then click and drag on the exposed white space there, the Entire inside of the GUI with all dividers and child objects can be dragged around. I have reproduced this problem on two different computers, both running the latest stable build of AutoIt 3.3.8.1. Can you reproduce? If so, is that behaviour by design or is there a bit that hasn't been flipped somewhere. I was looking forward to using this in a new project, but I can't trust my users not to idly click and drag things around Thanks -
is there such thing as @userpassword ?
ResNullius replied to dirty's topic in AutoIt General Help and Support
@dirty, If its any help, this will verify that the credentials inputted match the logged on user: http://www.autoitscript.com/forum/index.php?s=&showtopic=92240&view=findpost&p=663459 -
Is it possible to set the position of FileOpenDialog()?
ResNullius replied to 4Eyes's topic in AutoIt GUI Help and Support
You might have a look at MrCreatoR's clever idea for centering a FileOpenDialog which could easily be adapted to positioning it where you want: http://www.autoitscript.com/forum/index.php?showtopic=97919&view=findpost&p=704245 -
This code fails because if $changer = "A1" or "2B", etc it will tell you it's a number and it's not... ZacUSNYR had the correct reason: FileReadLine returns a string. StringIsDigit() is the correct test.
-
Adding a menu in to a Windows program an using it
ResNullius replied to LeonNic's topic in AutoIt General Help and Support
Are you running Windows 7 by chance? If so, the Calculator window class has changed to "CalcFrame", so you need to replace all instances of "[CLASS:SciCalc]" in the example with "[CLASS:CalcFrame]" to target the correct window. -
IIRC Alt+Space is actually the standard shortcut to invoke a window's systemmenu. The App key appears to work differently in different apps when the main window is active: some apps show the systemmenu, others show the same menu you'd get by right-clicking inside the client area.
-
Using Zedna's nifty idea of assigning Accelerators to dummy controls (), this adds app key functionality #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> #include <MenuConstants.au3> #include <GUIMenu.au3> Global Const $SM_CXFIXEDFRAME = 7 $hGUI = GUICreate("", 250, 100, -1, -1, BitOR($WS_THICKFRAME, $WS_POPUP)) $AppKey = GUICtrlCreateDummy() Dim $aAccelKeys[1][2] = [["{APPSKEY}", $AppKey]] GUISetAccelerators($aAccelKeys) $hMenu = _GUICtrlMenu_GetSystemMenu($hGUI) _GUICtrlMenu_SetItemState($hMenu, $SC_RESTORE, $MFS_DISABLED, True, False) _GUICtrlMenu_SetItemState($hMenu, $SC_SIZE, $MFS_DISABLED, True, False) _GUICtrlMenu_SetItemState($hMenu, $SC_MINIMIZE, $MFS_DISABLED, True, False) _GUICtrlMenu_SetItemState($hMenu, $SC_MAXIMIZE, $MFS_DISABLED, True, False) GUISetState(@SW_SHOW) GUIRegisterMsg($WM_NCHITTEST, "WM_NCHITTEST") GUIRegisterMsg($WM_NCRBUTTONUP, "WM_NCRBUTTONUP") While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $AppKey $aWinPos = WinGetPos($hGUI) $iBorderOffset = _WinAPI_GetSystemMetrics($SM_CXFIXEDFRAME) $lParam = _WinAPI_MakeLong($aWinPos[0] + $iBorderOffset, $aWinPos[1] + $iBorderOffset) WM_NCRBUTTONUP($hGUI, $WM_NCRBUTTONUP, $HTCAPTION, $lParam) EndSwitch WEnd Func WM_NCHITTEST($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam, $lParam Local $iDef = _WinAPI_DefWindowProc($hWnd, $iMsg, $wParam, $lParam) Switch $iDef Case $HTBOTTOM, $HTBOTTOMLEFT, $HTBOTTOMRIGHT, $HTLEFT, $HTRIGHT, $HTTOP, $HTTOPLEFT, $HTTOPRIGHT Return $HTCAPTION EndSwitch Return $iDef EndFunc ;==>WM_NCHITTEST Func WM_NCRBUTTONUP($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam, $lParam If ($wParam = $HTCAPTION) Then Local $iCmd = _GUICtrlMenu_TrackPopupMenu(_GUICtrlMenu_GetSystemMenu($hWnd), $hWnd, _WinAPI_LoWord($lParam), _WinAPI_HiWord($lParam), 1, 1, 2, 1) If ($iCmd <> 0) Then _SendMessage($hWnd, $WM_SYSCOMMAND, $iCmd, $lParam) EndIf Return 0 EndFunc ;==>WM_NCRBUTTONUP
-
Old scripts don't work with the new version!!
ResNullius replied to TinyHacker's topic in AutoIt General Help and Support
@TinyHacker What Melba23 means is all the "$ES_AUTOVSCROLL + $WS_VSCROLL + $ES_MULTILINE + $WS_EX_TOOLWINDOW" constants used to be in just a couple of includes, like GuiConstants.au3 and WindowsConstants.au3. But now, for instance, to get $ES_AUTOVSCROLL, or other $ES_xxxx constants you need to include EditConstants.au3. -
How to recognize and delete spaces
ResNullius replied to Rigest's topic in AutoIt General Help and Support
@Rigest, You need to get your copied string from the clipboard into a variable to use the StringStripWS() function on it. Send ("{DOWN}") Send ("{RIGHT}{RIGHT}") Send ("{^ DOWN}") Send ("C") Send ("{^ UP}") $sCopiedString = ClipGet() ; <<< get the clipboard contents into a variable WinWaitActive("FICRES. - Windows Internet Explorer") Sleep(100) MouseClick ( "left", 248,396) Sleep(100) MouseClick ( "left", 382,238) Sleep(100) MouseClick ( "left", 763,381) $sStrippedString = StringStripWS($sCopiedString, 1 ); <<< Strip the leading WS and store the result in another variable ClipPut($sStrippedString) ; <<< Put the stripped variable back into the clipboard ready for pasting Sleep (100) Send ("{^ DOWN}") Send ("V") Send ("{^ UP}") Having said all that, it may be better to bypass the clipboard copy/paste entirely if you can. Would you be able to use ControlGetText() and ControlSetText() instead? -
AutoIt Data Type for VB DateTime type
ResNullius replied to JerryD's topic in AutoIt General Help and Support
@JerryD, Looking at the script you linked to, the 1st use of IsNull is this Set UpdateSession = CreateObject("Microsoft.Update.Session") if IsNull(UpdateSession) then wscript.quit end if If that's the use you're wondering about, then this is simply testing for the valid creation of the Update.Session object. So AutoIt equivalent would be $oUpdateSession = ObjCreate("Microsoft.Update.Session") If Not IsObj($oUpdateSession) then exit EndIf Hope that helps. Edit: Looking at the rest of the script, IsNull is also sometimes being used as you suspected, to test whether a string is passed (as in arguements to a function). Perhaps if you post your conversion efforts and where you feel the script is failing, we can offer more insight. Edit 2: Looks like the VB Functions page you linked to is a victim of a cut and paste error for their IsNull definition. See this one instead: http://www.w3schools.com/vbscript/func_isnull.asp -
Icons don't look good.
ResNullius replied to johngreenwood's topic in AutoIt General Help and Support
@johngreenwood Check out Yashied's work here: http://www.autoitscript.com/forum/index.php?s=&showtopic=89387&view=findpost&p=642424 and here: http://www.autoitscript.com/forum/index.php?s=&showtopic=92675&view=findpost&p=666005 I think you'll find it addresses your needs. -
This is weird !!! i need help
ResNullius replied to ahmed9100's topic in AutoIt General Help and Support
Mungo, You could also make it so that you always uses @Scriptdir when referencing your inifile, as in IniWrite(@ScriptDir & "\myIniFile.ini",..... That way you never have to worry about whether you've changed the working dir or not. -
Fancy and better looking ComboBox ?
ResNullius replied to Juvigy's topic in AutoIt GUI Help and Support
Authenticity did an example of coloured text in a combo here: #717985 Might be something to get you started... -
Fancy and better looking ComboBox ?
ResNullius replied to Juvigy's topic in AutoIt GUI Help and Support
Define "better" combobox controls... What feature(s) or look are you after? -
Actually, I think we may have just uncovered a bug in StringRegExpReplace. I'll pursue it further before reporting it, but on my system, Win 7 Pro with AutoIt 3.3.6.1 when the replacement string contains a single backslash (\) it's being stripped out. So even though the script returns EnvVar("SystemRoot") as C:\Windows, the StringRegExpReplace removes the backslash turning it into C:Windows. Can you confirm the same behaviour? As a work around use this for the processing loop: For $i = 0 To UBound($aEnvVars) - 1 $sEnVar = StringReplace(EnvGet($aEnvVars[$i]), "\", "\\") $PATH = StringRegExpReplace($PATH, "(%\Q" & $aEnvVars[$i] & "\E%)", $sEnVar) Next