Source language: Translate to:

RAC Printer plugin - works first time, then not again

Questions about NeoBook PlugIns

Moderator: Neosoft Support

RAC Printer plugin - works first time, then not again

Postby dpayer » Fri Dec 09, 2011 9:06 am

First, let me thank you for sharing your programming talent with the Neobook community. I appreciate the plugins you have made and have offered to all of us.I am attempting to make a program that will print out PDFs. I want to allow the user to verify the default printer and set it if needed. Your plugin for getting the default printer and setting the default printer is what I am using for this.

I have a command to get the the default printer when the page is opened. -->RACGetDefaultPrinter "[defaultprinter]"

It displays properly in this text line ---> Default Printer is [defaultprinter]

I can set a new default printer using the other action command in your plugin -----> RACSetDefaultPrinter "[selectedprinter]" (selectedprinter variable obtained from the list of printers your plugin gives me.)

When I view the windows listing of printers, I can see that the default printer has changed. But when I again use the command - - - >GetDefaultPrinter "[defaultprinter]"

It does not show the new default. (variable's value does not change)

So it appears to work the first time but not after that. Is this a known issue? Are others experiencing it? Is there a way to work around this?

My environment: Win 7 Professional
Neobook: 5.7.1

Thank you for your assistance.

David Payer
User avatar
dpayer
 
Posts: 1380
Joined: Mon Apr 11, 2005 5:55 am
Location: Iowa - USA

Postby dec » Fri Dec 09, 2011 10:06 am

Hi there,

I can confirm your described "problem", with the same environment. Even if you try with another variable, you can't retrieve the "second setted" printer. It's rare, because if you restart the publication you can get the previously set printer without problems.

Just my two cents. ;)
.
Enhance your NeoBook applications!
.
57 plugins, 1113 actions and 230 samples
.
NeoPlugins website: www.neoplugins.com
.
User avatar
dec
 
Posts: 1663
Joined: Wed Nov 16, 2005 12:48 am
Location: Spain

Postby dec » Thu Dec 15, 2011 9:40 am

Hi,

Just to say that I deep something on this issue and appear that the "problem" is not on the plugin, but on Windows. In fact, to set the default printer, and to retrieve, at least I found one manner, and this implied to set and get certain Windows Profile setting. Well, this can be doing the first time without problems, but, next times can fail. I dont know exactly why, but I want to say here the problem is not on the plugin, because I found the exactly same issue myself.

Maybe one possible aproach is to assert the user need to reboot the application when set the default printer. Can appear a bad trick, but I cannot considerer to much ofensive, just inform the user the program need to restart in order to apply their settings. Microsoft Windows does sometimes. :)

Just my two cents!
.
Enhance your NeoBook applications!
.
57 plugins, 1113 actions and 230 samples
.
NeoPlugins website: www.neoplugins.com
.
User avatar
dec
 
Posts: 1663
Joined: Wed Nov 16, 2005 12:48 am
Location: Spain

Postby Wrangler » Thu Dec 15, 2011 12:41 pm

Might be crazy, but have you tried:

GetDefaultPrinter "[defaultprinter2]"

the second time you use the action? See if using a different variable name makes a difference.

And have you considered just getting this info from the registry? If windows shows the change in default printers, it HAS to be recorded in the registry.
Wrangler
--------------
"You never know about a woman. Whether she'll laugh, cry or go for a gun." - Louis L'Amour

Windows 7 Ultimate SP1 64bit
16GB Ram
Asus GTX 950 OC Strix
Software made with NeoBook
http://highdesertsoftware.com
User avatar
Wrangler
 
Posts: 1505
Joined: Thu Mar 31, 2005 11:40 pm
Location: USA

Postby dec » Mon Dec 19, 2011 1:33 am

Hi,

Maybe the Wrangler proposed solution can work. In my opinion the problem is the way used to get and set the default printer. Since we need to update the Windows Settings, apparently sometimes this is not properly updated, or not so quickly that can retrieve the set value.

Of course maybe can exists another possible way to get and set the default printer. In fact is very disturbing to me use some solution that implied an API from Win16, but if you search on internet to get and set the default printer in Delphi, you found this as the main solution, and I think this plugin use this same solution.
.
Enhance your NeoBook applications!
.
57 plugins, 1113 actions and 230 samples
.
NeoPlugins website: www.neoplugins.com
.
User avatar
dec
 
Posts: 1663
Joined: Wed Nov 16, 2005 12:48 am
Location: Spain


Return to PlugIn Discussions

Who is online

Users browsing this forum: No registered users and 1 guest

cron