Jump to content

xrxca

Members
  • Posts

    19
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

xrxca's Achievements

Seeker

Seeker (1/7)

3

Reputation

  1. Actually did a fair bit of research (The rabbit-hole went straight on like a tunnel for some way, and then dipped suddenly down...) And this was my conclusion (and I rarely expect a 3rd party driver to support all features). So I just wanted to suggest that if a recordset doesn't support the ability, it shouldn't throw an error in a function like _ADO_Recordset_ToString and since it's already checking compatibility for .Bookmark it made sense to me to also check before using .MoveFirst
  2. I've got record sets triggering the following COM Error: ADO.au3 v.2.1.15 BETA (599) : ==> COM Error intercepted ! $oADO_Error.description is: Rowset position cannot be restarted. $oADO_Error.windescription: Exception occurred. $oADO_Error.number is: 80020009 $oADO_Error.lastdllerror is: 0 $oADO_Error.scriptline is: 599 $oADO_Error.source is: Microsoft OLE DB Provider for ODBC Drivers $oADO_Error.helpfile is: $oADO_Error.helpcontext is: 0 ############################### This one was triggered on a call to _ADO_Recordset_ToString, with a result from a MySQL procedure call that returns a single row status result message, but also occurs on some simple queries as well. I know exactly what the issue is, it is the $oRecordset.moveFirst() call. I'd suggest that this: If $oRecordset_Bookmark = Null Then $oRecordset.moveFirst() Else be changed to: If $oRecordset_Bookmark = Null Then If $oRecordset.Supports($ADO_adMovePrevious) Then $oRecordset.moveFirst() Else This fixes the errors on my DSN's, but I've only tested a couple different drivers. I changed all occurrences of .moveFirst in my copy of the udf (3 of them), to this format.
  3. I've run into a bug with the latest version (it may have been there in older versions I've just haven't used the toolbar control in an ISN project before.) To recreate the error, create a new temporary project. add a form to the project. add a toolbar control to the form. At this point if you test the form things are fine. Open the GUI Properties Dialog Click OK without changing anything. Now when you try testing the form you get the following error. $toolbar99 = _GUICtrlToolbar_Create($$TestForm,$TBSTYLE_FLAT,0) $toolbar99 = _GUICtrlToolbar_Create(^ ERROR Error: Badly formated variable or macro. An extra $ has been added before the form variable, the StatusBar control does the same thing. I believe the problem is in Data\Plugins\formstudio2\Includes\converter.au3 at lines 1182 and 1190 ; Line 1182 FileWriteLine($file, $IDSTRING & '_GUICtrlToolbar_Create($' & _IniReadEx($Cache_Datei_Handle, "gui", "handle", "hgui") & ',' & $genstyle & ',' & $genexstyle & ')') ; Line 1190 FileWriteLine($file, $IDSTRING & '_GUICtrlStatusBar_Create($' & _IniReadEx($Cache_Datei_Handle, "gui", "handle", "hgui") & ', -1, "",' & $genstyle & ',' & $genexstyle & ')') Line 1182 and 1190 are the only lines with a $ before the handle, my quick look indicates it should be using the handle with dollar hand back function so the lines would become: ; Line 1182 FileWriteLine($file, $IDSTRING & '_GUICtrlToolbar_Create(' & _Handle_mit_Dollar_zurueckgeben(_IniReadEx($Cache_Datei_Handle, "gui", "handle", "hgui")) & ',' & $genstyle & ',' & $genexstyle & ')') ; Line 1190 FileWriteLine($file, $IDSTRING & '_GUICtrlStatusBar_Create(' & _Handle_mit_Dollar_zurueckgeben(_IniReadEx($Cache_Datei_Handle, "gui", "handle", "hgui")) & ', -1, "",' & $genstyle & ',' & $genexstyle & ')') Maybe just removing the $ would have been enough, but I thought this would be safer, and it seems to work for me.
  4. I really believe the best way to occasionally trigger items with admin access on locked down systems is with the Task Scheduler, otherwise your left with authentication issues. It's fairly easy to trigger a task (see schdtasks.exe) local $cmdline = @SystemDir & '\schtasks.exe /run /tn "Do Sync (Task Name)"' Run($cmdline, @SystemDir, @SW_HIDE) RunWait is a different matter, the program run by the task would have to signal the waiting program in some way when it completed. (many possibilities, semaphores maybe, or just a registry or filesystem change) There other more complicated ways to trigger a task (WMI/Objects) but the simple run of schtasks.exe works for us. We have a number of tasks that do not have triggers in the task scheduler, but are triggered by autoit scripts (I'd have to revisit the scripts in question, but I seem to remember that a normal user can start a task that has admin rights, one of our scripts allowed a user to trigger a sync to a backup location, the program in the task creating a shadow volume, doing an ffsync from that. then removing the shadow, and the shadow stuff requires admin access.) (maybe the current version of ffsync has volume shadow support (not sure) but when the scripts were written it didn't)
  5. I'm doing so, I was trying to avoid it, (why re-event the wheel) After spending some time refreshing my memory with the WinAPI cursor documentation and doing some experimentation, I decided a new GUI was the far easier path. My thoughts where: generally when a splash screen is up, the program is busy, and therefore it would make sense to have the ability to change the cursor to indicate busy, and if someone had a way to do so with the existing SplashOn method that I hadn't tried or thought of I'd like to have heard about it.
  6. So is there any way to set the cursor for a Splash Screen created using SplashTextOn? I've got a fairly complicated program that has evolved over the years, it has a main GUI and in a few places calls VERY long processes so I use GUISetCursor to change the windows cursor to waiting, the problem is I use splashtexton to display progress messages, but I can't seem to change the cursor for the splash window, so if the mouse is moved into the splash window it turns back to the default pointer, not a show stopper, but seems wrong. I've tried GUISetCursor using the handle returned by SplashTextOn, and GUICtrlSetCursor on the handle returned by ControlGetHandle($Splash, "", "Static1") neither works. (Didn't really expect them too, but it was worth a try) The next step is either create a custom GUI to duplicate what splashtexton does, or go down the WINAPI Cursor rabbithole. I was hoping there was an easier way, am I missing something? (Too bad there wasn't an additional option to SplashTextOn to specify the Cursor, I mean a splash screen implies the program is busy, shouldn't the cursor agree)
  7. Yep, does the trick thank you, we've now added hot-keys where necessary and recompiled all our various utility scripts. I've thrown the double character regular expression question at our RE guru just to see what she comes up with... (when she has spare time which is a rare and precious thing theses days) (I'd have answered sooner, but spent the last two weeks at a remote client site with only satphone for communications)
  8. Didn't mean to seem nasty, Had just finished restoring backups after one of my programmers had managed to fry two days worth of work by using the space bar on the Archive instead of the (Default) Merge button in one of our maintenance scripts merging the wrong tree. We have very good backups so were able to get back to an hour before the error so not life and death, and yes the script could have extra prompts, but it hasn't come up before, She has a broken wrist and is doing everything mouseless at the moment, was waiting by my office door in an absolute panic because she'd discovered what she'd done and was positive she'd hit the right button, and she also pointed out that there were no hot keys in our dialogs so we tried to add them... Thank you for the default button being selected change, the Tab once to get to it was what was driving me nuts on other stuff, and the above brought things to a head. I'm pretty sure that with this change, the entire space bar thing is moot. As windows will fire a selected button automatically when the space bar is pressed. (I remmed out the hotkey code and it works as expected (and the 128 didn't (no dialog at all)) I like the @ (I'd already made the change but using "~"), the only comment I would make is could @@ display as a single @ sign instead of being interpreted as the default flag, it complicates the regular expressions and some of the button creation code, but not an awful lot. So you could have "&Print|@&Email to joe@@add.r|&Cancel" being able to handle "@@King|@Joe" and "@@@Hello|Joe" would be the complicated part. Did you mean "never" or "ever" in #4? Most our scripts don't use an icon so I only noticed it when testing. This is what I get. This is on a clean Win10 with only the latest v3.3.14.0 AutoIt installed, and three files, ExtMsgBox_Mod.au3, StringSize.au3, and Junk1.au3 (test script) The Code in Junk1.au3 was: #include "ExtMsgBox_Mod.au3" $Result = _ExtMsgBox(64, '&Yes|@Can&dy|&Cancel', 'Example', 'Text NOT Centered On Icon') ConsoleWrite('Result: ' & $Result & @CRLF)
  9. So close, so close, but I ran into a couple issue that have been driving me nuts on the odd project. The Space handling you do seems to break windows standards, in the normal course of events, if a button has the focus and you press space it activates that button, in your dialog, if you set the first button as the default then use tab to switch to the second button and then press space you still get a return code of one which is wrong and very dangerous. An addition to that item is the fact that you have to press the tab once to GET to the default button, the first press of the tab only goes to the first button (even if that is the default) then you have to press it again to get the next button. Should the default button not have the focus when the dialog is opened? Why on earth did you break standard shortcut key handling by re-purposing the & (which has been a windows standard since the late '80s, even VBDos used it) (Stick an ampersand in the caption and instant keyboard shortcut, I use it in autoit all the time) Am I missing something or should it not vertically center a single line of text with the icon (or maybe it's the icon that should be moving), in all my tests the latest version didn't, but I had thought an older version did?
  10. Minor bug, the handling of the bIsHTMLBody variable is reversed:     ; Select whether or not the content is sent as plain text or HTM     If $bIsHTMLBody Then         $objEmail.Textbody = $s_Body & @CRLF     Else         $objEmail.HTMLBody = $s_Body     EndIf Should that not be:     ; Select whether or not the content is sent as plain text or HTM     If $bIsHTMLBody Then $objEmail.HTMLBody = $s_Body     Else $objEmail.Textbody = $s_Body & @CRLF     EndIf
  11. I won't do this for the simple fact that not everyone will use this for files, they could use it for data or something similar and I want to give a lot of control to the end user. I can sort of see your point, but I fail to come up with a situation where you'd want two identical menu entries for a "recent" list. The other thing that is extremely important IMO is that an item opened either from the recent menu or via another method should be moved to the top of the recent items list, so just not adding if it's already there isn't enough, the item needs to be either added to the top with the bottom item popped off, or moved to the top if it already exists... I was starting work on code to store and manage a recent files list in the registry when I figured I'd check to see if I was reinventing the wheel, I guess I'll continue as I think I prefer the recent items right in the File menu (like SciTE does it) rather than a sub menu.
  12. Great UDF, much easier than a custom GUI for every odd messagebox, I have a couple of minor suggestions. The ability to change the message font/size, but leave the buttons the default font. I'm using a script that displays a Well UWI and ask the user to confirm the change, and for clarity I specify a larger fixed width font for the UWI which looks rather silly on the buttons. (I modified my copy by adding an extra Global var and an option to _ExtMsgBoxSet and changing the GUISetFont call accordingly) Adjust the button size if the button text will not fit (this can be a real problem if the font has been changed) The ability to specify a custom icon (Maybe pass an icon filename/iconid instead of the icon flag# ?) Be a little more forgiving on message text width, One of the messages my script used includes a variable length id with no spaces in it and on occasion is slightly too long and _ExtMsgBox throws an error 5 because the call to _StringSize returned error 4 I've modified my copy to increase the width in increments of 50 up to a max of 500 if this happens. Local $aLabel_Pos = _StringSize($sText, $iEMB_Font_Size, Default, Default, $sEMB_Font_Name, $iMsg_Width_max - 20 - $iIcon_Reduction) while ( @error == 4 ) and ( $iMsg_Width_max < 500 ) $iMsg_Width_max += 50 $aLabel_Pos = _StringSize($sText, $iEMB_Font_Size, Default, Default, $sEMB_Font_Name, $iMsg_Width_max - 20 - $iIcon_Reduction) wend if @error then $nOldOpt = Opt('GUIOnEventMode', $nOldOpt) Return SetError(5, 0, -1) endifNot the cleanest solution, but it works for me.
  13. I use enumdisplaymonitors for this purpose, (I have a number of scripts to start apps on specific monitors, or on the monitor the mouse is on (from toolbars or other apps tool menus etc.)) here is the MultiMon.au3 I wrote and am currently using (could have a whole bunch more capability, but does what i need it to, the one thing I keep meaning to add is a custom MsgBox that I can place on a specific monitor) It all seems to still work, (I just cleaned up the code a bit, added some minimal info above each function and renamed a bunch of variables ($t1, $t2, $h etc just doesn't cut it if someone else is looking at the code ) #include-Once Global $__MonitorList[1][5] $__MonitorList[0][0] = 0 ; Just for testing _ShowMonitorInfo() ;================================================================================================== ; Function Name: _ShowMonitorInfo() ; Description:: Show the info in $__MonitorList in a msgbox (line 0 is entire screen) ; Parameter(s): n/a ; Return Value(s): n/a ; Author(s): xrxca ([email protected]) ;================================================================================================== Func _ShowMonitorInfo() If $__MonitorList[0][0] == 0 Then _GetMonitors() EndIf Local $Msg = "" Local $i = 0 For $i = 0 To $__MonitorList[0][0] $Msg &= $i & " - L:" & $__MonitorList[$i][1] & ", T:" & $__MonitorList[$i][2] $Msg &= ", R:" & $__MonitorList[$i][3] & ", B:" & $__MonitorList[$i][4] If $i < $__MonitorList[0][0] Then $Msg &= @CRLF Next MsgBox(0, $__MonitorList[0][0] & " Monitors: ", $Msg) EndFunc ;==>_ShowMonitorInfo ;================================================================================================== ; Function Name: _MaxOnMonitor($Title[, $Text = ''[, $Monitor = -1]]) ; Description:: Maximize a window on a specific monitor (or the monitor the mouse is on) ; Parameter(s): $Title The title of the window to Move/Maximize ; optional: $Text The text of the window to Move/Maximize ; optional: $Monitor The monitor to move to (1..NumMonitors) defaults to monitor mouse is on ; Note: Should probably have specified return/error codes but haven't put them in yet ; Author(s): xrxca ([email protected]) ;================================================================================================== Func _MaxOnMonitor($Title, $Text = '', $Monitor = -1) _CenterOnMonitor($Title, $Text, $Monitor) WinSetState($Title, $Text, @SW_MAXIMIZE) EndFunc ;==>_MaxOnMonitor ;================================================================================================== ; Function Name: _CenterOnMonitor($Title[, $Text = ''[, $Monitor = -1]]) ; Description:: Center a window on a specific monitor (or the monitor the mouse is on) ; Parameter(s): $Title The title of the window to Move/Maximize ; optional: $Text The text of the window to Move/Maximize ; optional: $Monitor The monitor to move to (1..NumMonitors) defaults to monitor mouse is on ; Note: Should probably have specified return/error codes but haven't put them in yet ; Author(s): xrxca ([email protected]) ;================================================================================================== Func _CenterOnMonitor($Title, $Text = '', $Monitor = -1) $hWindow = WinGetHandle($Title, $Text) If Not @error Then If $Monitor == -1 Then $Monitor = _GetMonitorFromPoint() ElseIf $__MonitorList[0][0] == 0 Then _GetMonitors() EndIf If ($Monitor > 0) And ($Monitor <= $__MonitorList[0][0]) Then ; Restore the window if necessary Local $WinState = WinGetState($hWindow) If BitAND($WinState, 16) Or BitAND($WinState, 32) Then WinSetState($hWindow, '', @SW_RESTORE) EndIf Local $WinSize = WinGetPos($hWindow) Local $x = Int(($__MonitorList[$Monitor][3] - $__MonitorList[$Monitor][1] - $WinSize[2]) / 2) + $__MonitorList[$Monitor][1] Local $y = Int(($__MonitorList[$Monitor][4] - $__MonitorList[$Monitor][2] - $WinSize[3]) / 2) + $__MonitorList[$Monitor][2] WinMove($hWindow, '', $x, $y) EndIf EndIf EndFunc ;==>_CenterOnMonitor ;================================================================================================== ; Function Name: _GetMonitorFromPoint([$XorPoint = -654321[, $Y = 0]]) ; Description:: Get a monitor number from an x/y pos or the current mouse position ; Parameter(s): ; optional: $XorPoint X Position or Array with X/Y as items 0,1 (ie from MouseGetPos()) ; optional: $Y Y Position ; Note: Should probably have specified return/error codes but haven't put them in yet, ; and better checking should be done on passed variables. ; Used to use MonitorFromPoint DLL call, but it didn't seem to always work. ; Author(s): xrxca ([email protected]) ;================================================================================================== Func _GetMonitorFromPoint($XorPoint = 0, $y = 0) If @NumParams = 0 then local $MousePos = MouseGetPos() Local $myX = $MousePos[0] Local $myY = $MousePos[1] Elseif ( @NumParams = 1 ) and IsArray($XorPoint) Then Local $myX = $XorPoint[0] Local $myY = $XorPoint[1] Else Local $myX = $XorPoint Local $myY = $y EndIf If $__MonitorList[0][0] == 0 Then _GetMonitors() EndIf Local $i = 0 Local $Monitor = 0 For $i = 1 To $__MonitorList[0][0] If ($myX >= $__MonitorList[$i][1]) _ And ($myX < $__MonitorList[$i][3]) _ And ($myY >= $__MonitorList[$i][2]) _ And ($myY < $__MonitorList[$i][4]) Then $Monitor = $i Next Return $Monitor EndFunc ;==>_GetMonitorFromPoint ;================================================================================================== ; Function Name: _GetMonitors() ; Description:: Load monitor positions ; Parameter(s): n/a ; Return Value(s): 2D Array of Monitors ; [0][0] = Number of Monitors ; [i][0] = HMONITOR handle of this monitor. ; [i][1] = Left Position of Monitor ; [i][2] = Top Position of Monitor ; [i][3] = Right Position of Monitor ; [i][4] = Bottom Position of Monitor ; Note: [0][1..4] are set to Left,Top,Right,Bottom of entire screen ; hMonitor is returned in [i][0], but no longer used by these routines. ; Also sets $__MonitorList global variable (for other subs to use) ; Author(s): xrxca ([email protected]) ;================================================================================================== Func _GetMonitors() $__MonitorList[0][0] = 0 ; Added so that the global array is reset if this is called multiple times Local $handle = DllCallbackRegister("_MonitorEnumProc", "int", "hwnd;hwnd;ptr;lparam") DllCall("user32.dll", "int", "EnumDisplayMonitors", "hwnd", 0, "ptr", 0, "ptr", DllCallbackGetPtr($handle), "lparam", 0) DllCallbackFree($handle) Local $i = 0 For $i = 1 To $__MonitorList[0][0] If $__MonitorList[$i][1] < $__MonitorList[0][1] Then $__MonitorList[0][1] = $__MonitorList[$i][1] If $__MonitorList[$i][2] < $__MonitorList[0][2] Then $__MonitorList[0][2] = $__MonitorList[$i][2] If $__MonitorList[$i][3] > $__MonitorList[0][3] Then $__MonitorList[0][3] = $__MonitorList[$i][3] If $__MonitorList[$i][4] > $__MonitorList[0][4] Then $__MonitorList[0][4] = $__MonitorList[$i][4] Next Return $__MonitorList EndFunc ;==>_GetMonitors ;================================================================================================== ; Function Name: _MonitorEnumProc($hMonitor, $hDC, $lRect, $lParam) ; Description:: Enum Callback Function for EnumDisplayMonitors in _GetMonitors ; Author(s): xrxca ([email protected]) ;================================================================================================== Func _MonitorEnumProc($hMonitor, $hDC, $lRect, $lParam) Local $Rect = DllStructCreate("int left;int top;int right;int bottom", $lRect) $__MonitorList[0][0] += 1 ReDim $__MonitorList[$__MonitorList[0][0] + 1][5] $__MonitorList[$__MonitorList[0][0]][0] = $hMonitor $__MonitorList[$__MonitorList[0][0]][1] = DllStructGetData($Rect, "left") $__MonitorList[$__MonitorList[0][0]][2] = DllStructGetData($Rect, "top") $__MonitorList[$__MonitorList[0][0]][3] = DllStructGetData($Rect, "right") $__MonitorList[$__MonitorList[0][0]][4] = DllStructGetData($Rect, "bottom") Return 1 ; Return 1 to continue enumeration EndFunc ;==>_MonitorEnumProc Edited Jan 8, 2009 to correct minor bug in _GetMonitors routine (Pointed out by Cusem).
  14. Of course one could always look at this from the point of view that if (when) the program gets cracked it's a pretty good indicator that the program is popular, and depending on your target user base, a high enough adoption rate should include enough 'honest' users. I had a shareware app specific to Win9X out a few years ago and for a while I was putting out regular updates just to counter that latest crack, I reached the point that it wasn't worth the effort, I was getting regular registrations and didn't see a change up or down when I defeated a crack for a couple months. That silly little program I'd originally written for my own use ended up covering the down payment on my current house.
×
×
  • Create New...