
MrBeatnik
Active Members-
Posts
98 -
Joined
-
Last visited
MrBeatnik's Achievements
-
I have a rather strange issue on some machines. If I attempt to use the inbuilt PING function, no ICMP packet is sent out. Ping("internal.fqdn.com") is returning "Host Unreachable" If I ping using the command prompt, it's all fine. Using wireshark I can see that it hasn't even attempted an ICMP request. I can see it has looked up DNS to check for the correct IP address (I can see reply packet returns 10 different IP address as round robin - which is expected), but then it simply doesn't send the request. Any ideas?
-
Hi all, Two questions! First, the example in help docs for _WinAPI_IsWritable doesn't appear to give the desired results for me. In Windows 7, with me as an administrator and UAC disabled, it tells me that all my local hard drives are not writable. Is this a bug, or am I using the example incorrectly somehow? Second, if it was working... it doesn't appear to be valid for network drives. Is there an equivalent function for network drives?
-
Srex reacted to a post in a topic: Biggest noob questions of the day.. sorry
-
Spaces in @comspec /c exe path
MrBeatnik replied to Lee Evans's topic in AutoIt General Help and Support
You want to use CHR(34) to format your string: $command = " /c " & CHR(34) & "C:\DIR 1\EXE" & CHR(34) & " " & CHR(34) & "file name.ext" & CHR(34) & " /A /O" ( Above code not tested, but if you need a quotation mark in your string, use CHR(34) ). -
Fair enough, that answers the question about the example; it's still valid for supported OS. So, now I am setting the correct priv using the AutoIT UDF, and it appears to be working, any advice why the control panel isn't happy even after a reboot? EVen if I use _Date_Time_GetTimeZoneInformation() to get the current details (when everything is happy with the clock), and then use _Date_Time_SetTimeZoneInformation() to paste the exact same details back in, the above "error" occurs.
-
Considering XP death now, it would require, at least, _Security_SetPrivilege from my tests... to be a valid functioning example. I'm testing just now and it IS changing the timezone, albeit to something it doesn't like - but that's for me to check and fix for my timezone. Almost working code (based on _Security_SetPrivilege and _Date_Time_SetTimeZoneInformation examples merged together): #RequireAdmin #include <GUIConstantsEx.au3> #include <Date.au3> #include <WindowsConstants.au3> #include <MsgBoxConstants.au3> #include <SecurityConstants.au3> #include <Security.au3> #include <WinAPI.au3> ; Under Vista the Windows API "SetTimeZoneInformation" may be rejected due to system security Global $iMemo ;_Security__SetPrivilege Example Below Here Local $hToken = _Security__OpenProcessToken(_WinAPI_GetCurrentProcess(), $TOKEN_ALL_ACCESS) If $hToken Then ; $hToken it this process' token with $TOKEN_ALL_ACCESS access ; Enable SeDebugPrivilege for this token If _Security__SetPrivilege($hToken, $SE_TIME_ZONE_NAME, True) Then ;... Do whatever with this token now and here... Example() ;<------------- CALL ORIGINAL _Date_Time_SetTimeZoneInformation EXAMPLE MsgBox($MB_SYSTEMMODAL, "TokenPrivileges", $SE_TIME_ZONE_NAME & " enabled!") ; Disable _Security__SetPrivilege($hToken, $SE_TIME_ZONE_NAME, False) MsgBox($MB_SYSTEMMODAL, "TokenPrivileges", $SE_TIME_ZONE_NAME & " disabled!") EndIf ; Close handle when done _WinAPI_CloseHandle($hToken) EndIf ;_Date_Time_SetTimeZoneInformation Example Below Here Func Example() Local $aOld, $aNew ; Create GUI GUICreate("Time", 400, 300) $iMemo = GUICtrlCreateEdit("", 2, 2, 396, 296, $WS_VSCROLL) GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New") GUISetState(@SW_SHOW) ; Show current time zone information $aOld = _Date_Time_GetTimeZoneInformation() ShowTimeZoneInformation($aOld, "Current") ; Set new time zone information If Not _Date_Time_SetTimeZoneInformation($aOld[1], "GMT Standard Time", $aOld[3], $aOld[4], "GMT Daylight Time", $aOld[6], $aOld[7]) Then MsgBox($MB_SYSTEMMODAL, "Error", "System time zone cannot be SET" & @CRLF & @CRLF & _WinAPI_GetLastErrorMessage()) Exit EndIf ; Show new time zone information $aNew = _Date_Time_GetTimeZoneInformation() ShowTimeZoneInformation($aNew, "New") ; Reset original time zone information ; _Date_Time_SetTimeZoneInformation($aOld[1], $aOld[2], $aOld[3], $aOld[4], $aOld[5], $aOld[6], $aOld[7]) ; Show current time zone information ;$aOld = _Date_Time_GetTimeZoneInformation() ;ShowTimeZoneInformation($aOld, "Reset") ; Loop until the user exits. Do Until GUIGetMsg() = $GUI_EVENT_CLOSE EndFunc ;==>Example ; Write a line to the memo control Func MemoWrite($sMessage) GUICtrlSetData($iMemo, $sMessage & @CRLF, 1) EndFunc ;==>MemoWrite ; Show time zone information Func ShowTimeZoneInformation(ByRef $aInfo, $comment) MemoWrite("******************* " & $comment & " *******************") MemoWrite("Result ............: " & $aInfo[0]) MemoWrite("Current bias ......: " & $aInfo[1]) MemoWrite("Standard name .....: " & $aInfo[2]) MemoWrite("Standard date/time : " & _Date_Time_SystemTimeToDateTimeStr($aInfo[3])) MemoWrite("Standard bias......: " & $aInfo[4]) MemoWrite("Daylight name .....: " & $aInfo[5]) MemoWrite("Daylight date/time : " & _Date_Time_SystemTimeToDateTimeStr($aInfo[6])) MemoWrite("Daylight bias......: " & $aInfo[7]) EndFunc ;==>ShowTimeZoneInformation
-
I recompiled with a newer version. Problem still exists, but a different error. Specifically: If Not _Date_Time_SetTimeZoneInformation($aOld[1], "GMT Standard Time", $aOld[3], $aOld[4], "GMT Daylight Time", $aOld[6], $aOld[7]) Then MsgBox($MB_SYSTEMMODAL, "Error", "System time zone cannot be SET" & @CRLF & @CRLF & _WinAPI_GetLastErrorMessage()) Exit EndIf Outputs this MSGBOX: Clearly the _Date_Time_SetTimeZoneInformation function is returning FALSE to trigger the message box, but strange that the _WinAPI_GetLastErrorMessage function returns "The operation completed successfully" now. Regardless, the task is not working - timezone is not being set. Again, I could use the workaround (not tested), but I'm curious as to why the example doesn't work out of box.
-
Biggest noob questions of the day.. sorry
MrBeatnik replied to Srex's topic in AutoIt General Help and Support
Not quite... You don't need the IFs - the CASE does the IF work for you. Switch $WindowSensInput Case 1 ;Checks if $WindowSensInput = 1 $ActualWindowSens = 0.031 Case 2 ;Checks if $WindowSensInput = 2 $ActualWindowSens = 0.222 Case 3 ;Checks if $WindowSensInput = 3 $ActualWindowSens = 0.333 ; Case n ;Checks if $WindowSensInput = n ; $ActualWindowSens = whatever Case Else ;Checks if $WindowSensInput = any other value not stated Msgbox(16,"Error","Your value is outside the range allowed") EndSwitch -
Error - Cannot assign values to constants
MrBeatnik replied to mLipok's topic in AutoIt General Help and Support
I don't get this issue. Const Enum in my include works fine: test1.au3: #include <test2.au3> msgbox(0,"End test", "Complete") test2.au3: Global Enum $iSQL_PodstawoweDaneAdresowe_Nazwa123_MrBeatnik1 Global Enum $iSQL_PodstawoweDaneAdresowe_Nazwa123_MrBeatnik2 Global Enum $iSQL_PodstawoweDaneAdresowe_Nazwa123_MrBeatnik3 msgbox (0,"Include Works","No errors detected") -
Biggest noob questions of the day.. sorry
MrBeatnik replied to Srex's topic in AutoIt General Help and Support
Yep (Geir1983 posted an example of CASE too). -
Error - Cannot assign values to constants
MrBeatnik replied to mLipok's topic in AutoIt General Help and Support
What is the code from line 1 - 3 on "Z:TOOLsMacroKK_SQL.au3" ? -
Biggest noob questions of the day.. sorry
MrBeatnik replied to Srex's topic in AutoIt General Help and Support
Is there only 1 user input (that can have 12 outcomes)? If so you could use the CASE help documentation, but IF/ELSEIF/ELSE/ENDIF would work... assuming I understood your question correctly. -
Error - Cannot assign values to constants
MrBeatnik replied to mLipok's topic in AutoIt General Help and Support
Without code, I would give this advice: A constant contains a value and can never be changed. A variable can contain a value that can be changed. So you are declaring a constant, and then trying to change it after declaring... can't be done. -
Yep, very fishy. If you are trying to do something that is legit (like creating a kiosk PC), I would suggest replacing the shell and/or locking down privileges instead.