
ZacUSNYR
Active Members-
Posts
237 -
Joined
-
Last visited
Recent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
ZacUSNYR's Achievements
-
My guess is you're doing that is requiring checking for something that doesn't exist and you have an unhandled exception.
-
Have a script, specifying the icon in AutoIt3Wrapper. Also resource adding other icons to use as shortcuts that call the script with parameters. The issue i'm having is I open it - it opens fine. Windows taskbar shows the icon I specified. If I call it via a shortcut that has a different icon - it uses that shortcuts icon instead of the icon I specified. Anyone ever experience this? I've tried using GUISetIcon but it doesn't change the windows taskbar icon. Any ideas?
-
Wait for one of two buttons to be pressed
ZacUSNYR replied to tk1's topic in AutoIt General Help and Support
You should have an idle loop for a GUI, it sounds like you're not returning from another loop and getting back to the idle loop so the GUI is not responding? Use the idle loop and associate a global variable, just check the global variable? When the button is pressed, update the idle loop. You can start with the button disabled and it enable it when it's available for a press? Post your script and we can check it out. All you're going to get is ideas without seeing what you're doing. -
Communication between DLL and AutoIT
ZacUSNYR replied to dromenox's topic in AutoIt General Help and Support
Use DllOpen and DllCall I'd reference DllOpen as a global and create wrapper functions for the calls that match the DLLs functions. -
I had a situation where I use an Ini file to create an auto it function that returns an array to generate my system tray menu. It needed to be ordered a specific way so I added a displayorder field and kept it a 4 digit int. Reading it in I gathered that field and sort the array. Works great and allows me to move items wherever in the array by changing display id
-
Yea that makes more sense then doing it per column heh
-
ZacUSNYR reacted to a post in a topic: Changes In Array
-
Memory Reading From Two Processes With The Same Name?
ZacUSNYR replied to Mcbovice's topic in AutoIt General Help and Support
Because it's a 2d array ToolTip($pList[1][0],0,0, "Random") -
Oh so you know the server than. Just use the IsOnline function from the script above. If _PC_IsOnline("NAMEOFFILESERVER") Then MsgBox(0, "Connecting Drives", "Hit ok to connect to drives..") ;DriveMapAdd(............. Else MsgBox(0, "Error Reaching Network", "Connect to the network and try again..") EndIf Func _PC_IsOnline($sRPC) Local $iPing, $iError $iPing = Ping($sRPC, 250) If @error Then $iError = @error If $iPing > 0 Then Return 1 Else Return SetError($iError,0,0) EndIf EndFunc
-
My end users run an app I wrote that will self update. I don't want them checking across the WAN so I have location checking. Each location has a different IP subnet, (192.168.*, 192.169.*, etc). So I look at the second octet in the IP. What's your IP structure like between each location? Are Gateways the same or different? Is the machine's OU in a specific location OU? You could query AD for this as well. There are a lot different ways to do it. I did it IP based with a query of WMI to get all active network cards. The array in the function is what determines the server based on client IP. If no servers are found I return the first server to "cache" since my application can run without that connection. $sServer = _PC_GetServerName() If _PC_IsOnline($sServer) Then ConsoleWrite($sServer & " is ON-LINE" & @CRLF) Else ConsoleWrite($sServer & " is OFF-LINE" & @CRLF) EndIf Func _PC_IsOnline($sRPC) Local $iPing, $iError $iPing = Ping($sRPC, 250) If @error Then $iError = @error If $iPing > 0 Then Return 1 Else Return SetError($iError,0,0) EndIf EndFunc Func _PC_GetServerName($sRPC = @ComputerName) Local $objWMIService, $colAdapters, $n, $asIP Local $asServers[4][2] $asServers[0][0] = "SERVER01" $asServers[0][1] = "168" $asServers[1][0] = "SERVER02" $asServers[1][1] = "169" $asServers[2][0] = "SERVER03" $asServers[2][1] = "170" $asServers[3][0] = "SERVER04" $asServers[3][1] = "171" $objWMIService = ObjGet("winmgmts:\\" & $sRPC & "\root\CIMV2") $colAdapters = $objWMIService.ExecQuery ("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = True") $n = 1 For $objAdapter in $colAdapters If Not ($objAdapter.IPAddress) = " " Then For $i = 0 To UBound($objAdapter.IPAddress) If StringLeft($objAdapter.IPAddress($i), 3) = "172" Then $asIP = StringSplit($objAdapter.IPAddress($i), ".", 3) For $m = 0 To UBound($asServers) - 1 If $asServers[$m][1] = $asIP[1] Then Return $asServers[$m][0] Next EndIf Next EndIf $n = $n + 1 Next Return $asServers[0][0] EndFunc
-
My question is, why do you want to "flip" a column? What does it matter? Just write it out the way you'd want it to be outputted? But it's not too complicated, just make a throw away array, size it the same as the current array. Replace the columns on the output to the other array. Example. #include <Array.au3> Global $asTestArray[5][10] __Array2DFillWCrap($asTestArray) _ArrayDisplay($asTestArray, "Starting Array") __Array2DColFlip($asTestArray, 8, 1) _ArrayDisplay($asTestArray, "Array Columns 8 and 1 Flipped") __Array2DColFlip($asTestArray, 2, 9) _ArrayDisplay($asTestArray, "Array Columns 2 and 9 Flipped") Func __Array2DColFlip(ByRef $avArray, $iColA, $iColB) Local $avTempArray[UBound($avArray)][UBound($avArray, 2)] For $i = 0 To UBound($avArray) - 1 For $n = 0 To UBound($avArray, 2) - 1 If $n = $iColA Then $avTempArray[$i][$iColB] = $avArray[$i][$iColA] ElseIf $n = $iColB Then $avTempArray[$i][$iColA] = $avArray[$i][$iColB] Else $avTempArray[$i][$n] = $avArray[$i][$n] EndIf Next Next $avArray = $avTempArray Return EndFunc Func __Array2DFillWCrap(ByRef $avArray) For $i = 0 To UBound($avArray) - 1 For $n = 0 To UBound($avArray, 2) - 1 $avArray[$i][$n] = "Orig Col : " & $n Next Next EndFunc
-
I'm a newbie, any advice really appreciated
ZacUSNYR replied to Morphears's topic in AutoIt General Help and Support
I added Calculator to the GUICreate example in the Help file, used Run to open calc.exe #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 $CreatedButton = GUICtrlCreateButton("Click to Open Calculator", 50, 50, 150, 25) ; Display the GUI. GUISetState(@SW_SHOW, $hGUI) ; Loop until the user exits. While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $idOK ExitLoop Case $CreatedButton Run("calc.exe") ;Run the EXE. EndSwitch WEnd ; Delete the previous GUI and all controls. GUIDelete($hGUI) EndFunc ;==>Example -
How to get console client position??
ZacUSNYR replied to KtosZwanyMna's topic in AutoIt General Help and Support
Huh? Help file WinGetPos Otherwise give us more details. -
Computer name containing the running script
ZacUSNYR replied to Tippex's topic in AutoIt General Help and Support
I just tossed this together and it returns just the servers name in all 3 scenarios I tried (drive letter share, named UNC, IP UNC) #include <Inet.au3> $sPath = _GetScriptServer() ConsoleWrite($sPath & @CRLF) Func _GetScriptServer() Local $asReturn, $sHost If StringLeft(@ScriptDir, 2) <> "\\" Then If DriveGetType(StringLeft(@ScriptDir, 2)) = "Network" Then $asReturn = StringSplit(StringTrimLeft(DriveMapGet(StringLeft(@ScriptDir, 2)), 2), "\", 2) Return $asReturn[0] EndIf Else $asReturn = StringSplit(StringTrimLeft(@ScriptDir, 2), "\", 2) If StringIsAlNum($asReturn[0]) Then ; UNC via Name Return $asReturn[0] Else ; UNC via IP TCPStartup() $sHost = _TCPIpToName($asReturn[0]) TCPShutdown() If StringIsAlNum($sHost) Then Return $sHost Else $asReturn = StringSplit($sHost, ".", 2) Return $asReturn[0] EndIf EndIf EndIf EndFunc -
Computer name containing the running script
ZacUSNYR replied to Tippex's topic in AutoIt General Help and Support
What does @ScriptDir return for you? Is it over a drive letter share? Or is it a UNC path? Is the UNC path the IP or the Name? You could parse out whatever it is, start with a letter, do a DriveMapGet(), if it's a named unc, just parse the string out of it. If it's an IP you'll need to figure out a way to reverse look it up (nslookup?) (why would it matter though? If they are are executing via IP, can't you go back to the IP?)