AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How to parse Multiple Selections in a Listbox

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
steffen



Joined: 06 Feb 2005
Posts: 3

PostPosted: Fri Feb 25, 2005 12:48 pm    Post subject: How to parse Multiple Selections in a Listbox Reply with quote

Hi,

my Problem is when I select multiple Listbox Items and then running a cmd with the Variable it do not Work. With only one Selection it runs.

Please could anyone give me an Tip how.....

Here is a portion of the Script I made first:
Code:
Loop, read, Listen\Serverwave1.txt,
   {
      GuiControl,, Serverlist, %A_LoopReadLine%
       }
       return

Serverlist:
        {
        GuiControlGET, Serverlist ; Empfängt die Benutzerauswahl in der ListBox
        return
        }

Button1:
        GuiControlGet, Button1 ; Auswahlbutton für Notes stop !
        ifExist, Listen\Notesservicewave1-status.log, Filedelete,  Listen\Notesservicewave1-status.log
        runwait, %comspec% /C pstools\psservice.exe \\%Serverlist% query Lotus >Listen\%Serverlist%-info.txt
        FileRead, Dienststatus, Listen\%Serverlist%-info.txt
        IfinString, Dienststatus, 4  Running, FileAppend, %Serverlist% - Lotus Notes - Datum/Uhrzeit - is running, Listen\Notesservicewave1-status.log
        Else
        IfinString, Dienststatus, 2  Pending, FileAppend, %Serverlist% - Lotus Notes - Datum/Uhrzeit - is pending, Listen\Notesservicewave1-status.log
        Else
        IfinString, Dienststatus, 1  Stopped, FileAppend, %Serverlist% - Lotus Notes - Datum/Uhrzeit - is stopped, Listen\Notesservicewave1-status.log

Thx...
Back to top
View user's profile Send private message
toralf



Joined: 31 Jan 2005
Posts: 3842
Location: Bremen, Germany

PostPosted: Fri Feb 25, 2005 1:50 pm    Post subject: Reply with quote

Your problem isn't clear to me. Please be more specific.
(Kannst auch in Deutsch schreiben, obwohl in English die Chance größer ist eine passende Antwort zu bekommen.)

And please use the "code" "/code" options when you put code in a post, it preserves the indentation.

Ok, and as a blind shot:
You have to parse the result from the list with a loop. See manual for multiselection of listbox.
_________________
Ciao
toralf
Back to top
View user's profile Send private message Send e-mail Visit poster's website
steffen



Joined: 06 Feb 2005
Posts: 3

PostPosted: Fri Feb 25, 2005 2:00 pm    Post subject: Genauere Beschreibung ! Reply with quote

Hi Toralf,

danke für deine schnelle Antwort. Ich bin neu und habe so einiges nicht richtig verstanden. Was ich machen wollte:

1. Ich habe eine Gui gebaut mit 2 Listboxen und 3 Button.
2. Aus einer Textdatei werden die Servernamen ausgelesen.
3. Wenn ich jetzt in der Listbox mehrere Server auswähle und diesen String dann an die cmd übergebe, funktioniert der cmd nicht mehr, da im String alle Server drin stehen. Ich habe noch nicht verstanden wie man Zeilenweise aus einem String ausliest und dann für jeden selektierten Server einen cmd-befehl absetzt.

Hast du einen Tip wie ich das machen kann Danke Surprised
Back to top
View user's profile Send private message
BoBo
Guest





PostPosted: Fri Feb 25, 2005 2:22 pm    Post subject: Reply with quote

Quote:
Wenn ich jetzt in der Listbox mehrere Server auswähle und diesen String dann an die cmd übergebe, funktioniert der cmd nicht mehr, da im String alle Server drin stehen
Du must die ListVariable gegen die Separatoren | splitten.

Code:
StringSplit, Server, ListVar, |
Loop, %Server0%
{
     Server := Server%A_Index%
     Run, net use \\%Server% ...,, Hide
}
Back to top
toralf



Joined: 31 Jan 2005
Posts: 3842
Location: Bremen, Germany

PostPosted: Fri Feb 25, 2005 2:24 pm    Post subject: Reply with quote

Klar habe ich einen. (Bobo kann Dir bezüglich Netzwerkdingen besser helfen)

I switch to english:

When you get the string form the listbox, use a StringSplit or "Loop,Parse" (see manual for both) to get the individual servers.
Then you can perform of each of the serves the action you want.

OR: you could also store the server in an array and only retrieve from the list the position of the servers in the list. This is nice if you only want to show part of the information to each server in the list, but need more data to perform actions with the server.

In case you need more help, give us some more lines of code, that we could understand and work on. (We are not interessted in your server list)
_________________
Ciao
toralf
Back to top
View user's profile Send private message Send e-mail Visit poster's website
steffen



Joined: 06 Feb 2005
Posts: 3

PostPosted: Fri Feb 25, 2005 2:32 pm    Post subject: It´s working !! Reply with quote

Hi Toralf,

es funktioniert jetzt. Manchmal erkennt man den Wald vor lauter Bäumen nicht Wink nochmals vielen dank für die schnelle Hilfe !!

Das nächstemal werde ich mir mehr Mühe geben beim Code übermitteln.

Echt super wie schnell hier geholfen wird einfach klasse Smile

Da hat die ct´ mal wieder recht gehabt.
Back to top
View user's profile Send private message
BoBo
Guest





PostPosted: Fri Feb 25, 2005 2:39 pm    Post subject: Reply with quote

@ steffen
Hast du dich schon [hier] als Member eingeschrieben ?
Nein - na dann wirds aber Zeit! Wink
Back to top
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group