Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 11/17/2020 in all areas

  1. Melba23

    Calendar only on first tab

    GokAy, I do recommend reading all the tutorials I wrote thoroughly - there are often some other hints hidden within them as a bonus for attentive readers. M23
    2 points
  2. Nine is correct. Try: $Specific_Numers = Number(StringRegExp($Specific, '\d+(?:,\d+)?', 1)) btw, @Siwa, it could have been much worse; had the TotalNumbers been 396 instead of 196, the loop would have ended, and the bug might not have been detected right away...
    2 points
  3. Might be because, you are comparing string with number
    2 points
  4. jguinch

    Printers Management UDF

    Hello. I did create these few functions several months ago. I post here, if it can interest someone. These functions based on WMI queries allow you to manage printers : add / delete printer, driver, port, or obtain configuration, set default printer ... I let you discover it with the code. Here is the list of the available functions : _PrintMgr_AddLocalPort _PrintMgr_AddLPRPort _PrintMgr_AddPrinter _PrintMgr_AddPrinterDriver _PrintMgr_AddTCPIPPrinterPort _PrintMgr_AddWindowsPrinterConnection _PrintMgr_CancelAllJobs _PrintMgr_CancelPrintJob _PrintMgr_EnumPorts _PrintMgr_EnumPrinter _PrintMgr_EnumPrinterConfiguration _PrintMgr_EnumPrinterDriver _PrintMgr_EnumPrinterProperties _PrintMgr_EnumPrintJobs _PrintMgr_EnumTCPIPPrinterPort _PrintMgr_Pause _PrintMgr_PortExists _PrintMgr_PrinterExists _PrintMgr_PrinterSetComment _PrintMgr_PrinterSetDriver _PrintMgr_PrinterSetPort _PrintMgr_PrinterShare _PrintMgr_PrintTestPage _PrintMgr_RemoveLocalPort _PrintMgr_RemoveLPRPort _PrintMgr_RemovePrinter _PrintMgr_RemovePrinterDriver _PrintMgr_RemoveTCPIPPrinterPort _PrintMgr_RenamePrinter _PrintMgr_Resume _PrintMgr_SetDefaultPrinter And some examples : #include <Array.au3> #include "PrintMgr.au3" _Example() Func _Example() ; Remove a printer called "My old Lexmark printer" : _PrintMgr_RemovePrinter("My old Lexmark printer") ; Remove the driver called "Lexmark T640" : _PrintMgr_RemovePrinterDriver("Lexmark T640") ; Remove the TCP/IP printer port called "TCP/IP" _PrintMgr_RemoveTCPIPPrinterPort("MyOLDPrinterPort") ; Add a driver, called "Samsung ML-451x 501x Series", and driver inf file is ".\Samsung5010\sse2m.inf" _PrintMgr_AddPrinterDriver("Samsung ML-451x 501x Series", "Windows NT x86", @ScriptDir & "\Samsung5010", @ScriptDir & "\Samsung5010\sse2m.inf") ; Add a TCP/IP printer port, called "MyTCPIPPrinterPort", with IPAddress = 192.168.1.10 and Port = 9100 _PrintMgr_AddTCPIPPrinterPort("MyTCPIPPrinterPort", "192.168.1.10", 9100) ; Add a printer, give it the name "My Printer", use the driver called "Samsung ML-451x 501x Series" and the port called "MyTCPIPPrinterPort" _PrintMgr_AddPrinter("My Printer", "Samsung ML-451x 501x Series", "MyTCPIPPrinterPort") ; Set the printer called "My Printer" as default printer _PrintMgr_SetDefaultPrinter("My Printer") ; Connect to the shared printer "\\192.168.1.1\HPDeskjetColor") _PrintMgr_AddWindowsPrinterConnection("\\192.168.1.1\HPDeskjetColor") ; List all installed printers Local $aPrinterList = _PrintMgr_EnumPrinter() _ArrayDisplay($aPrinterList) ; List all printers configuration Local $aPrinterConfig = _PrintMgr_EnumPrinterConfiguration() _ArrayDisplay($aPrinterConfig) ; List all installed printer drivers Local $aDriverList = _PrintMgr_EnumPrinterDriver() _ArrayDisplay($aDriverList) ; Retrieve the printer configuration for the printer called "Lexmark T640" $aPrinterConfig = _PrintMgr_EnumPrinterConfiguration("Lexmark T640") _ArrayDisplay($aPrinterConfig) ; Add a local printer port (for a file output) _PrintMgr_AddLocalPort("c:\temp\output.pcl") ; Remove the local port _PrintMgr_RemoveLocalPort("c:\temp\output.pcl") ; Enum a print job Local $aJobList = _PrintMgr_EnumPrintJobs() _ArrayDisplay($aJobList) EndFunc ;==>_Example Download link : PrintMgr_Example.au3 PrintMgr.au3
    1 point
  5. @maniootek : well, I thought about it but didn't really know how. Here is a new version (-see first message- ). Please, give me your advice PrintMgr.au3
    1 point
  6. Also this works, after checking out (not reading throughly) the tab wiki @Melba23 linked Edit: Notice that I pulled MonthCal creation outside the loop, since it is not tied to the tab Edit2: and also forgot the Window Style I tried earlier in there. Fixed according to the original post. #include <GUIConstantsEx.au3> #include <GuiMonthCal.au3> #include <WindowsConstants.au3> test_gui() func test_gui() Local $hGUI = GUICreate("Built-In Tab Example", 500, 500) Local $hTab = GUICtrlCreateTab(10, 10, 480, 480) Local $g_hMonthCal = _GUICtrlMonthCal_Create($hGUI, 20, 200, $WS_BORDER) ; Create tabitems For $i = 0 To 2 GUICtrlCreateTabItem("Tab " & $i) GUICtrlCreateButton("Button " & $i, 20 + ($i * 100), 40 + ($i * 50), 80, 30) Next ; Close Tab definiton GUICtrlCreateTabItem("") GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $hTab ConsoleWrite($hTab & " > " & GUICtrlRead($hTab) & @crlf) if GUICtrlRead($hTab) = 0 then ControlShow($hGUI,"",$g_hMonthCal) else ControlHide($hGUI,"",$g_hMonthCal) endif EndSwitch WEnd EndFunc
    1 point
  7. Alright here another way : #include <GUIConstantsEx.au3> #include <GuiMonthCal.au3> #include <WindowsConstants.au3> #include <WinAPIGdi.au3> #include <WinAPISysWin.au3> $hGUI = GUICreate("Built-In Tab Example", 500, 500) $hTab = GUICtrlCreateTab(10, 10, 480, 480) ; Create tabitems For $i = 0 To 2 GUICtrlCreateTabItem("Tab " & $i) If $i = 0 Then ;If this is the first tab insert the calendar Global $g_hMonthCal = _GUICtrlMonthCal_Create($hGUI, 20, 200, $WS_BORDER) EndIf GUICtrlCreateButton("Button " & $i, 20 + ($i * 100), 40 + ($i * 50), 80, 30) Next ; Close Tab definiton GUICtrlCreateTabItem("") GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $hTab If GUICtrlRead($hTab) = 0 Then _WinAPI_ShowWindow ($g_hMonthCal, @SW_SHOW) Else _WinAPI_ShowWindow ($g_hMonthCal, @SW_HIDE) EndIf EndSwitch WEnd Should work better
    1 point
  8. polarole

    UI Automation UDFs

    hi, it works now. thanks for helping. i also started working through the axamples they are very helpfull.
    1 point
  9. Actually, @Nine is the one that first mentioned it, and @JockoDundee gave the function.
    1 point
  10. To be honest, I hadn't even noticed the hidden console output. Reviewing @Siwa's code I see that he is performing StringRegExp on something he is saying is a number. Clearly the value he is working with is actually a string. This then implies that, probably, both his variables are strings and of course "196" is LOWER than "3" in a string comparison. @Siwa You need to perform a Number() conversion on one or both of the variables in your comparison expression. Only one is actually necessary as the other one will be converted by implication. Here is the corrected code. Note I have left in the ">=" rather than ">". Until Number($Total_Numbers) >= $Specific_Numers[0]
    1 point
  11. Yeah, Maybe Number() would be enough, need it to be an integer though. Example would be: 2 NO-OVERWRITE Global $g_bGUI_MODE = True if $CmdLine[0] = 0 Then ; Script started by User (no params needed) ; $g_iSampleCopies ; $g_sCopyMethod Elseif $CmdLine[0] = 2 Then ; Script started by Excel (params required) $g_iSampleCopies = Int($CmdLine[1], $NUMBER_32BIT) $g_sCopyMethod = $CmdLine[2] ; Check if $g_iSampleCopies is an integer, terminate if not, then terminate if less than 1 if not IsInt($g_iSampleCopies) then Exit if $g_iSampleCopies < 1 then Exit ; Check if $g_sCopyMethod is a valid parameter, terminate if not if StringInStr("DELETE OVERWRITE NO-OVERWRITE", $g_sCopyMethod) = 0 then Exit ; If all params are correct then set GUI_Mode = False $g_bGUI_MODE = False Else ; Wrong number of params, abort!!! Exit EndIf
    1 point
  12. Thanks to @jpm this feature request is completed. https://www.autoitscript.com/trac/autoit/ticket/2443#comment:3 The only one thing to do is to wait for @Jon when he will have spare time to take a look at this. Do not ask when, just wait, we all are here volonteers.
    1 point
  13. What is your point? Yes, that is exactly how AutoIt works. However, @Siwaalready told us that his variable $Total_Numbers is a number when he defined it in his pseudocode;- "Total numbers =... ;Some java query which returns a number, I included the console." It then follows that the other side of his expression will be automatically "Number() converted, as defined in AutoIt help. So, unless he is actually comparing strings (and we don't know that because we haven't seen all his code) his expression may fail without ">=".
    1 point
  14. 1 point
  15. Hey all, I did face an issue when a number was passed to a script as an argument, it would fail to interpret as a number, and had to convert to a number explicitly. Maybe something I did wrong, idk. (Just an AutoIt nooby after all )
    1 point
  16. Disagree. Here, then: Local $iNumber $iNumber=50 ConsoleWrite("iNumber=50" &@CRLF) If IsNumber($iNumber) Then ConsoleWrite("Its a Number" &@CRLF) Else ConsoleWrite("Its Not a Number" &@CRLF) EndIf If IsString($iNumber) Then ConsoleWrite("Its a String" &@CRLF) Else ConsoleWrite("Its not a String" &@CRLF) EndIf ConsoleWrite(@CRLF) $iNumber="50" ConsoleWrite("iNumber=""50""" &@CRLF) If IsNumber($iNumber) Then ConsoleWrite("Its a Number" &@CRLF) Else ConsoleWrite("Its Not a Number" &@CRLF) EndIf If IsString($iNumber) Then ConsoleWrite("Its a String" &@CRLF) Else ConsoleWrite("Its not a String" &@CRLF) EndIf iNumber=50 Its a Number Its not a String iNumber="50" Its Not a Number Its a String
    1 point
  17. From the help; "In AutoIt there is only one datatype called a Variant. if you try and multiply two variants they will be treated as numbers. If a string is used as a number, an implicit call to Number() function is done. So if it doesn't contain a valid number, it will be assumed to equal 0." In @Siwa's expression, $Total_Numbers has already been assigned a numeric value therefore $Specific_Numers will be automatically assigned a numeric value. Therefore, this isn't his issue.
    1 point
  18. Also, I suspect that $Specific_Numers is a typo and you actually meant to type $Specific_Numbers. I recommend you fix this to avoid confusion and mysterious bugs in the future.
    1 point
  19. Or... Perhaps $Total_Numbers is never greater than $SpecificNumers[0]. Perhaps your expression should be >= rather than > Until $Total_Numbers >= $Specific_Numers[0]
    1 point
  20. First one. Oh and no I really am not a drummer. Just played GuitarHero drums, and now Clone Hero. People see the e-drum kit at my house and ask if I play the drums. I have to explain each time. Even harder in English as you "play" the drums in a game, and "play" an instrument. So I tell them, "Don't call me a drummer, as I am not, even if I were, I would be the lazy kind". 😛
    1 point
  21. I tried to hack your code and failed miserably I desire to have the combo display the number of items selected other than the default comma-delimited list of selected items. How can I achieve this?
    1 point
×
×
  • Create New...