|
|
|||||||
Hello, ich have a Problem to become a value as an variable. I have the variable $localdrive_H = "\\Fileserver\share" i build the new variable with $drive = LEFT($localdrive_H, 1) $NewVariable = "$localdrive_" + $drive The variable $NewVariable has the value $localdrive_H when i use this in use h: $NewVariable i become an errer because the Value of this is $localdrive_H and not \\Fileserver\share how can i become the right value? can everyone help me? Regards Michael |
||||||||
|
|
|||||||
Hi and welcome to the board. You do a $drive = Left($localdrive_H, 1). This will put \ in the $drive variable. When this is added to the $localdrive_ variable (which is empty) it will result in incorrect values. If I look at your script all you want to do is map the H drive so why can’t you just do: use H: $localdrive_H? |
||||||||
|
|
|||||||
Dynamic variables can be achieved using Execute(), but like Mart pointed out...your Left() results in a \. Not real sure what you're trying to accomplish. |
||||||||
|
|
|||||||
Hello, oh sorry, i mean right! With Execute ()??? Regards Michael |
||||||||
|
|
|||||||
This works but I still don't get it. Using Use h: $localdrive_H will do exactly the same. Why make it more complex than it is? I doubled the $ in the Right function to stop kix from resolving it to the actual value. In your example it resolves the variable to the actual value giving you an e (from \\fileserver\share). Code: $localdrive_H = "\\Fileserver\share" $drive = Right("$$localdrive_H", 1) $NewVariable = "$localdrive_" + $drive Use h: $NewVariable |
||||||||
|
|
|||||||
Hello! here is my right script. Code: $lokalDrive_G = "\\filesrv001\log$" For $Count = 65 To 90 Step 1 $L = Chr ($Count) $LD = $L + ":" $LDR = ("$lokalDrive_" + $L) $LDRIVE = execute ('$$LDR') ? $LDRIVE ; This variable has the value 0 when the variable $LDR have the value "$lokaldrive_G". What can i do to become the value \\filesrv001\log$ ??? If $LDRIVE <> NULL $Counter = 0 DO $Counter = $Counter + 1 ? $Counter ? $LD ? $L ? "$lokalDrive_" + $L If Exist ($LD) = 1 Use $LD /Del Use $LD $LDRIVE Else Use $LD $LDRIVE EndIf Until Exist($LD) = 1 or $Counter = 5 If Exist ($LD) = 0 MessageBox ("ACHTUNG! Kein " + $L + "-Laufwerk vorhanden! Evtl. sind Sie nicht richtig am Netzwerk angemeldet.", "@TIME", 0) $Error = $L + " " EndIf EndIf Next Can everyone help me? Regards Michael |
||||||||
|
|
|||||||
not sure what you want help with. You don't need the execute... And kixtart doesn't have null so that test will always pass. |
||||||||
|
|
|||||||
i will ? $LDRIVE ; This variable has the value 0 when the variable $LDR have the value "$lokaldrive_G". What can i do to become the value \\filesrv001\log$ ??? This is a construct variable about $lokalDrive_G = "\\filesrv001\log$" my target is to show if the variable $lokalDrive_A....Z has an value and when it is, then connect the network drive. Regards Michael |
||||||||
|
|
|||||||
I get you. replace these lines: Code: $LDR = ("$lokalDrive_" + $L) $LDRIVE = execute ('$$LDR') ? $LDRIVE ; This variable has the value 0 when the variable $LDR have the value "$lokaldrive_G". What can i do to become the value \\filesrv001\log$ ??? If $LDRIVE <> NULL with these: Code: $LDR = "$$lokalDrive_" + $L $junk = execute ('$$LDRIVE="'+$LDR+'"') ? $LDRIVE ; This variable has the value 0 when the variable $LDR have the value "$lokaldrive_G". What can i do to become the value \\filesrv001\log$ ??? If $LDRIVE <> "" |
||||||||
|
|
|||||||
I like Execute(). |
||||||||
|
|
|||||||
Hello, this was the right hint. Here is my script. Code: $lokalDrive_G = "\\Server\Share" For $Count = 65 To 90 Step 1 $L = Chr ($Count) $LD = $L + ":" $LDR = "$$lokalDrive_" + $L $junk = execute ('$$LDRIVE="'+$LDR+'"') If $LDRIVE <> $LDR $Counter = 0 DO $Counter = $Counter + 1 If Exist ($LD) = 1 Use $LD /Del Use $LD $LDRIVE Else Use $LD $LDRIVE EndIf Until Exist($LD) = 1 or $Counter = 5 If Exist ($LD) = 0 MessageBox ("ACHTUNG! Kein " + $L + "-Laufwerk vorhanden! Evtl. sind Sie nicht richtig am Netzwerk angemeldet.", "@TIME", 0) $Error = $L + " " EndIf EndIf Next Thank you for all!!! Regards Michael |
||||||||
|
|
|||||||
can I ask what you are testing for here: If $LDRIVE <> $LDR they are always different, again. LDR will always have "lokaldrive_" in it and LDRIVE will either be empty or have UNC. but still they are always different. |
||||||||
|
|
|||||||
On a sidenote...Jooel, the '<' symbol does not show correctly when you post prep the above code. |
||||||||
|
|
|||||||
And I disagree. I would thank that $LDRIVE and $LDR will ALWAYS be equal. The line before the check actually sets $LDRIVE to $LDR in the execute statement. They will always be equal unless something in the execute goes wrong. |
||||||||
|
|
|||||||
Originally Posted By: Lonkero can I ask what you are testing for here: If $LDRIVE <> $LDR they are always different, again. LDR will always have "lokaldrive_" in it and LDRIVE will either be empty or have UNC. but still they are always different. |
||||||||
|
|
|||||||
Yeah. When I run the script...It never gets inside that first IF block. |
||||||||
|
|
|||||||
shane, the LDRIVE is set to the value inside LOKALDRIVE_X LDR will always be LOKALDRIVE_X if LOKALDRIVE_X contains \\server\share that if will be: Code: if "LOKALDRIVE_X" <> "\\server\share" always different. |
||||||||
|
|
|||||||
les, what you mean also the if? the first if is outside. |
||||||||
|
|
|||||||
Gotcha...My mistake. I missed the very first line of his script (before the looped script). The weird thing is that the <> check is still needed. For some reason if LOKALDRIVE_X is never defined in the list of mappings, the execute sets it to the name of the variable, not blank. When I run the code, they all appear equal except for the G which is the one defined at the beginning of the script. It's weird that the execute simply uses the variable name when it isnt defined. |
||||||||
|
|
|||||||
Originally Posted By: Lonkero les, what you mean also the if? the first if is outside. |
||||||||
|
|
|||||||
It's something with the quotes. Change this line: Code: $junk = execute ('$$LDRIVE="'+$LDR+'"') Code: $junk = execute ('$$LDRIVE='+$LDR) It then sets it to blank if not defined instead of to the variable name. Code: $lokalDrive_G = "\\Server\Share" For $Count = 65 To 90 Step 1 $L = Chr ($Count) $LD = $L + ":" $LDR = "$$lokalDrive_" + $L $junk = execute ('$$LDRIVE='+$LDR) If $LDRIVE $Counter = 0 DO $Counter = $Counter + 1 If Exist ($LD) = 1 Use $LD /Del Use $LD $LDRIVE Else Use $LD $LDRIVE EndIf Until Exist($LD) = 1 or $Counter = 5 If Exist ($LD) = 0 MessageBox ("ACHTUNG! Kein " + $L + "-Laufwerk vorhanden! Evtl. sind Sie nicht richtig am Netzwerk angemeldet.", "@TIME", 0) $Error = $L + " " EndIf EndIf Next |
||||||||
|
|
|||||||
hmm... it sets it to blank and doesn't error? well, I guess it will but kixtart doesn't give execute() errors so it will work. good catch. |