Leaderboard
Popular Content
Showing content with the highest reputation on 06/15/2016 in all areas
-
Mbee, Glad you like it - as I said, I tend to avoid the Timer UDF as much as possible as I have always had trouble with it. As shown in the Help file examples, you should use the function name as a literal string. However, in many cases where this is needed, it is also permissible to use the function as a first-class object - to do which you use the function name without quotes or trailing parentheses. In fact if you remove the quotes around the function name in the script I posted above you will see that it still functions. The only advantage of which I am aware for using objects rather then literal strings is that Au3Stripper finds the line easier to digest - but no doubt there are others. M232 points
-
|| is the standard SQL string concatenation operator. The goal is to obtain directly a string suitable for insertion into a listview control (i.e. fields separated by |). But of course MS doesn't do thing everybody else does.1 point
-
At home, sitting at desk. But you should to know: thinking does not hurt, ........ .......... but it takes time.1 point
-
https://msdn.microsoft.com/en-us/library/ms675532(v=vs.85).aspx https://msdn.microsoft.com/en-us/library/ms676975(v=vs.85).aspx https://www.autoitscript.com/autoit3/docs/ btw. look also here: and here:1 point
-
Try this: #include <GUIConstants.au3> #include <MsgBoxConstants.au3> #include <Array.au3> Global $oErrorHandler = ObjEvent("AutoIt.Error", "_ErrFunc") Example() Func Example() Local $dbname = FileOpenDialog("Choose Access Database", @ScriptDir, "Access files (*.accdb)", 1) $adoCon = ObjCreate("ADODB.Connection") $adoCon.Open("Driver={Microsoft Access Driver (*.mdb, *.accdb)}; DBQ=" & $dbname & ";Uid=;Pwd=;") $adoRs = ObjCreate("ADODB.Recordset") GUICreate("listview items", 550, 250, 100, 200, -1, $WS_EX_ACCEPTFILES) Local $idListview = GUICtrlCreateListView("Codigo |Nome |Valor ", 10, 10, 520, 150) ;,$LVS_SORTDESCENDING $query = 'SELECT "codigo" , "nome" , "valor" FROM Produtos1 WHERE codigo < 10' Local $sResult = '' With $adoRs .CursorType = 2 .LockType = 3 .Open($query, $adoCon) If @error Then ; deal with Probable SQL error Return SetError(1) EndIf If Not .EOF Then $sResult = .GetString(2, -1, '|', '~?~') .Close() EndWith $adoRs = 0 Local $aResult = StringSplit($sResult, '~?~', $STR_ENTIRESPLIT + $STR_NOCOUNT) For $iRow_idx = 0 To UBound($aResult) - 1 GUICtrlCreateListViewItem($aResult[$iRow_idx], $idListview) Next $adoCon.Close GUISetState() ; Loop until the user exits. While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop ;~ Case $idButton ;~ MsgBox($MB_SYSTEMMODAL, "listview item", GUICtrlRead(GUICtrlRead($idListview)), 2) Case $idListview MsgBox($MB_SYSTEMMODAL, "listview", "clicked=" & GUICtrlGetState($idListview), 2) EndSwitch WEnd EndFunc ;==>Example ; User's COM error function. Will be called if COM error occurs Func _ErrFunc($oError) ; Do anything here. ConsoleWrite(@ScriptName & " (" & $oError.scriptline & ") : ==> COM Error intercepted !" & @CRLF & _ @TAB & "err.number is: " & @TAB & @TAB & "0x" & Hex($oError.number) & @CRLF & _ @TAB & "err.windescription:" & @TAB & $oError.windescription & @CRLF & _ @TAB & "err.description is: " & @TAB & $oError.description & @CRLF & _ @TAB & "err.source is: " & @TAB & @TAB & $oError.source & @CRLF & _ @TAB & "err.helpfile is: " & @TAB & $oError.helpfile & @CRLF & _ @TAB & "err.helpcontext is: " & @TAB & $oError.helpcontext & @CRLF & _ @TAB & "err.lastdllerror is: " & @TAB & $oError.lastdllerror & @CRLF & _ @TAB & "err.scriptline is: " & @TAB & $oError.scriptline & @CRLF & _ @TAB & "err.retcode is: " & @TAB & "0x" & Hex($oError.retcode) & @CRLF & @CRLF) EndFunc ;==>_ErrFunc1 point
-
I'm reminded of a(n) (allegedly) good old opsec story where a new computer system was installed at a Doctors office that would time-out, as designed, but undesirably by the users. Their solution? Insert and pen cap into the keyboard so it contiunually presses a key (ctrl for example) and keeps he computer alive. If you leave paper in there does it prevent it from going to sleep? Me thinks a piece of tape is in your future, or just leave a piece of paper in it when you're done. I must caution....the lamp turns off for a good reason. Leaving it on all the time will substantially reduce the lifetime of the scanner. Be prepared to replace the scanner hardware more frequently and have a backup.1 point
-
1 point
-
Mbee, Rather than get involved in the complexity of the _Timer UDF, I tend to use Adlib to hide labels after a short period of visibility - this example shows for 2 secs every 10 secs: #include <GUIConstantsEx.au3> Opt("GUIOnEventMode", 1) $hGUI = GUICreate("Test", 500, 500) GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") $cLabel = GUICtrlCreateLabel("", 10, 10, 200, 200) GUICtrlSetBkColor($cLabel, 0xFFCCCC) GUICtrlSetState($cLabel, $GUI_HIDE) GUISetState() $nBegin = TimerInit() While 1 Sleep(10) If TimerDiff($nBegin) > 10 * 1000 Then GUICtrlSetData($cLabel, "Initiated at " & @SEC) GUICtrlSetState($cLabel, $GUI_SHOW) AdlibRegister("_Hide_Label", 2000) $nBegin = TimerInit() EndIf WEnd Func _Hide_Label() AdlibUnRegister("_Hide_Label") GUICtrlSetState($cLabel, $GUI_HIDE) EndFunc Func _Exit() Exit EndFunc I think the code is self-explanatory, but please ask if you have any questions. M231 point
-
@wisem2540, the manual (page 202) says you can set the waiting time for "power saving mode" as high as 235 minutes (nearly 4 hours). surely that should be sufficient? also, you can also completely disable "power off" (different feature, same page). that depends on what exactly is bothering you. P.S. the reason i'm exploring the formal approach is that any non-formal approach would involve some sort of a hack to the device manager or driver - best avoided.1 point
-
Using function _GUICtrlListView_ClickItem in C# with AutoIt Library
LuuQuangICT reacted to BrewManNH for a topic
You can't use UDF functions with the DLL, only the native ones included in it. If you REALLY want to use _GUICtrlListView_ClickItem, open the GUIListView.au3 file, find the function and see how it is done in there. Just be aware, that function uses MouseClicks.1 point -
Yuljup, I see now - just add the $WS_MINIMIZEBOX & $WS_SYSMENU styles and you will find that the taskbar icon will also minimize/restore on clicking. M231 point