Sign in to follow this  
Followers 0
Ghost21

RUN vs Shellexecute

7 posts in this topic

IF I use run to add a printer

$printer = "Canon ir3570 PCL5E"

Run(@WindowsDir & '\system32\RunDll32.EXE printui.dll,PrintUIEntry /c\\' & GUICtrlRead($Input5) & ' /in\\purcell /n\\server\' & $printer)

it gives me an error cause it loses the "ir3570 PCL5E" and just shows the "Canon"

now if I use the shellexecute with the same command it shows " Canon ir3570 PCL5E " but can't find the rundll.exe or a part of it to run the whole command correctly ... I even tried the @comspec " /c"

HELP!!!!!!!!!!

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

IF I use run to add a printer

$printer = "Canon ir3570 PCL5E"

Run(@WindowsDir & '\system32\RunDll32.EXE printui.dll,PrintUIEntry /c\\' & GUICtrlRead($Input5) & ' /in\\purcell /n\\server\' & $printer)

it gives me an error cause it loses the "ir3570 PCL5E" and just shows the "Canon"

now if I use the shellexecute with the same command it shows " Canon ir3570 PCL5E " but can't find the rundll.exe or a part of it to run the whole command correctly ... I even tried the @comspec " /c"

HELP!!!!!!!!!!

Could be that the spaces are goofing it up...try

Run('"' & @WindowsDir & '\system32\RunDll32.EXE" printui.dll,PrintUIEntry /c\\' & GUICtrlRead($Input5) & ' /in\\purcell /n\\server\"' & $printer & '"')
?

Edit: I put the quotes around $printer in the wrong place.

Note that depending on what your $Input5 reads, you may need quote marks on either side of that as well, though it looks like you might have to put it before the start of the UNC path (that is, before the \\), if I'm seeing what you're doing correctly.)

Edited by james3mg

"There are 10 types of people in this world - those who can read binary, and those who can't.""We've heard that a million monkeys at a million keyboards could produce the complete works of Shakespeare; now, thanks to the Internet, we know that is not true." ~Robert Wilensky0101101 1001010 1100001 1101101 1100101 1110011 0110011 1001101 10001110000101 0000111 0001000 0001110 0001101 0010010 1010110 0100001 1101110

Share this post


Link to post
Share on other sites

Nope it still only gets the 'Canon' but nothing after the space

Share this post


Link to post
Share on other sites

Nope it still only gets the 'Canon' but nothing after the space

Dang, I edited that post 3 times and still go it wrong.

Try:

Run('"' & @WindowsDir & '\system32\RunDll32.EXE" printui.dll,PrintUIEntry /c"\\' & GUICtrlRead($Input5) & '" /in\\purcell /n"\\server\' & $printer & '"')
and let me know if that works better.

"There are 10 types of people in this world - those who can read binary, and those who can't.""We've heard that a million monkeys at a million keyboards could produce the complete works of Shakespeare; now, thanks to the Internet, we know that is not true." ~Robert Wilensky0101101 1001010 1100001 1101101 1100101 1110011 0110011 1001101 10001110000101 0000111 0001000 0001110 0001101 0010010 1010110 0100001 1101110

Share this post


Link to post
Share on other sites

$printer = '"Canon ir3570 PCL5E"'
Run("RunDll32.EXE printui.dll,PrintUIEntry /c\\" & GUICtrlRead($Input5) & ' /in\\purcell /n\\server\' & $printer)

I set the Double quotes in $Printer by enclosing them inside the single quotes.

@WindowsDir & "\System32\" was removed because if you are running XP then that is already set in the path environment and would have been better as @SystemDir & "\RunDll32.exe" in any event.

Alternate 1

$printer = "Canon ir3570 PCL5E"
$cStr = GUICtrlRead($Input5) & ' /in\\purcell /n\\server\' & $Printer
Run (RunDll32.EXE printui.dll,PrintUIEntry /c\\" & Chr(34) & $cStr & Chr(34))

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

$printer = '"Canon ir3570 PCL5E"'
Run("RunDll32.EXE printui.dll,PrintUIEntry /c\\" & GUICtrlRead($Input5) & ' /in\\purcell /n\\server\' & $printer)

I set the Double quotes in $Printer by enclosing them inside the single quotes.

@WindowsDir & "\System32\" was removed because if you are running XP then that is already set in the path environment and would have been better as @SystemDir & "\RunDll32.exe" in any event.

Alternate 1

$printer = "Canon ir3570 PCL5E"
$cStr = GUICtrlRead($Input5) & ' /in\\purcell /n\\server\' & $Printer
Run (RunDll32.EXE printui.dll,PrintUIEntry /c\\" & Chr(34) & $cStr & Chr(34))
YAY YAY YAY JAMES YOU KICK A$$ .... I have been going crazy over it all day..... :) THANK YOU THANK YOU THANK YOU THANK YOU

Share this post


Link to post
Share on other sites

YAY YAY YAY JAMES YOU KICK A$$ .... I have been going crazy over it all day..... :) THANK YOU THANK YOU THANK YOU THANK YOU

;)

"There are 10 types of people in this world - those who can read binary, and those who can't.""We've heard that a million monkeys at a million keyboards could produce the complete works of Shakespeare; now, thanks to the Internet, we know that is not true." ~Robert Wilensky0101101 1001010 1100001 1101101 1100101 1110011 0110011 1001101 10001110000101 0000111 0001000 0001110 0001101 0010010 1010110 0100001 1101110

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0