Jump to content

Search the Community

Showing results for tags 'msgbox'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

  1. Hi, I would like to create an message box with disabled buttons for specified amount of time after that period the buttons should be automatically enabled. Example code (but not working as desired): MsgBox(64, 'Sometitle', 'Please make sure to read this' & @CRLF & 'Are you sure want to continue ?') Sleep(5000) I'm wondering If such a thing could be achieved Waiting for your thoughts, thank you!
  2. Hello, it's quite often, that someone asks how to change the texts of the MsgBox buttons or the InputBox buttons or how to change the position of ta MsgBox. Since years I use CBT hooks for that, but now I made a small UDF out of it for the ease of use. Of course you can build your own GUI or use already existing UDFs to do the same, but I like this way and you can hack (hook) the inbuild InputBox. HookDlgBox.au3 #include-once #include <WinAPI.au3> Global Const $tagCBT_CREATEWND = "ptr lpcs;HWND tagCBT_CREATEWND" Global Const $tagCREATESTRUCT = "ptr lpCreateParams;handle hInstance;HWND hMenu;HWND hwndParent;int cy;int cx;int y;int x;LONG style;ptr lpszName;ptr lpszClass;DWORD dwExStyle" Global $g__hProcDlgBox = DllCallbackRegister("__DlgBox_CbtHookProc", "LRESULT", "int;WPARAM;LPARAM") Global $g__TIdDlgBox = _WinAPI_GetCurrentThreadId() Global $g__hHookDlgBox = _WinAPI_SetWindowsHookEx($WH_CBT, DllCallbackGetPtr($g__hProcDlgBox), 0, $g__TIdDlgBox) Global Const $g__MaxDlgBtns = 5 ; maximum of 5 buttons to rename text Global Const $g__MaxDlgItemId = 11 ; maximun ID of buttons to search is 11 as this is the maximun used in Messagebox Global $g__DlgBoxPosX, $g__DlgBoxPosY, $g__DlgBoxWidth, $g__DlgBoxHeight Global $g__aDlgBoxBtnText[$g__MaxDlgBtns] Global $g__DlgBtnCount = 0 _DlgBox_SetDefaults() OnAutoItExitRegister("__DlgBox_UnregisterHook") Func _DlgBox_SetButtonNames($TxtBtn1 = Default, $TxtBtn2 = Default, $TxtBtn3 = Default, $TxtBtn4 = Default, $TxtBtn5 = Default) $g__aDlgBoxBtnText[0] = $TxtBtn1 $g__aDlgBoxBtnText[1] = $TxtBtn2 $g__aDlgBoxBtnText[2] = $TxtBtn3 $g__aDlgBoxBtnText[3] = $TxtBtn4 $g__aDlgBoxBtnText[4] = $TxtBtn5 $g__DlgBtnCount = @NumParams EndFunc ;==>_DlgBox_SetButtonNames Func _DlgBox_SetPosition($x = Default, $y = Default) ;only for MsgBox, not working and not needed for InputBox $g__DlgBoxPosX = $x $g__DlgBoxPosY = $y EndFunc ;==>_DlgBox_SetPosition Func _DlgBox_SetSize($w = Default, $h = Default) $g__DlgBoxWidth = $w $g__DlgBoxHeight = $h EndFunc ;==>_DlgBox_SetSize Func _DlgBox_SetDefaults() $g__DlgBoxPosX = Default $g__DlgBoxPosY = Default $g__DlgBoxWidth = Default $g__DlgBoxHeight = Default For $i = 0 To UBound($g__aDlgBoxBtnText) - 1 $g__aDlgBoxBtnText[$i] = Default Next EndFunc ;==>_DlgBox_SetDefaults Func __DlgBox_CbtHookProc($nCode, $wParam, $lParam) Local $tcw, $tcs Local $iSearch = 0 Local $ahBtn[$g__DlgBtnCount] If $nCode < 0 Then Return _WinAPI_CallNextHookEx($g__hHookDlgBox, $nCode, $wParam, $lParam) EndIf Switch $nCode Case 3 ;5=HCBT_CREATEWND If _WinAPI_GetClassName(HWnd($wParam)) = "#32770" Then ;Dialog window class $tcw = DllStructCreate($tagCBT_CREATEWND, $lParam) $tcs = DllStructCreate($tagCREATESTRUCT, DllStructGetData($tcw, "lpcs")) If $g__DlgBoxPosX <> Default Then DllStructSetData($tcs, "x", $g__DlgBoxPosX) If $g__DlgBoxPosY <> Default Then DllStructSetData($tcs, "y", $g__DlgBoxPosY) If $g__DlgBoxWidth <> Default Then DllStructSetData($tcs, "cx", $g__DlgBoxWidth) If $g__DlgBoxHeight <> Default Then DllStructSetData($tcs, "cy", $g__DlgBoxHeight) EndIf Case 5 ;5=HCBT_ACTIVATE If _WinAPI_GetClassName(HWnd($wParam)) = "#32770" Then ;Dialog window class For $i = 1 To $g__MaxDlgItemId If IsHWnd(_WinAPI_GetDlgItem($wParam, $i)) Then If $g__aDlgBoxBtnText[$iSearch] <> Default Then _WinAPI_SetDlgItemText($wParam, $i, $g__aDlgBoxBtnText[$iSearch]) $iSearch += 1 If $iSearch >= UBound($ahBtn) Then ExitLoop EndIf Next EndIf EndSwitch Return _WinAPI_CallNextHookEx($g__hHookDlgBox, $nCode, $wParam, $lParam) EndFunc ;==>__DlgBox_CbtHookProc Func __DlgBox_UnregisterHook() _WinAPI_UnhookWindowsHookEx($g__hHookDlgBox) DllCallbackFree($g__hProcDlgBox) EndFunc ;==>__DlgBox_UnregisterHook Func _WinAPI_SetDlgItemText($hDlg, $nIDDlgItem, $lpString) Local $aRet = DllCall('user32.dll', "int", "SetDlgItemText", _ "hwnd", $hDlg, _ "int", $nIDDlgItem, _ "str", $lpString) Return $aRet[0] EndFunc ;==>_WinAPI_SetDlgItemText Simple example to see how to use it #include "HookDlgBox.au3" _DlgBox_SetButtonNames("1", "two", "3") MsgBox(4, "Test 1", "Custom button texts") _DlgBox_SetPosition(20, 20) MsgBox(66, "Test 2", "Custom position and button texts") _DlgBox_SetButtonNames("Submit", "Don't submit", "Don't know") InputBox("Test 3", "Where were you born?", "Planet Earth") _DlgBox_SetSize(800, 800) InputBox("Test 4", "Where were you born?", "Planet Earth") _DlgBox_SetSize(Default, 800) MsgBox(66, "Test 5", "Strange but working") _DlgBox_SetButtonNames(Default, "Wait", "What?") _DlgBox_SetSize(Default, Default) _DlgBox_SetPosition(500, 500) MsgBox(66, "Test 6", "So far so good!") _DlgBox_SetDefaults() MsgBox(6, "Test 7", "Default position and button texts") Hope you like it. Best regards funkey HookDlgBox Example.au3 HookDlgBox.au3
  3. Dear AutoIt Community, i want my script to pop-up a MsgBox, but at the same time to continue the script. ConsoleWrite("Hello - 1" & @CRLF) MsgBox(0, "", "Hello - 2") ConsoleWrite("Hello - 3" & @CRLF)If I do it as above, the script is paused and waiting for me to close the MsgBox to continue on the third line. I don't want to set a timer to close the MsgBox either, because I will read the contents of the MsgBox but want my script continue to the next lines. I didn't see any kind of restriction on the MsgBox help file that will cause the script to be paused. Can you please tell / show me if this is possible?
  4. Sometimes when I call several MsgBox's they start popping up under other windows, which the requires ALT + TAB or click the taskbar icon. I just wanted to share this workaround: Just add a simple GUI in your program: #include <GUIConstantsEx.au3> $Form1 = GUICreate("Form1", 1, 1, 0, 0) GUISetState(@SW_SHOW) The GUI window size here is 1x1 so it will be nearly invisible, and at the top-left of your screen. It seems as long as that GUI is there all MsgBox's appear on top! I only tend to create several MsgBox's in a row when I'm actually writing and testing scripts, so the GUI being there is no big deal (I just remove/comment the GUI creation right before I build the .EXE). Have a great day!!!
  5. Hi, after years of use autoit i am tired to type all time: msgbox('','','Hi') So, wanna mod the function for set default values... or some more changes. where is the function? or there are another modes for debug messages that i do not knowed ? XD [just wanna like alert('text')] And is there any place for all integrates functions ? Thank. Sry my english =E
  6. Hi guys, So I am trying to automate a task and this task has an input box with an already set character "9". I have just decided that I don't really need the input as an option but it's good to leave however for this instance I would like it to run past this point automatically. I've tried numerous ways to try and automate the use of the "OK" button using ControlClick and various other options. I just can't seem to see where this point in the script is. Scoured the forums for anything similar but didn't have any luck finding anything. Sorry to be a pain and I hope someone can help, if I haven't explained in enough detail please don't hesitate to ask for more. Many thanks, Ackerz Local $len Local $n Local $buff Local $aMyDate $Len = InputBox("Test",$msgPrompt,"9") $len = StringStripWS($len,$STR_STRIPALL) ;Check that user has entered a vaild password length if not StringIsDigit($len) or $len = 0 Then MsgBox(48,"Error","Invaild Integer was entered" & @CRLF & "Program will now exit.") Exit EndIf ;This creates the random password. for $i = 1 to $Len ;Pick a random char between 1 and the pwsMask Length $n = int(random(1,StringLen($pwsMask))) ;Concat each char that has been picked out of pwsMask to $buff $buff = $Buff & StringMid($pwsmask,$n,1) Next
  7. Hello, as a start in Autoit i tried something i was missing since im using Autoit. I build a custom MessageBox which has a large amount of custom options and which scales its size on the parameters you set. Aviable Settings: -Title -Unlimited Buttons -Text Color (Buttons, Text) -Background Color (Msgbox, Buttons, Label) -Button Timeout -Autoclose Timeout -Icon (Default, No Icon, Custom) -Label/ Button Style. -Transparency I tried to keep this as close as i could to a Msgbox i was used too on my batch times. After i was ready i realised, @Melba23 probably build a way better msgbox which would have suit my needs enterly, anyway thanks to @Melba23 because i use his Stringsize UDF. local $Message = _sMsgBox("Test", 6, "Continue?") if @extended <> -1 Then MsgBox(0, @extended, $Message&" Button pressed") ScalingMessageBox.au3
  8. I am having a hard time understanding why this is not working. I was hoping some one could help explain it to me. $tags = $oIE.document.GetElementsByTagName("input") For $tag in $tags $class_value = $tag.GetAttribute("class") If string($class_value) = "fTs-p3298-l0 wplEditControl" Then $target = $tag ExitLoop EndIF Next MsgBox(0,"",$target) If $target = "fTs-p3298-l0 wplEditControl" THEN MsgBox(0,"","itworked") I have tried  MsgBox(0,"",$target.Attribute)  MsgBox(0,"",$target.Value)  MsgBox(0,"",$target.InnerText) I would expect to see this in the msgbox fTs-p3298-l0 wplEditControl
  9. Hello Guys i am working on automating a flashing tool..When flashing is started if there is any error in connection it pops's up a error window...(as shown below) whenever this popup appears i need a msgbox to appear saying "error occured" how can i do this? Thanks
  10. I have autoit script like this : winActivate ("BillReceipt") ControlClick ( "BillReceipt", "", "[NAME:winviewer]", "right") Send ( "{ENTER}") WinWait ("Print") ControlClick ("Print", "", "[CLASS:Button; INSTANCE:13]") Winwait ("Save As") WinActivate ("Save As") Send ("{TAB 5} {Backspace} ^v {Enter}") I need Saved successfully msgbox with file name as i saved like Filename.extension (Example = test.pdf is saved successfull) Please Help
  11. hi guys i want avoid to multiple MsgBox by hold Hotkey "]" in my script #include <GuiConstantsEx.au3> #include <Windowsconstants.au3> #include <SendMessage.au3> #include <WinAPI.au3> ;~ HotKeySet("{[}", "_boxminus") HotKeySet("{]}", "_boxplus") HotKeySet("{ESC}", "On_Exit") $hGUI = GUICreate("", 100, 100, -1, -1, $WS_POPUP, BitOr($WS_EX_LAYERED, $WS_EX_COMPOSITED, $WS_EX_TOPMOST)) GUISetBkColor(0x00FF00) GuiCtrlCreateLabel("", 3, 3, 94, 94) GUICtrlSetBkColor(-1, 0xABCDEF) GUICtrlSetResizing(-1, $GUI_DOCKBORDERS) GUISetState() _WinAPI_SetLayeredWindowAttributes($hGui, 0xABCDEF) $box_range = 100 While 1 $pos = MouseGetPos() WinMove($hGUI, "", $pos[0] - ($box_range / 2), $pos[1] - ($box_range / 2), $box_range, $box_range) WEnd ;~ Func _boxminus() ;~ If $box_range >= 30 Then $box_range = $box_range - 10 ;~ If $box_range < 30 Then $box_range = $box_range - 1 ;~ EndFunc Func _boxplus() If $box_range < 200 Then $box_range = $box_range + 10 Else MsgBox(0,"ERROR", "Maximum size already exist") EndIf EndFunc Func On_Exit() Exit EndFunc i wish after i get first MsgBox another gonna replaced with first one or just cancel in and apeear again how can i make it right ???
  12. Hello, I'm trying to make it so that when a message box pops up that the GUI will be unresponsive until that message box has been closed. From reading through the help the closest thing I can find is the WinWaitClose function, however this doesn't work fully as desired. If user tries to click on GUI the actions are more just waiting for the message box to close, so that once it closes everything happens at once. I want it so that the GUI is completely unusable until message box is closed. Below is test code to demonstrate the problem and help explain what I want. Any advice on this? #include <GUIConstantsEx.au3> Example() Func Example() ; Create a GUI with various controls. Local $hGUI = GUICreate("Example") Local $idOK = GUICtrlCreateButton("OK", 310, 370, 85, 25) local $but = GUICtrlCreateButton("Hello", 150,150,85,25) ; Display the GUI. GUISetState(@SW_SHOW, $hGUI) MsgBox( 262144,"Message","Try hitting the hello button several times,without closing this window. Now close this window and see how script wasn't restricted it just was waiting and storing the instructions") WinWaitClose("Message") While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $idOK Exit case $but MsgBox(0,"","Hello") EndSwitch WEnd ; Delete the previous GUI and all controls. GUIDelete($hGUI) EndFunc ;==>Example
  13. Hello ! I'm making a little script with only a tray option, no GUI. And i would like to know if someone created a function to set a personalized icon in top-left corner of the MsgBox and/or InputBox... -hcI
  14. I am a little confused and not sure what I am doing wrong. I am trying to get a OK and Cancel button that is always on top. $MB_OKCANCEL 1 OK and Cancel $MB_TOPMOST 262144 MsgBox() has top-most attribute set But when I try to run this code. $Msg = MsgBox(1 & 262144, "Registration", "Would you like to continue?") I get this.
  15. I have a simple msgbox function that I need to use in multiple places, but have different outcomes. For example, in one location if the left button was pressed I need it to write a one of the reg values. How do I accomplish this? #include <GUIConstantsEx.au3> Opt('MustDeclareVars', 1) Local $reg0 = RegWrite("HKLM\SOFTWARE\Wow6432Node\Newton\Default\Servers", "WRKSTN_ID", "REG_DWORD", "0") Local $reg1 = RegWrite("HKLM\SOFTWARE\Wow6432Node\Newton\Default\Servers", "WRKSTN_ID", "REG_DWORD", "1") Local $reg2 = RegWrite("HKLM\SOFTWARE\Wow6432Node\Newton\Default\Servers", "WRKSTN_ID", "REG_DWORD", "2") Local $reg3 = RegWrite("HKLM\SOFTWARE\Wow6432Node\Newton\Default\Servers", "WRKSTN_ID", "REG_DWORD", "3") Local $reg4 = RegWrite("HKLM\SOFTWARE\Wow6432Node\Newton\Default\Servers", "WRKSTN_ID", "REG_DWORD", "4") MainGUI() Func MainGUI() Local $Left, $Right, $msg GUICreate("Light") Opt("GUICoordMode", 2) $Left = GUICtrlCreateButton("Left", 10, 30, 50) $Right = GUICtrlCreateButton("Right", 0, -1) GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Left ; write reg value Case $msg = $Right ; write reg value EndSelect WEnd EndFunc
  16. The MsgBox() function is fine if your messages are very short. What are the AutoI alternatives if you need to display larger messages? Is there a lager dialog available, or do I need to write something from scratch? Thanks
  17. Hi all, Can this function be modified to support @CRLF in the MsgBox's text? ; Move Message Box ; Author - herewasplato _MoveMsgBox(0, "testTitle", "testText", 0, 10) Func _MoveMsgBox($MBFlag, $MBTitle, $MBText, $x, $y) Local $file = FileOpen(EnvGet("temp") & "\MoveMB.au3", 2) If $file = -1 Then Return;if error, give up on the move Local $line1 = 'AutoItSetOption(' & '"WinWaitDelay", 0' & ')' Local $line2 = 'WinWait("' & $MBTitle & '", "' & $MBText & '")' Local $line3 = 'WinMove("' & $MBTitle & '", "' & $MBText & '"' & ', ' & $x & ', ' & $y & ')' FileWrite($file, $line1 & @CRLF & $line2 & @CRLF & $line3) FileClose($file) Run(@AutoItExe & " /AutoIt3ExecuteScript " & EnvGet("temp") & "\MoveMB.au3") MsgBox($MBFlag, $MBTitle, $MBText) FileDelete(EnvGet("temp") & "\MoveMB.au3") EndFunc;==>_MoveMsgBox Thanks
  18. I'm unable to display a message box from a compiled AutoIt alerting script that is executed from a service (also a compiled AutoIt script). I used $MB_SERVICE_NOTIFICATION, but the dialog doesn't appear and the alerting script continues as if the OK button had been clicked. The service script uses ShellExecute() to launch the alerter (as opposed to a *Wait() call) so it can continue processing. Note that we used Windows Service Wrapper (winsw) to turn the compiled script into a service but haven't identified any issues from it. I tried the one-line execute example given in this thread: Message box timeout not working ; 2097152 = $MB_SERVICE_NOTIFICATION $iPID = Run(@AutoItExe & ' /AutoIt3ExecuteLine "MsgBox(2097152, ''' & $sTitle & ''', ''' & $sText & ''')"') without the timeout code, but no luck: the MsgBox does not appear. (In any case, we don't have AutoIt installed on the target system, so it would have to be converted into a .exe file.) We're developing and unit-testing on Win 7 Enterprise; the target OS is Win 7 Pro, and the AutoIt version is 3.3.14.2. Any solutions or suggestions will be much appreciated. Code fragments are below. Thanks. The following code fragment is the relevant portion of the alerting script that displays the MsgBox: [...] ; Alert the operator that there's a problem with the recording $sFeed = $aRecInfo[6] $sSession = $aRecInfo[2] $sTemp = $aRecInfo[4] $sDate = _FormatDate($sTemp) $sTemp = $aRecInfo[5] $sTime = _FormatTime($sTemp) _Debug2("Inactive recording feed " & $sFeed & ", Session=" & $sSession & ", Start Date/Time=" & _ $sDate & " " & $sTime) $sErrorMsg = "ERROR: Feed " & $sFeed & " for session " & $sSession & " stopped, notify reporter immediately" $iMbFlag = $MB_SERVICE_NOTIFICATION _Debug1("Displaying MsgBox...") MsgBox($iMbFlag, "INTERVIEW RECORDING ERROR", $sErrorMsg) _Debug1("Returned from MsgBox") [...] And the calling code fragment in the service is: ; Walk through the array backwards so we don't end up evaluating an index that doesn't exist For $iIndex = UBound($aFeedArray)-1 To 0 Step -1 [...] ; Before timing-out the feed, check for a .mpgpart file (=> feed may still be recording) $sDirPath = $sDirTemp & "\" & $sFeedTemp & "\" & $aFeedArray[$iIndex][$cSessionName] $sMpgPartName = GetMpgPart($sDirPath, $sFeedTemp) If StringLen($sMpgPartName) > 0 Then ; If .mpgpart file name hasn't changed in more than $iDeadFeedTime seconds, then declare feed dead ; ========v Test code to force error v======== $sMpgPartName = $aFeedArray[$iIndex][$cMpgPartName] ; ========^ Test code to force error ^======== _Debug2("Just set $sMpgPartName to '" & $sMpgPartName & "', should fall into dead-feed code") If $sMpgPartName = $aFeedArray[$iIndex][$cMpgPartName] Then ; Name is same => feed is dead: alert the operator and delete the feed w/out stop-processing _Debug2("Feed " & $sFeedTemp & " looks dead -- alerting the operator") _Debug2("Delete GUID " & $aFeedArray[$iIndex][$cGUID]) ; ======== Alert app execution ======== ; $sAlertApp = @ScriptDir & "\" & "RecAlert.exe" $iChildPid = ShellExecute($sAlertApp, $sDirPath, "", "open") _Debug2("Alert app: ShellExecute(): " & _RetStr($iChildPid, @error, @extended)) _ArrayDelete($aFeedArray, $iIndex) Else ; Otherwise, the .mpgpart name has changed, reset the timer, store the name, and continue _Debug2("Feed " & $sFeedTemp & " timeout, but has new .mpgpart file -- continuing") $aFeedArray[$iIndex][$cDateTime] = TimerInit() $aFeedArray[$iIndex][$cMpgPartName] = $sMpgPartName EndIf ContinueLoop EndIf [...] Next
  19. i have this code running but it just would not start the code: Local $rndSleep = Int (Random(180000,240000,1000)) MsgBox($MB_SYSTEMMODAL, "NaaaNuuu", "This message box will show the sleeptime after closing the tabs, you got " & $rndSleep & " seconds left.", $rndSleep) here is the error it shows me: "C:\Users\numan\Desktop\scipiie.au3" (23) : ==> Variable used without being declared.: MsgBox($MB_SYSTEMMODAL, "NaaaNuuu", "This message box will show the sleeptime after closing the tabs, you got " & $rndSleep & " seconds left.", $rndSleep) MsgBox(^ ERROR
  20. I wrote AutoIt programs for (too!!) many years! I just update to W10 then install a new machine. Want to write a script and found that whatever flag values MsgBox won't pause the script ( just display for 2 ~ 3 seconds) The same occurs with _ArrayDisplay Thanks for Any Clue
  21. Hi guys, through a script, a button refers me content in a txt file. You can have a MsgBox if this file is modified the content?
  22. Hello guy got some trouble in this easy script Case $BoutonWhrite1 $Case1 = MsgBox (4,"Are you sure ?" ,"Reg key gonna be changed." ) While 1 If $Case1 = "No" Then ConsoleWrite(">Case -1 Started" & @CRLF) ExitLoop EndIf $InputType = InputBox ("Value Type ?", 'Type of key to write: "REG_SZ", "REG_MULTI_SZ", "REG_EXPAND_SZ", "REG_DWORD", "REG_QWORD", or "REG_BINARY".' ) ;~ RegWrite (""&Reg1,""&$RegName1,""&$InputType, ""&$RegValue1) ExitLoop WEnd I tryed If $case1 = 1 If $case1 = -1 If $case1 = "No" What is the returned value by the msg box YES or NO ? The script is going wrong about the final purpose (Whrite a Registry key if the Script user unswer YES ) But dont take attention i am gonna corect after get the returned value xD it was for testing.
  23. I'm trying to run this code: #include <GuiListView.au3> #include <GUIConstants.au3> Dim $Services Dim $ServicesList #cs While 1 CheckService() Sleep(30000) ; sleep 30 seconds WEnd #ce ;#cs #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <ListViewConstants.au3> #include <TabConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 615, 438, 192, 124) $Tab1 = GUICtrlCreateTab(0, 48, 609, 385) $TabSheet1 = GUICtrlCreateTabItem("Running Services") $ListView1 = GUICtrlCreateListView("Service Name|Status", 8, 72, 593, 281, -1, BitOR($LVS_EX_GRIDLINES,$LVS_EX_CHECKBOXES,$LVS_EX_FULLROWSELECT)) GUICtrlSendMsg($ListView1, $LVM_SETCOLUMNWIDTH, 0, 300) GUICtrlSendMsg($ListView1, $LVM_SETCOLUMNWIDTH, 1, 288) $Button1 = GUICtrlCreateButton("Stop Services", 464, 376, 129, 33) $TabSheet2 = GUICtrlCreateTabItem("Stopped Services") GUICtrlSetState(-1,$GUI_SHOW) $ListView2 = GUICtrlCreateListView("Service Name|Status", 8, 72, 593, 281, -1, BitOR($LVS_EX_GRIDLINES,$LVS_EX_CHECKBOXES,$LVS_EX_FULLROWSELECT)) GUICtrlSendMsg($ListView2, $LVM_SETCOLUMNWIDTH, 0, 300) GUICtrlSendMsg($ListView2, $LVM_SETCOLUMNWIDTH, 1, 288) $Button2 = GUICtrlCreateButton("Start Services", 464, 376, 129, 33) GUICtrlCreateTabItem("") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd ;#ce ;$Tab1 = GUICtrlCreateTab(16, 8, 601, 377) ;$TabSheet1 = GUICtrlCreateTabItem("Running Services") ;$ListView1 = GUICtrlCreateListView("Service Name", 24, 40, 582, 334) ;_GUICtrlListView_SetExtendedListViewStyle($ListView1, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_CHECKBOXES, $LVS_EX_GRIDLINES)) ;$ServiceName = "wuauserv" Local $Services = ObjGet("winmgmts:\\" & @ComputerName & "\root\cimv2") Local $ServicesList = $Services.ExecQuery("SELECT * FROM Win32_Service") If IsObj($ServicesList) then For $Services in $ServicesList ;If $Services.Name = $ServiceName Then ; if $Services.State = "Running" Then MsgBox(8192,"Hello", $Services.Name & $Services.State,0,$Form1) ;GUICtrlCreateListViewItem( $Services.Name & "|" & $Services.State , $ListView1) ;Run (@ComSpec & " /c " & 'net stop wuauserv') ; EndIf ;EndIf Next EndIf ;EndFunc But the msgbox does turn up when GUI runs. However, if I comment the GUI section, it works perfectly fine. Please help.
  24. Quick search did not supply existing threads. Maybe I am missing something. Problem is this Local $DisplayText="This & that, shows that this & that does not display the ampersand correctly" MsgBox(0,"Show &",$DisplayText) What I get is: This _that, shows that this _that does not display the ampersand correctly. For Labels one cures the problem with the style $SS_NOPREFIX, but what's to do with the MsgBox? Just a nudge in the right direction would be appreciated. Thanks
  25. Hello, I'm rather new at Autoit (picked it up again afther a couple of years) but i dont know what I'm doing wrong here. I hope somebody can help me making this script "better readeble" and explain what I'm doing wrong here. The thing that i want to do here is making a tool that helps me whit doing mine work. Also want to do the "ping" command in the background whit only a msgbox if ok or not. In the code I'm writing now I'm using Send commands but know that there is a better way for this. At this point there is a error also whish i do not udnerstand where it is comming from. the error i get is: MsgBox($MB_SYSTEMMODAL, "Error", " Error no IP or name is filled in") MsgBox(^ ERROR Could somebody help me whit looking at this code? #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $Form1 = GUICreate("Form1", 385, 112, 192, 124) $iIP = GUICtrlCreateInput("", 80, 16, 209, 21) $btn_ping = GUICtrlCreateButton("Ping", 24, 56, 89, 25) $btn_vnc = GUICtrlCreateButton("VNC", 136, 56, 89, 25) $btn_evr = GUICtrlCreateButton("Eventvieuwer", 248, 56, 89, 25) GUISetState(@SW_SHOW) Func check_input() If GUICtrlRead($iIP) = "" Then Return False Else Return True Endif EndFunc While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $btn_ping $check = check_input() If ($check = False) Then Run ("cmd.exe") WinWaitActive("C:\WINDOWS\system32\cmd.exe") Send ("ping " & GUICtrlRead($iIP) & "{ENTER}") WinClose ("C:\WINDOWS\system32\cmd.exe") ;if ping OK then msgbox OK else NOK Else MsgBox($MB_SYSTEMMODAL, "Error", " Error no IP or name is filled in") EndIf Case $btn_vnc $check = check_input() If ($check = False) Then Run ("cmd.exe") WinWaitActive("C:\WINDOWS\system32\cmd.exe") Send ("eventvwr.exe " & GUICtrlRead($iIP) & "{ENTER}") WinClose ("C:\WINDOWS\system32\cmd.exe") Else MsgBox($MB_SYSTEMMODAL, "Error", " Error no IP or name is filled in") EndIf Case $btn_evr $check = check_input() If ($check = False) Then Run ("cmd.exe") WinWaitActive("C:\WINDOWS\system32\cmd.exe") Send ("vncviewer " & GUICtrlRead($iIP) & "{ENTER}") WinClose ("C:\WINDOWS\system32\cmd.exe") Else MsgBox($MB_SYSTEMMODAL, "Error", " Error no IP or name is filled in") EndIf EndSwitch WEnd
×
×
  • Create New...