Ghost21 Posted October 1, 2007 Share Posted October 1, 2007 If $nMsg = $Button7 Then $ret = _GUICtrlListGetSelItemsText($List1) If (Not IsArray($ret)) Then MsgBox(16, "Error", "Unknown error from _GUICtrlListGetSelItemsText") Else For $i = 1 To $ret[0] $printer = StringMid($ret[$i], 12, StringLen($ret[$i])) Run("RunDll32.EXE printui.dll,PrintUIEntry /c\\" & GUICtrlRead($Input5) & " /in\\purcell /n\\" & $server & "\" & $printer) Next EndIf Else EndIf The string that i'm reading looks like ShareName: HP OFFICEJET Now I remove the first 12 characters to get the printername but it stops at the ( Space ) so it only shows me HP How can I get it to read the whole thing... if I grab a different printer that's all attached like HPOFFICEJET3456 it reads it no problem ??? Help please... Link to comment Share on other sites More sharing options...
Nahuel Posted October 1, 2007 Share Posted October 1, 2007 (edited) $printer=StringTrimRight("MY PRINTER HP OFFICEJET",13) MsgBox(0,"",$printer)? Edited October 1, 2007 by Nahuel Link to comment Share on other sites More sharing options...
PsaltyDS Posted October 1, 2007 Share Posted October 1, 2007 What does the string look like BEFORE you start stripping things off? You can probably do better than blindly stripping a set number of characters. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
Ghost21 Posted October 1, 2007 Author Share Posted October 1, 2007 What does the string look like BEFORE you start stripping things off?You can probably do better than blindly stripping a set number of characters. The string that i'm reading looks like ShareName: HP OFFICEJET it always has ShareName: Printerbut if the printer label has a space in the name it stops at the space....ACTUALLYmsgbox(4000,"test",$printer) <--- it shows me the full name... Run("RunDll32.EXE printui.dll,PrintUIEntry /c\\" & GUICtrlRead($Input5) & " /in\\purcell /n\\" & $server & "\" & $printer)Is it losing the other data because of the rundll command ? Link to comment Share on other sites More sharing options...
weaponx Posted October 1, 2007 Share Posted October 1, 2007 $printer=StringTrimRight("MY PRINTER HP OFFICEJET",13) MsgBox(0,"",$printer) Isn't this the opposite of what is needed? This will return "MY PRINTER" Just do: $printer = StringMid($ret[$i], 12) - or - $printer = StringTrimLeft ( $ret[$i], 11 ) Link to comment Share on other sites More sharing options...
Ghost21 Posted October 1, 2007 Author Share Posted October 1, 2007 $printer=StringTrimRight("MY PRINTER HP OFFICEJET",13) MsgBox(0,"",$printer) Isn't this the opposite of what is needed? This will return "MY PRINTER" Just do: $printer = StringMid($ret[$i], 12) - or - $printer = StringTrimLeft ( $ret[$i], 11 ) Hey weapon I'm not sure what he was talking about but I have found that if I do a RUN command it drops everything after the ( space ) if I do a shellexecute command it shows me the correct information but says it can't find the rundll command even though I changed it to @windowsdir\system32\rundll.exe etc. 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