StillLearningThisStuff Posted April 12, 2011 Share Posted April 12, 2011 Hi Guys, I have a menu (on USB stick) with multiple buttons that perform different functions; one of the functions is to open a peice of software that is loaded onto the server and accessed through a standardized mapped network drive. The problem is we have multiple sites that have their own servers and there are different versions of this software on each server (multiple version on some servers). So rather than hard coding the directory structure for each version I want to read the directories (they are labeled by version number) and automatically choose to run the app from the newest version. Directory structure example: Constant = Z:\mgmt\ConsoleOne\ Variable directories = 1.2 1.3.6d_Build_11 2nd Constant = \Bin\ConsoleOne.exe So it might be Z:\mgmt\ConsoleOne\1.2\Bin\ConsoleOne.exe or it could be Z:\mgmt\ConsoleOne\1.3.6d_Build_11\Bin\ConsoleOne.exe and obviously when a newer version comes out it will be something else again; hence I don't want to hard code it and have to change it everytime a newer version comes out. I was thinking either something to read the folder names and run the latest or a drop down box that is auto populated depending on what folder names a search finds. I am guessing it will require an array? ......never done that before Any advise/help would be much appreciated Cheers, Luxyboy Link to comment Share on other sites More sharing options...
somdcomputerguy Posted April 12, 2011 Share Posted April 12, 2011 See FileOpenDialog in the Help file. - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change. Link to comment Share on other sites More sharing options...
smartee Posted April 12, 2011 Share Posted April 12, 2011 You seem to be thinking on the right track, search _FileListToArray() in the help file and see where it takes you. Link to comment Share on other sites More sharing options...
StillLearningThisStuff Posted April 12, 2011 Author Share Posted April 12, 2011 Thanks guys, I'll check it out Link to comment Share on other sites More sharing options...
4Eyes Posted April 12, 2011 Share Posted April 12, 2011 StillLearningThisStuff, What a pleasure to see somebody else still using Netware. 2 things come to mind for me... 1) why not just install any new versions in the same directory eg Z:\mgmt\ConsoleOne\ 2) can you remotely create a zen app to point to the latest? In any case, I doubt VERY seriously that you'll see any new versions of anything from Novell as the company has been sold, supposedly to MS and Novell haven't actively supported Netware for quite a while now. How sad.... I've worked with it since version 1.01 and have seen Netware 4.61 (not even Advanced Netware)... used green screen terminals with RS-232 connection. 4Eyes Link to comment Share on other sites More sharing options...
StillLearningThisStuff Posted April 12, 2011 Author Share Posted April 12, 2011 (edited) 4Eyes - If only I was the server admin they would be all updated to the latest and all in the same folder name, but I'm not allowed even though I have the access and I am trying to keep it all together on the USB stick to simplify it for new staff So the following will create the array list and show me what it is or "no folders found" if the dir is empty. #Include <File.au3> #Include <Array.au3> $Path=("Z:\mgmt\ConsoleOne\") $Filter="*" $Flag=2 $FileList=_FileListToArray($Path , $Filter , $Flag) If @Error=4 Then MsgBox (0,"","No Folders Found.") Exit EndIf _ArrayDisplay($FileList,"FileList") This code Displays: Row Col 0 [0] 2 [1] 1.2 [2] 1.3.6d_Build_11 Which is the directories within Z:\mgmt\ConsoleOne\ Now how do I read the Row 0 Col 0 data and then convert it to be the number used to select the Row then used to get the data I need as a variable (being the last with data) eg. obviously not real code $Path=("Z:\mgmt\ConsoleOne\") $rowtobeused = $array[0] ***Which is the number of Files\Folders returned as per the help file*** $dataineed = ($rowtobeused, Col 0) $exelocation = ("\Bin\ConsoleOne.exe") run = ($Path & $dataineed & $exelocation) Having trouble articulating what i want but hopefully someone follows Edited April 12, 2011 by StillLearningThisStuff Link to comment Share on other sites More sharing options...
smartee Posted April 12, 2011 Share Posted April 12, 2011 this is the quickest thing i could come up with, please excuse any errors, its untested, and i'm sleepy#include <Array.au3> #include <File.au3> #include <ButtonConstants.au3> #include <ComboConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> $ini = @ScriptDir & "\launchSettings.ini" $root = IniRead($ini, "path", "root", "NotFoundRoot") $app = IniRead($ini, "path", "app", "NotFoundApp") $folderVersions = _FileListToArray($root, "*", 2) If Not $folderVersions Then MsgBox(0, "", "No Folders Found.") Exit EndIf #Region ### START Koda GUI section ### Form= $Form2 = GUICreate("Form2", 234, 114, 283, 298) $Combo1 = GUICtrlCreateCombo("", 8, 32, 217, 25, BitOR($CBS_DROPDOWNLIST, $CBS_AUTOHSCROLL, $CBS_SORT)) GUICtrlSetData(-1, _ArrayToString($folderVersions, "|", 1, $folderVersions[0]), $folderVersions[1]) $Label1 = GUICtrlCreateLabel("Select version to run:", 8, 8, 104, 17) $Button1 = GUICtrlCreateButton("Launch", 8, 64, 217, 41) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 $version = GUICtrlRead($Combo1) ShellExecute($root & $version & $app) EndSwitch WEnd launchSettings.ini:[path] root=Z:\mgmt\ConsoleOne\ app=\Bin\ConsoleOne.exe Link to comment Share on other sites More sharing options...
StillLearningThisStuff Posted April 14, 2011 Author Share Posted April 14, 2011 Thanks for the help guys I figured out how to do it the way I wanted: $Path =("Z:\mgmt\ConsoleOne\") $Filter = "*" $Flag = 2 $FileList=_FileListToArray($Path) $App =("\bin\ConsoleOne.exe") $Version = $FileList[0] $UsedVersion = $FileList[$Version] $C1 = GUICtrlCreateButton("Console One", 20, 180, 105) GUICtrlSetOnEvent($C1, "C1") Func C1() _FileListToArray($Path , $Filter , $Flag) If @Error=4 Then MsgBox (0,"","No Folders Found.") Exit EndIf ShellExecute($Path & $UsedVersion & $App) EndFunc ;==>C1 Link to comment Share on other sites More sharing options...
StillLearningThisStuff Posted April 14, 2011 Author Share Posted April 14, 2011 Is there a way to change the subject title of this post? I just want to make it more meaningful for future searches by others. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now