Sign in to follow this  
Followers 0
ledigeine

Available network paths

12 posts in this topic

Honestly i didnt know what to search for with this issue so i couldnt find one item related to this.

The utility im making will allow people to pick a tree view item then map drives based on the tree view. The treeview looks to a xml file that holds the path for a network folder.

As of now i am manually putting all the items in the XML file and have to update the autoit script to match the xml (the tree items have to match the xml items so they can display and map the drive correctly)

So i was wondering if anybody knows of a tool that would check a path for all available folders or something. Right now we hold version of a program, 7.0 to 12.0. If we add a 12.1 or 13.0 my xml file will need to be updated but so will the code.

Anybody have any ideas how i can handle this? I mean best case would be to make it so the xml only needs updating but i have no clue how to do that. I mean if a new 13.0 folder is added to the network at a location i can assume it will be, how would you set things up to see it then add it to the list of available options.

sorry if this is vauge or something, let me know what info would help you help me ;)

Share this post


Link to post
Share on other sites



Asked around here at work a bit, somebody said to have the script holding the treeview im using, compare to a script that 'parses' (who knows if that word is the right one for this case ;) ) the network location where these versioned folders will be held.

So if the tree file does not contain something the network does, the network script could add items to the treeview. Then same the other way, if the tree has items that no longer exist on the network it can delete the tree items.

How to do this? no clue. ha

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

provide the XML (remove sensitive information), and I can show you how to pull out information of a given XPATH (parsing the xml)using:

$sXMLFile = "DirAndXMLFile"$sXMLFile = "DirAndXMLFile"
$sXPath = "//items/item[@name='racecar']/@test" ; example


$oXML=ObjCreate("Microsoft.XMLDOM")

$oXML.Load($sXMLFile)
ConsoleWrite ( $oXML.xml & @CRLF)
$result = $oXML.selectNodes($sXPath)

$iCounter = 1
Dim $aArray[$iCounter]
For $Node In $result
  redim $aArray[$iCounter]
  $aArray[$iCounter] = $Node.value
  $iCounter = $iCounter + 1
Next
Edited by jdelaney

IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Hmm I already pull data from the XML but are you saying you will show me how to make the xml check a network location and create new elements/attributes/ect based on what is found on the network?

I'll try to clean up the XML of info i dont wana show, and post it. Dont make fun of my structure ;) i just took a 2 day class on xml like 4 weeks ago haha so thats all i know.

test.xml

Edited by ledigeine

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

oh, no, i can tell you how to add nodes, but don't have the expertise to get the data you need to add.

Here is a simple sample to create, and append the node:

$oXML=ObjCreate("Microsoft.XMLDOM")
$stest = @DesktopDir & "xml.xml"
$oXML.Load($stest)
ConsoleWrite ( $oXML.xml & @CRLF)
$oNode = $oXML.CreateElement('NEW')
$result = $oXML.selectNodes('//test')
For $Node In $result
$Node.AppendChild($oNode)
Next
ConsoleWrite ( $oXML.xml & @CRLF)


;;;example to add attribute:
$oNode = $oXML.CreateElement('NEW')
$oNode2 = $oXML.CreateElement('New2')
$oAttribute = $oXML.createAttribute("my_attrib")
$oNode2.setattributeNode($oAttribute)
$oNode2.text = "Test"
$oNode.AppendChild($oNode2)

; output will be <NEW><New2 my_attrib="">Test</New2></NEW>

The output is:

<test>

<DIV>test</DIV>

<DIV>test</DIV>

<DIV>test</DIV>

</test>

Then after:

<test>

<DIV>test</DIV>

<DIV>test</DIV>

<DIV>test</DIV>

<NEW/></test>

Edited by jdelaney

IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.

Share this post


Link to post
Share on other sites

Ok thank you sir, ill have to look into this more to see how i can check a network location then add/delete nodes based on the folders in that location.

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

someone posted this earlier...not sure if it's what you need:

#include <NetShare.au3>
#include <Array.au3>
#include <Constants.au3>
#RequireAdmin

Local $aArray = _GetNetView()
_ArrayDisplay($aArray)
Exit

Func _GetNetView() ; Based on the idea by AoRaToS: [url="http://www.autoitscript.com/forum/topic/...p-needed/page__view__findpost"]http://www.autoitscript.com/forum/topic/...p-needed/page__view__findpost[/url]_
    Local $sData = _RunStdOutRead('net view', @SystemDir)
    Local $aArray = StringRegExp('ListComputers-CountIndex' & @CRLF & $sData, '([w-]*)', 3)
    If @error Then
        Local $aError[2][2] = [[1, 2],[@ComputerName, @IPAddress1]]
        Return SetError(1, 0, $aError)
    EndIf
    $aArray[0] = UBound($aArray, 1) - 1
    Local $aReturn[$aArray[0] + 1][2] = [[$aArray[0], 2]]
    For $i = 1 To $aArray[0]
        $aReturn[$i][0] = $aArray[$i]
        $aReturn[$i][1] = TCPNameToIP($aArray[$i])
    Next
    Return $aReturn
EndFunc   ;==>_GetNetView
Func _RunStdOutRead($sCommand, $sWorkingDirectory = @SystemDir)
    Local $iPID = Run(@ComSpec & ' /c ' & $sCommand, $sWorkingDirectory, @SW_HIDE, $STDOUT_CHILD + $STDERR_CHILD), $sOutput = ''
    While 1
        $sOutput &= StdoutRead($iPID)
        If @error Then
            ExitLoop
        EndIf
    WEnd
    Return $sOutput
EndFunc   ;==>_RunStdOutRead
Edited by jdelaney

IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.

Share this post


Link to post
Share on other sites

Actually that looks like something that might be related. Its just showing me computer names as of now.

Not 100% why the computernames I am seeing are showing up, maybe those computers have shares im part of? idk.

Thnx for finding this I will have to try to understand the whole thing and see if i can point it at the network path i need, then look for folders and not computer names.

Share this post


Link to post
Share on other sites

hahaha, duh, you just need to check a directory for a file that is not present in your xml...that's easy: look into _file.* functions. Read in all the Folders you have on the parent dir, and then compare those against the XML...add as necessary...all the building blocks are above


IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.

Share this post


Link to post
Share on other sites

someone posted this earlier...not sure if it's what you need.

That someone was me.
1 person likes this

_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 04/09/2015

Share this post


Link to post
Share on other sites

hahaha, duh, you just need to check a directory for a file that is not present in your xml...that's easy: look into _file.* functions. Read in all the Folders you have on the parent dir, and then compare those against the XML...add as necessary...all the building blocks are above

Ok it looks like i can use _FileListToArray to check the network location for folders, I am trying to figure out a way to make this filer based on if the folder has a "." in the name. Because there are other folders there that are not based on a version number.

So i have a bunch like 11.1 12.0 10.8 then some random one witha real name.

The filter section of the function doesnt seem to understand my "*.*" filter ha so it must be more complicated than that.

After i get this down i just have to find commands to update xmls which im sure i can search for.

Share this post


Link to post
Share on other sites

Figured out my issue, if i filter like this "??.??" then that will pull only folders that are version numbers like 11.1 12.0 9.2

Now on to figuring out how to update(del/add) xml nodes based on this new data i get.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0