Jump to content
Advert

bobbintb

Active Members
  • Posts

    90
  • Joined

  • Last visited

bobbintb's Achievements

Wayfarer

Wayfarer (2/7)

0

Reputation

  1. ok, i think im on the right track. i havent coded in a while so im a little rusty, especially at explaining what im trying to do to others. thanks for the help and patience, melba.
  2. i could just get the drive letter from the combo entry but then i would have to plan for all script breaking eventualities, such as the drive label having parenthesis and determining if what's between the parenthesis is the actual drive letter or part of the drive label. instead of getting the list of removable drives and from that list make a gui with extra info for the user and then reading the control to see what the user selected and parsing it out and making sure that what the script thinks is the drive letter is actually the drive letter, it seems easier for me and more precise do it another way. i had an idea to take the array of drive letter and add another dimension that contains the additional info for the user, then populate the gui with that info. that way i can link the actual drive letter in the first dimension of the array (as opposed to parsed one) to the GUI info in the second, so that when the script checks which item was selected, it can compare the GUICtrlRead with the correct info in the array to make certain the drive letter is correct. now i just need to add a second dimension to the existing array, if i can figure out how to do that.
  3. i thought about that but if anything else in the string, like the label, has parenthesis then that could break something. is there a way to attach a variable to the dropdown? in the loop where GUICtrlSetData is parsing out the extra info, maybe i can also assign a numerical value to each dropdown option. then i can reference it with the array. could i use GUICtrlSetData to set more than one piece of data to the control (an array maybe), and only display to the user the part that i wish? id like to avoid using GUICtrlRead because there are too many ways it could break the script in this instance.
  4. i've been searching the forums but cant quite find a way to do what i need. i have a gui that is supposed to read the removable drives into an array and display them, along with other information in a drop down box. then i want the program to run commands based on what option is selected. the problem i'm facing is that once the array has been parsed into the gui with the additional info, i cant figure a way to keep the array associated with the selected item in the dropdown so that when an option is selected i can still work with the array itself and not all the extra information added for the user's sake. and i can't really just use GUICtrlRead and parse in back because thats just not going to work for my purposes. here's what i have so for: #include <ComboConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> $aArray = DriveGetDrive("REMOVABLE") $Form1_1 = GUICreate("Form1", 615, 437, 264, 339) $Label1 = GUICtrlCreateLabel("Select removeable drive to load Windows onto:", 16, 8, 227, 17) $Combo1 = GUICtrlCreateCombo("", 32, 80, 445, 25, BitOR($CBS_DROPDOWNLIST,$CBS_AUTOHSCROLL)) If @error Then ; An error occurred when retrieving the drives. MsgBox(4096, "DriveGetDrive", "No removable drives found or some other error occured.") Else For $i = 1 To $aArray[0] $label = DriveGetLabel($aArray[$i]) if $label="" then $label ="[no label]" ;~ MsgBox(4096,"",$aArray[$i]) GUICtrlSetData(-1, $label& " (" &StringUpper($aArray[$i]) & ") " & Round(DriveSpaceTotal($aArray[$i]), 0) & " MB Total" & " Windows Volume ID: " & DriveGetSerial($aArray[$i])) Next EndIf ;~ GUICtrlSetState(-1, $GUI_DISABLE) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE ;~ MsgBox(4096,"test",GUICtrlRead($Combo1,1)) Exit EndSwitch WEnd the easiest and most effective thing i can think of is to somehow query the order number of the item in the drop down is selected (meaning the nth option is selected) and plug that into my $aArray. i just cant think of how to do it. any help would be appreciated.
  5. got it! thanks so much.
  6. that worked great but now i have a problem. i added some lines to do the same thing but with a button as well. here is the code: #include <GUIConstantsEx.au3> #include <UpdownConstants.au3> #include <EditConstants.au3> Global $aInputs[15] Global $bInputs[15] $hGUI = GUICreate("Test", 500, 500) $hInput = GUICtrlCreateInput(1, 10, 10, 40, 20, $ES_READONLY) $hUpDown = GUICtrlCreateUpdown(-1, $UDS_WRAP) $bInput = GUICtrlCreateButton("Browse", 230, 50, 65, 20) GUICtrlSetLimit($hUpDown, 15, 1) For $i = 0 To 14 $aInputs[$i] = GUICtrlCreateInput("", 10, 50 + ($i * 30), 200, 20) $bInputs[$i] = GUICtrlCreateButton("Browse", 230, 50 + ($i * 30), 65, 20) If $i Then GUICtrlSetState(-1, $GUI_HIDE) EndIf Next GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $hUpDown $iCount = GUICtrlRead($hInput) For $i = 0 To $iCount - 1 GUICtrlSetState($aInputs[$i], $GUI_SHOW) GUICtrlSetState($bInputs[$i], $GUI_SHOW) Next For $i = $iCount To UBound($aInputs) - 1 GUICtrlSetState($aInputs[$i], $GUI_HIDE) Next For $i = $iCount To UBound($bInputs) - 1 GUICtrlSetState($bInputs[$i], $GUI_HIDE) Next EndSwitch WEnd problem is when i run it i get the full 15 inputs at first unless i remark out the this line: $bInputs[$i] = GUICtrlCreateButton("Browse", 230, 50 + ($i * 30), 65, 20) i dont understand why adding it would affect the other.
  7. ah! very sneaky. i like. hadnt even thought of that. thanks, i'll give it a shot.
  8. so im having a little programmers block and thought id ask for help. i have an updown button called $updown that ranges from 1 to 15 with 1 as the default. i want the code create a number of input boxes with browse buttons based on the number in the updown. so if 7 in the number in updown, there should be 7 inputs with 7 browse buttons. i also need it to correct itself. so for instance i go to 8 and then down one to 7, it needs to delete the last one. right now i just have the gui call this function when $updown is clicked. heres what i have so far: Func browseforvidarray() $i=1 Do ;~ MsgBox(0, "", $i) $videoinput[$i-1] = GUICtrlCreateInput("", 16, 136+25*$i, 417, 21) $videolook[$i-1] = GUICtrlCreateButton("Browse", 444, 132+25*$i, 65, 25) $i=$i+1 redim $videoinput[$i+1] redim $videolook[$i+1] until $i>=GUICtrlRead($input)+1 EndFunc
  9. yep, thats what i found and its what i was looking for. thanks again.
  10. aha! i actually accidentally stumbled across my answer. thanks for the help.
  11. thank you but that is not quite what im looking for. let me clarify a little. the autoit program i am writing isnt meant to be run without any arguments. so i plan on calling the program something like "mdlnk". it will handle ini files with the extension ".mdlnk". the issue im having is not with file association but with getting the autoit program to handle arguments. the program will never be run by "double clicking" on "mdlnk.exe" but will be run by opening a "*.mdlnk" file. the problem i have is once the file is associated, how do i pass arguments to the program so it knows what to do? i know how to write an autoit program to open a file but i dont know how to get an autoit program to handle a file passed to it .
  12. so i tried to find the answer to this but couldnt. heres what i want to do. i am making a program that handles a filetype. the filetype is just a made up extension but its basically just an ini or text file. i want to be able to doubleclick on the filetype and have it open with the autoit exe where autoit would read the file and perform the rest of its function. i just dont know how to go about it. any ideas?
  13. i still cant seem to it. heres what i have: If @error = 0 Then _GUICtrlListBox_ReplaceString($List1, $i - 1, "SUCCESS! - " & $array[$i - 1][0]) GUICtrlSetColor($List1, 0x49E20E) Else _GUICtrlListBox_ReplaceString($List1, $i - 1, " Failed: Error - " & $array[$i - 1][0]) GUICtrlSetColor($List1, 0xff0000) EndIf i got it to change the line. but the change GUICtrlSetColor changes the entire control when i only want that line changed.
  14. thanks, i think that got me in the right direction. why do you say my autoit is a bit old? i have the latest. im probably just doing something in a roundabout way.
  15. i have a list control: $List1 = GUICtrlCreateList($array, 8, 8, 505, 409, BitAND($LBS_DISABLENOSCROLL, $LBS_NOINTEGRALHEIGHT, $LBS_NOSEL, $LBS_NOTIFY, $LBS_STANDARD, $LBS_USETABSTOPS)) i add items to the list though a redim and fileselectfolder command. the problem i am having is there is a point in my script where it goes through the items in the list and i want to change the color of the text as it processes. for example, the script processes the first item in the list. if that went well is changes the text green, or maybe even adds "success" the the end. it keeps doing this until all items are processed. i know how to change the color but i cant figure how to change it line by line.
×
×
  • Create New...