Jump to content

gte

Active Members
  • Posts

    286
  • Joined

  • Last visited

Everything posted by gte

  1. I have a working function (in Vista(32)) that will not work in Win7(32). Research appears to show that AIT uses SysListView32 to view controls/text (at least with the WinExists and WinActivate functions) and in Win7 Microsoft has started implementing DirectUIHWND more, breaking my app. Everything thing is the same on both machines, sans the Vista 32 bit/ Win7 32 bit. Is there a work around or fix for this? Thanks for reading.
  2. Has anyone figured this out yet? WinExists and possibly WinActivate are not working in Win7 but working great in Vista
  3. Ok, I moved it out, apps is giving this error, not quite sure how to fix it yet !>10:38:33 AutoIT3.exe ended.rc:-1073741502 When the app was running, it would only happen for a particular control after I triggered it via a button click
  4. Ok, I updated and used adlibregister, thanks! I have a switch/case statement in my while statement. It appears that after I press a button triggering something in my case statement, it keeps looping on that individual case statement option endlessly? I even tried setting $nMsg = "" at the end??? Any idea what would cause that? While 1 $nMsg = GUIGetMsg() Switch $nMsg ;~ ConsoleWrite("$nMsg is " & @CRLF) Case $GUI_EVENT_CLOSE Exit Case $countfiles_button FileDelete("c:\temp\testxmls\*.xml") $sPath = "D:\dma\fecs\downloadbak" $zipfilelist = _FileListToArray($sPath,"*.zip",1) If fileread("c:\temp\testxmls\*.xml") = 1 Then $deletexmls_button = MsgBox(3, "XML files are already in directory", "Delete existing files in c:\temp\testxmls ?") if $deletexmls_button = 6 Then FileDelete("c:\temp\testxmls\*.xml") ElseIf @Error=1 Then EndIf MsgBox (0,"","No Files\Folders Found.") Exit EndIf _unziposindependent() if $didnotfindzipfiles = 1 then ContinueCase EndIf MsgBox(0, "XML Transaction Counting", "Completed! And completed 727% faster than the old program!") ;~ $sString = "</Document>" $aFileList = _FileListToArray("c:\temp\testxmls", "*.xml", 1) ; Lists .xml files and\or folders in c:\temp\testxmls FileDelete("c:\temp\testxmls\results.txt") ; deletes old result findings For $i = 1 To $aFileList[0] Step 1 ; variable $i = from line 1 to the end of the array $iCount = UBound (StringRegExp(FileRead("c:\temp\testxmls\" & $aFileList[$i]), "(?i)(" & $sString & ")", 3)) ; variable iCount equals the query of the file read c:\temp\testxmls\filearrary, string to search for without case sensitivity, search globally FileWrite("c:\temp\testxmls\results.txt", $iCount & @CRLF) ; puts the results of each file, one line at a time ConsoleWrite($i & " - " & $iCount & @CRLF) ; writes the console below Next $fileread = FileRead("c:\temp\testxmls\results.txt") ; reads the results file output $out = StringReplace($fileread, @CRLF, "+") ; replaces a carriage return with a plus symbol If StringRight($out,1) = "+" Then ; trims the last plus symbol from the equation if it's there $out = StringLeft($out,StringInStr($out,"+",0,-1)-1) ; variable out = evalulte $out string, get the count by taking the string $out, substring of +, not case sensitive, from the right side EndIf $sum = Execute($out) $cleanup = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\DMA\FECS\applications\Cleanup", "Delay - Processed") ; read the registry key value ;~ ; MsgBox(0, 2, $cleanup) $average = Round(($sum / $cleanup),3) ; do the math of total divided by days cleanup saves for, and round it to the 3rd decimal GUICtrlSetData($daysfilesretained_input, $cleanup & " is the number of days files are retained for") GUICtrlSetData($totalfilesfound_input, $sum & " transactions found") GUICtrlSetData($averagetransperday_input, $average & " per day") GUICtrlSetData($daysneededfor500_input, Round((500/$average),2) & " days for 500 transactions") GUICtrlSetData($daysneededfor1000_input, Round((1000/$average),2) & " days for 1000 transactions") Case $stopdisableunzipFHD_button _stopdisableunzip() Case $stopdisablenotificationFRD_button _stopdisablenotification() Case $startenablenotificationFRD_button _startenablenotification() Case $startenableunzipFRD_button _startenableunzip() Case $createholdfoldersFRD_button _createholdfolders() Case $checkcurrentsettingsLL_button _checklibrarylist() _adlibfunctions() Case $applystopdisableLL_button _updatelibrarylist() _stopdisablenotification() Case $startenablenotificationLL_button _startenablenotification() Case $counttransactions_button _countfilesinnotification() GUICtrlSetData($counttransactionsnotification_input, $notificationcountsum) _countfilesinnotification_datestresstest() GUICtrlSetData($counttransactionsdatestresstest_input, $notificationStressTestcountsum) _countfilesinnotification_datebackup() GUICtrlSetData($counttransactionsbackup_input, $notificationBackupcountsum) Case $appyupdate_button _updatelibrarylist() Case $restartnotificationLL_button _restartnotification() Case $scanstationchangevaluechange_button _changescanstationserver() Case $scanstationchangevaluescheck_button _checkscanstationserver() EndSwitch AdlibRegister("_adlibfunctions", 1000) Sleep(100) ; This is to stop flutter with the GUI $nMsg = "" WEnd
  5. Hi Melba, I have adlibenable, but not adlibregister. I believe i have version ait 3.3.0.0, do I need to upgrade, or just install a udf? Thanks for the reply! -gte
  6. How can I have a function that is inside of my while statement only run every 2 seconds, before looping and trying to run again? All the while still allowing the other functions inside of my while statement the ability to run? I experimented with the code below, but it did not work when I incorporated functions. $cycle = @SEC ConsoleWrite($cycle) While 1 ;~ ConsoleWrite("Time is " & @HOUR & @MIN & @MSEC & @SEC) If @sec = ($cycle + 2) Then ;OR @sec < 1 Then ConsoleWrite("Looping" & @CRLF) $cycle = @SEC ConsoleWrite($cycle & " in if statement" & @CRLF) ElseIf @sec = 00 Then $cycle = -1 ConsoleWrite("Resetting $cycle value" & "@sec = " &@sec & @CRLF) EndIf Sleep(100) WEnd More detailed explanation I have a script that checks registry settings and services over the network and updates and input box with the registry setting values or services conditions. For whatever reason it is looping the function again before it gets information back from the previous time the function runs, so it queues up a hundreds of calls to a server over the network (trying to populate the input box) and causes a 1 to 2 minute wait queue to do anything else in the while statement. I'd like for it to poll the service status (running/stopped and enabled/disabled) every 2 seconds and wait for the value to return, while allowing me to stop the service through a button in my gui Here is the function to check the service status, that I am using ;=============================================================================== ; ; Description: Checks to see if a service is running ; Syntax: _ServiceRunning($sServiceName) ; Parameter(s): $sServiceName - Name of service to check ; Requirement(s): None ; Return Value(s): On Success - Returns 1 ; On Failure - Returns 0 ; Author(s): SumTingWong ; Documented by: noone ; ;=============================================================================== Func _ServiceRunning($sServiceName) Local $arRet Local $hSC Local $hService Local $bRunning = 0 If GUICtrlRead($updatelibrarylistserverinputvalue_input) <> "" AND StringLen(GUICtrlRead($updatelibrarylistserverinputvalue_input)) = 7 Then Local $server = GUICtrlRead($updatelibrarylistserverinputvalue_input) ConsoleWrite("Service name server value is " & $server & @CRLF) ;~ ; ElseIf GUICtrlRead($updatelibrarylistserverinputvalue_input) <> "" Then local $server = @ComputerName EndIf ;~ EndIf $arRet = DllCall("advapi32.dll", "long", "OpenSCManager", _ "str", $server, _ "str", "ServicesActive", _ "long", $SC_MANAGER_CONNECT) If $arRet[0] <> 0 Then $hSC = $arRet[0] $arRet = DllCall("advapi32.dll", "long", "OpenService", _ "long", $hSC, _ "str", $sServiceName, _ "long", $SERVICE_INTERROGATE) If $arRet[0] <> 0 Then $hService = $arRet[0] $arRet = DllCall("advapi32.dll", "int", "ControlService", _ "long", $hService, _ "long", $SERVICE_CONTROL_INTERROGATE, _ "str", "") $bRunning = $arRet[0] DllCall("advapi32.dll", "int", "CloseServiceHandle", "long", $hService) EndIf DllCall("advapi32.dll", "int", "CloseServiceHandle", "long", $hSC) EndIf Return $bRunning EndFunc
  7. I wanted to make a voting script to put a definition at the top of the page, an example would be the following. The site is http://www.urbandicationary.com It appears as if the site lets you vote, and then places a cookie on your machine that doesn't allow you to vote until the following day? Can anyone confirm/deny that? Maybe something along the lines of this script? Ideas? Would using the form submission html be better in this case? While 1 If WinExists("Urban Dictionary: goto - Windows Internet Explorer", "") FileDelete(@UserProfileDir & "\cookies\*.*") WinActivate("Urban Dictionary: goto - Windows Internet Explorer", "") ControlClick("Urban Dictionary: goto - Windows Internet Explorer", "", ???) Sleep(2000) EndIf WEnd GOTO Definition A super lame thing that no one should ever use. Write a better loop you loser! A poor and obsolete command that should have never made it from C into C++, or possibly even into ansi C. Used in a sentence Valik told the guy, don't use the goto function, write a fucking function!
  8. Yes, it wasn't working, I believe you cannot use control a/c/v with this craptastic program I'm trying to write to. Here is what I ended up doing after experimenting, it's kind of sloppy with the generic sending of keys to the active window, any ideas on a better way to clean that up? Func currentinbox() If WinExists("HP OpenView ServiceCenter - Incident Queue: Unassigned Incidents - HP OpenView ServiceCenter Client", "") Then Sleep(25) WinActivate("HP OpenView ServiceCenter - Incident Queue: Incidents (Problems) I Opened - HP OpenView ServiceCenter Client", "") Sleep(50) ControlClick("HP OpenView ServiceCenter", "", "[CLASSNN:Edit4]") Sleep(25) Send("{LSHIFT}+{F10}") Sleep(25) Send("s") Sleep(25) ClipPut("Open Incidents Assigned To My Branch") Sleep(25) ControlClick("HP OpenView ServiceCenter", "", "[CLASSNN:Edit4]", "right") Sleep(25) Send("p") Sleep(250) ConsoleWrite("Done" & @crlf) EndIf EndFunc
  9. Hey Old Friend, I tried controlsend("^v") after putting it on the clip board, is that what you mean?
  10. I need to be able to paste into an input box, but paste the text which is 36 characters, all at once like a right click and paste, which does work when done manually. The reason this is necessary, is because the application that is polling this input box polls it so quickly it will fail if it polls and only part of the text is there. As a side note, the input box controls the contents of the window beneath it. Thanks for reading
  11. Can I put the $server in this location? It appears to have worked, but I'm not 100% sure it did $arRet = DllCall("advapi32.dll", "long", "OpenSCManager", _ "str", $server, _ "str", "ServicesActive", _ "long", $SC_MANAGER_CONNECT)
  12. Global $STANDARD_RIGHTS_REQUIRED = 0x000F0000 Global $SC_MANAGER_CONNECT = 0x0001 Global $SC_MANAGER_CREATE_SERVICE = 0x0002 Global $SC_MANAGER_ENUMERATE_SERVICE = 0x0004 Global $SC_MANAGER_LOCK = 0x0008 Global $SC_MANAGER_QUERY_LOCK_STATUS = 0x0010 Global $SC_MANAGER_MODIFY_BOOT_CONFIG = 0x0020 Global $SC_MANAGER_ALL_ACCESS = BitOR($STANDARD_RIGHTS_REQUIRED, _ $SC_MANAGER_CONNECT, _ $SC_MANAGER_CREATE_SERVICE, _ $SC_MANAGER_ENUMERATE_SERVICE, _ $SC_MANAGER_LOCK, _ $SC_MANAGER_QUERY_LOCK_STATUS, _ $SC_MANAGER_MODIFY_BOOT_CONFIG) Global $SERVICE_QUERY_CONFIG = 0x0001 Global $SERVICE_CHANGE_CONFIG = 0x0002 Global $SERVICE_QUERY_STATUS = 0x0004 Global $SERVICE_ENUMERATE_DEPENDENTS = 0x0008 Global $SERVICE_START = 0x0010 Global $SERVICE_STOP = 0x0020 Global $SERVICE_PAUSE_CONTINUE = 0x0040 Global $SERVICE_INTERROGATE = 0x0080 Global $SERVICE_USER_DEFINED_CONTROL = 0x0100 Global $SERVICE_ALL_ACCESS = BitOR($STANDARD_RIGHTS_REQUIRED, _ $SERVICE_QUERY_CONFIG, _ $SERVICE_CHANGE_CONFIG, _ $SERVICE_QUERY_STATUS, _ $SERVICE_ENUMERATE_DEPENDENTS, _ $SERVICE_START, _ $SERVICE_STOP, _ $SERVICE_PAUSE_CONTINUE, _ $SERVICE_INTERROGATE, _ $SERVICE_USER_DEFINED_CONTROL) Global $SERVICE_CONTROL_STOP = 0x00000001 Global $SERVICE_CONTROL_INTERROGATE = 0x00000004 $bRunning = "" $server = "" ;~ if _ServiceRunning("Alerter") = 1 Then ;~ MsgBox(0,0,"Running") ;~ ElseIf _ServiceRunning("Alerter") = 0 Then ;~ MsgBox(0,0,"Not Running") ;~ EndIf ;=============================================================================== ; ; Description: Checks to see if a service is running ; Syntax: _ServiceRunning($sServiceName) ; Parameter(s): $sServiceName - Name of service to check ; Requirement(s): None ; Return Value(s): On Success - Returns 1 ; On Failure - Returns 0 ; Author(s): SumTingWong ; Documented by: noone ; ;=============================================================================== Func _ServiceRunning($sServiceName) Local $arRet Local $hSC Local $hService Local $bRunning = 0 $arRet = DllCall("advapi32.dll", "long", "OpenSCManager", _ "str", "", _ "str", "ServicesActive", _ "long", $SC_MANAGER_CONNECT) If $arRet[0] <> 0 Then $hSC = $arRet[0] $arRet = DllCall("advapi32.dll", "long", "OpenService", _ "long", $hSC, _ "str", $sServiceName, _ "long", $SERVICE_INTERROGATE) If $arRet[0] <> 0 Then $hService = $arRet[0] $arRet = DllCall("advapi32.dll", "int", "ControlService", _ "long", $hService, _ "long", $SERVICE_CONTROL_INTERROGATE, _ "str", "") $bRunning = $arRet[0] DllCall("advapi32.dll", "int", "CloseServiceHandle", "long", $hService) EndIf DllCall("advapi32.dll", "int", "CloseServiceHandle", "long", $hSC) EndIf Return $bRunning EndFunc Like this below? Global $STANDARD_RIGHTS_REQUIRED = 0x000F0000 Global $SC_MANAGER_CONNECT = 0x0001 Global $SC_MANAGER_CREATE_SERVICE = 0x0002 Global $SC_MANAGER_ENUMERATE_SERVICE = 0x0004 Global $SC_MANAGER_LOCK = 0x0008 Global $SC_MANAGER_QUERY_LOCK_STATUS = 0x0010 Global $SC_MANAGER_MODIFY_BOOT_CONFIG = 0x0020 Global $SC_MANAGER_ALL_ACCESS = BitOR($STANDARD_RIGHTS_REQUIRED, _ $SC_MANAGER_CONNECT, _ $SC_MANAGER_CREATE_SERVICE, _ $SC_MANAGER_ENUMERATE_SERVICE, _ $SC_MANAGER_LOCK, _ $SC_MANAGER_QUERY_LOCK_STATUS, _ $SC_MANAGER_MODIFY_BOOT_CONFIG) Global $SERVICE_QUERY_CONFIG = 0x0001 Global $SERVICE_CHANGE_CONFIG = 0x0002 Global $SERVICE_QUERY_STATUS = 0x0004 Global $SERVICE_ENUMERATE_DEPENDENTS = 0x0008 Global $SERVICE_START = 0x0010 Global $SERVICE_STOP = 0x0020 Global $SERVICE_PAUSE_CONTINUE = 0x0040 Global $SERVICE_INTERROGATE = 0x0080 Global $SERVICE_USER_DEFINED_CONTROL = 0x0100 Global $SERVICE_ALL_ACCESS = BitOR($STANDARD_RIGHTS_REQUIRED, _ $SERVICE_QUERY_CONFIG, _ $SERVICE_CHANGE_CONFIG, _ $SERVICE_QUERY_STATUS, _ $SERVICE_ENUMERATE_DEPENDENTS, _ $SERVICE_START, _ $SERVICE_STOP, _ $SERVICE_PAUSE_CONTINUE, _ $SERVICE_INTERROGATE, _ $SERVICE_USER_DEFINED_CONTROL) Global $SERVICE_CONTROL_STOP = 0x00000001 Global $SERVICE_CONTROL_INTERROGATE = 0x00000004 $bRunning = "" $server = "[MACHINE NAME" ;~ _ServiceRunning("FECS NOTIFICATION") _ServiceRunning("Alerter") Func _ServiceRunning($sServiceName) Local $arRet Local $hSC Local $hService Local $bRunning = 0 $arRet = DllCall("\\" & $server & "\" & @WindowsDir & "\advapi32.dll", "long", "OpenSCManager", _ "str", "", _ "str", "ServicesActive", _ "long", $SC_MANAGER_CONNECT) If $arRet[0] <> 0 Then $hSC = $arRet[0] $arRet = DllCall("\\" & $server & "\" & @WindowsDir & "\advapi32.dll", "long", "OpenService", _ "long", $hSC, _ "str", $sServiceName, _ "long", $SERVICE_INTERROGATE) If $arRet[0] <> 0 Then $hService = $arRet[0] $arRet = DllCall("\\" & $server & "\" & @WindowsDir & "\advapi32.dll", "int", "ControlService", _ "long", $hService, _ "long", $SERVICE_CONTROL_INTERROGATE, _ "str", "") $bRunning = $arRet[0] DllCall("\\" & $server & "\" & @WindowsDir & "\advapi32.dll", "int", "CloseServiceHandle", "long", $hService) EndIf DllCall("\\" & $server & "\" & @WindowsDir & "\advapi32.dll", "int", "CloseServiceHandle", "long", $hSC) EndIf ConsoleWrite("Function return for service is " & $bRunning & @CRLF) Return $bRunning EndFunc
  13. Thanks Andy Here is what I modded it to, you have an input box and the input box value determines a variable which allows you to bypass the script, but you have to click log off twice to actually log off. Is there any way to have the logoff/shutdown command paused, and then wait for the input box value before decided what to do, then continuing on to what the user initially requested if they pass the input box check, say with a do ... until? I tried a do ... until at the top of the Cancel_Shutdown function and windows continued to try and shutdown, so maybe there is a way to catch the users request, be it a shutdown or restart and then input it for them programmatically? #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> $WM_QUERYENDSESSION = 0x11 GUIRegisterMsg($WM_QUERYENDSESSION, "Cancel_Shutdown") GUICreate("PreventShutdownGUI") GUISetSTate(@SW_HIDE) Global $pinentered = 0 ; set highest notification level If Not _SetProcessShutdownParameters(0xFFF) Then ; MSDN says maximum is 0x4FF, but it worked for me If Not _SetProcessShutdownParameters(0x4FF) Then ; MSDN says this is reserved for System, but worked for me _SetProcessShutdownParameters(0x3FF) ; highest not reserved number, if everything else does not work EndIf EndIf Global $b_ShutdownInitiated = False While 1 $nMsg = GUIGetMsg() If $b_ShutdownInitiated = True then $b_ShutdownInitiated = False $pininput = InputBox("Log Off Verification", @crlf & @crlf & "Please type your pin in, to verify that you definitely want to log off or shutdown." & @CRLF & @CRLF & "Then click logoff or shutdown once more, after verifying this is the intended action.", "", "", 500, 200) If StringLen($pininput) = 6 Then ; conditional inputbox $pinentered = 1 ; value that keeps the script from catching itself in function Cancel_Shutdown() ConsoleWrite("Pin length correct, pin is " & $pininput & @crlf) Else ConsoleWrite("Pin length incorrect" & @crlf) EndIf EndIf sleep(10) WEnd Func Cancel_Shutdown($hWndGUI, $MsgID, $WParam, $LParam) If $pinentered = 0 Then $b_ShutdownInitiated = True FileWriteLine("c:\temp\logoff_log.txt", @MON & "-" & @MDAY & "-" & @YEAR & " " & @HOUR & ":" & @MIN & ":" & @SEC & ":" & @MSEC & " ---- ") FileWriteLine("c:\temp\logoff_log.txt", @MON & "-" & @MDAY & "-" & @YEAR & " " & @HOUR & ":" & @MIN & ":" & @SEC & ":" & @MSEC & " ---- " & @UserName & " almost accidentially logged off this pin or shutdown this box down") FileWriteLine("c:\temp\logoff_log.txt", @MON & "-" & @MDAY & "-" & @YEAR & " " & @HOUR & ":" & @MIN & ":" & @SEC & ":" & @MSEC & " ---- ") ; DO NOT ADD A MSGBOX HERE ; Windows shows a not responding box after ~5 secs and allows to kill your app. Return False ElseIf $pinentered = 1 Then $b_ShutdownInitiated = False FileWriteLine("c:\temp\logoff_log.txt", @MON & "-" & @MDAY & "-" & @YEAR & " " & @HOUR & ":" & @MIN & ":" & @SEC & ":" & @MSEC & " ---- ") FileWriteLine("c:\temp\logoff_log.txt", @MON & "-" & @MDAY & "-" & @YEAR & " " & @HOUR & ":" & @MIN & ":" & @SEC & ":" & @MSEC & " ---- " & $pininput & " logged off this pin or shutdown this box down") FileWriteLine("c:\temp\logoff_log.txt", @MON & "-" & @MDAY & "-" & @YEAR & " " & @HOUR & ":" & @MIN & ":" & @SEC & ":" & @MSEC & " ---- ") ; DO NOT ADD A MSGBOX HERE ; Windows shows a not responding box after ~5 secs and allows to kill your app. Return True EndIf EndFunc Func _SetProcessShutdownParameters($dwLevel, $dwFlags=0) ; http://msdn.microsoft.com/en-us/library/ms686227%28VS.85%29.aspx ; Prog@ndy Local $aResult = DllCall("Kernel32.dll", "int", "SetProcessShutdownParameters", "dword", $dwLevel, "dword", $dwFlags) If @error Then Return SetError(1,0,0) Return $aResult[0] EndFunc
  14. So how would I set $WM_QUERYENDSESSION to true Are you registering 0x11 to query your script every time a shutdown is called? And then through that, it calls the cancel_shutdown function? So if I wanted to have a conditional shutdown, I could put an in statement in the cancel_shutdown function and have it return true or false?
  15. Can you explain how this script works in detail? Does it call the function SetProcessShutdownParameters to block the shutdown?
  16. I'm close for the first one I think, I just cannot get it to continue past the shutdown catch, if you verify that you actually want it to shut down? Any ideas? #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_outfile=logoffblock.exe #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** $WM_QUERYENDSESSION = 0x11 GUIRegisterMsg($WM_QUERYENDSESSION, "Cancel_Shutdown") GUICreate("PreventShutdownGUI") GUISetSTate(@SW_HIDE) ; set highest notification level If Not _SetProcessShutdownParameters(0xFFF) Then ; MSDN says maximum is 0x4FF, but it worked for me If Not _SetProcessShutdownParameters(0x4FF) Then ; MSDN says this is reserved for System, but worked for me _SetProcessShutdownParameters(0x3FF) ; highest not reserved number, if everything else does not work EndIf EndIf Global $b_ShutdownInitiated = False ConsoleWrite("b_shutdowninitiated value is " & $b_shutdowninitiated & @CRLF) While 1 If $b_ShutdownInitiated = True then ;~ $b_ShutdownInitiated = False $messageboxbutton = MsgBox(5 + 48 + 8192 + 262144, "Error", "Logging Off has been disabled as a service is dependent on this ERE pin you are logged in as." _ & @CRLF & @CRLF & "You must click on the Remote Desktop 'X' to close the window, but leave the session open." _ & @CRLF & @CRLF & "If you are SURE you want to log off, click retry and enter your pin, if you don't want to log off after all, click cancel") ConsoleWrite("About to enter switch statement" & @crlf) Switch GUIGetMsg($messageboxbutton) ConsoleWrite("Message box button value is " & $messageboxbutton & @CRLF) Case $messageboxbutton = 4 ; retry ConsoleWrite("Case 4" & @CRLF) $pininput = InputBox("Log Off Verification", "Please type your pin in, to verify that you definitely want to log off or shutdown") If StringLen($pininput) = 6 Then $b_ShutdownInitiated = True Continue_Shutdown() ConsoleWrite("Shutdown initiated after pin is TRUE" & @CRLF) Else $b_ShutdownInitiated = False ConsoleWrite("Shutdown initiated after pin is FALSE" & @CRLF) EndIf Case $messageboxbutton = 2 ; cancel ConsoleWrite("Case 2" & @CRLF) $b_ShutdownInitiated = False EndSwitch EndIf sleep(10) WEnd Func Cancel_Shutdown($hWndGUI, $MsgID, $WParam, $LParam) $b_ShutdownInitiated = True ; DO NOT ADD A MSGBOX HERE ; Windows shows a not responding box after ~5 secs and allows to kill your app. Return False EndFunc Func Continue_Shutdown();($hWndGUI, $MsgID, $WParam, $LParam) Global $WM_QUERYENDSESSION = "" $b_ShutdownInitiated = True ; DO NOT ADD A MSGBOX HERE ; Windows shows a not responding box after ~5 secs and allows to kill your app. Return True EndFunc Func _SetProcessShutdownParameters($dwLevel, $dwFlags=0) ; http://msdn.microsoft.com/en-us/library/ms686227%28VS.85%29.aspx ; Prog@ndy Local $aResult = DllCall("Kernel32.dll", "int", "SetProcessShutdownParameters", "dword", $dwLevel, "dword", $dwFlags) If @error Then Return SetError(1,0,0) Return $aResult[0] EndFunc
  17. Where is b_ShutdownInitiated defined and how do you have it effect logoff, but not shutdown?
  18. We have a few servers that are required to end the session (clicking on the X in the remote desktop window), instead of logging off, and a few that are required to log off instead of ending the session. Can this be monitored and prevented through event manager entries? Or any ideas? This script blocks log offs, and could be modded to work I think, but I don't understand the entire script #include <ie.au3> #include <GUIConstantsEx.au3> $WM_QUERYENDSESSION = 0x11 GUIRegisterMsg($WM_QUERYENDSESSION, "Cancel_Shutdown") GUICreate("PreventShutdownGUI") GUISetSTate(@SW_HIDE) ; set highest notification level If Not _SetProcessShutdownParameters(0xFFF) Then ; MSDN says maximum is 0x4FF, but it worked for me If Not _SetProcessShutdownParameters(0x4FF) Then ; MSDN says this is reserved for System, but worked for me _SetProcessShutdownParameters(0x3FF) ; highest not reserved number, if everything else does not work EndIf EndIf Global $b_ShutdownInitiated = False While 1 If $b_ShutdownInitiated = True then $b_ShutdownInitiated = False EndIf sleep(10) WEnd Func Cancel_Shutdown($hWndGUI, $MsgID, $WParam, $LParam) $b_ShutdownInitiated = True ; DO NOT ADD A MSGBOX HERE ; Windows shows a not responding box after ~5 secs and allows to kill your app. Return False EndFunc Func _SetProcessShutdownParameters($dwLevel, $dwFlags=0) ; http://msdn.microsoft.com/en-us/library/ms...28VS.85%29.aspx ; Prog@ndy Local $aResult = DllCall("Kernel32.dll", "int", "SetProcessShutdownParameters", "dword", $dwLevel, "dword", $dwFlags) If @error Then Return SetError(1,0,0) Return $aResult[0] EndFunc
  19. This is a little old, but I just fixed this by having a file read to a know file that's of a 100 kb or so, this will send 100kb from one session end to the other
  20. The remote desktop session is encrypted and I haven't figured out a way to see the contents inside of the window My code is in this post, I've changed my code since this post, but I had forgotten to update the post and my code is at work http://www.autoitscript.com/forum/index.php?showtopic=107962&st=0&p=761487&fromsearch=1&#entry761487
  21. Psalty, I have no idea why this page is setup this way. I have a feeling we have an old cobol programmer that refuses to modernize? I'm going to see if there is some way to export to an access db or an xml or something, so I can parse through that Jos, Psalty, thanks for helping with brainstorming.
  22. Hi Jos I was a twinkle in my Mom's eye in 1980, haha They way our db developers describe this JCL thing in the documentation, is that they make it seem like you can call it almost like an object, and then have it act as a mediary for the high level app and the mainframe. Any ideas?
  23. That is correct. I'm wondering if I can call a jcl file and query a db2 IBM mainframe?
  24. I'm trying to query a db2 database and it's designed to use JCL to retrieve information. Can AIT interact with a JCL file? Does anyone have any examples of this?
×
×
  • Create New...