how to launch control panel using code
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2011
10:54 PM
09-20-2011
10:54 PM
how to launch control panel using code
Hi,
i would like to launch-->Devices and Printers but not by using recording but by using simple line codes.
does anyone have a solution?
Thanks
i would like to launch-->Devices and Printers but not by using recording but by using simple line codes.
does anyone have a solution?
Thanks
19 REPLIES 19
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-21-2011
01:59 AM
09-21-2011
01:59 AM
Hi Ofer,
You can use WScript.Shell:
Set WshShell = CreateObject("WScript.Shell")
WshShell.Exec("control printers")
-----
Alexander
Customer Care Manager
Alexander
Customer Care Manager
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-21-2011
03:39 AM
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-21-2011
09:21 PM
09-21-2011
09:21 PM
my purpose is to see if new printer i installed is on the printer's list.
is there any other way to do that by using only code lines,without recording?
thanks
is there any other way to do that by using only code lines,without recording?
thanks
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-21-2011
09:52 PM
09-21-2011
09:52 PM
Hi Ofer,
'wmi get installed printers list' Google request (http://www.google.com/#sclient=psy-ab&hl=en&newwindow=1&source=hp&q=wmi+get+installed+printers+list&... returns a set of script code samples that you may adopt to your needs.
E.g. you may get the list of installed printers before and after installing a printer and check if they are different and whether the latter list contains the just installed printer name.
'wmi get installed printers list' Google request (http://www.google.com/#sclient=psy-ab&hl=en&newwindow=1&source=hp&q=wmi+get+installed+printers+list&... returns a set of script code samples that you may adopt to your needs.
E.g. you may get the list of installed printers before and after installing a printer and check if they are different and whether the latter list contains the just installed printer name.
Regards,
/Alex [Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================
/Alex [Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-21-2011
10:15 PM
09-21-2011
10:15 PM
Hi Alex,
that's cool but i don't know how to merge WMI code with c#script code and if it's possible at all.
can you give an example please?
Thanks
that's cool but i don't know how to merge WMI code with c#script code and if it's possible at all.
can you give an example please?
Thanks
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-22-2011
12:15 AM
09-22-2011
12:15 AM
i got this code lines:
Set objNetwork = WScript.CreateObject("WScript.Network")
Set colPrinters = objNetwork.EnumPrinterConnections
For i = 0 to colPrinters.Count -1 Step 2
Wscript.Echo colPrinters.Item(i) & vbTab & colPrinters.Item (i + 1)
Next
that if i put in a .vbs file and run i get the list of printes.now, is there an option that this code will run not from a .vbs file but from the test complete and that i'll be able to get each printer's name a nd compare it to a name i'm looking for?
Thanks
Set objNetwork = WScript.CreateObject("WScript.Network")
Set colPrinters = objNetwork.EnumPrinterConnections
For i = 0 to colPrinters.Count -1 Step 2
Wscript.Echo colPrinters.Item(i) & vbTab & colPrinters.Item (i + 1)
Next
that if i put in a .vbs file and run i get the list of printes.now, is there an option that this code will run not from a .vbs file but from the test complete and that i'll be able to get each printer's name a nd compare it to a name i'm looking for?
Thanks
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-22-2011
01:15 AM
09-22-2011
01:15 AM
Here's how that VBS stuff code would work, translated to JScript in TestComplete (posted, BTW, on the SQAForums thread you started on this topic... it's helpful if you keep conversations on a single source to make it easier to know what has been discussed already)
Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----
Why automate? I do automated testing because there's only so much a human being can do and remain healthy. Sleep is a requirement. So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.
Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
function PrintersListing(){
var WScriptObj = Sys.OleObject("WScript.Network")
var PrintersCollection = WScriptObj.EnumPrinterConnections()
var Index
for (Index=0;Index<PrintersCollection.length;Index += 2)
{
Log.Message("Port " + PrintersCollection.Item(Index) + " = " + PrintersCollection.Item(Index+1))
}
}
To do the comparison that you want, it would be a matter of changing the Log.Message call to a comparison call. I haven't tested this part yet but I assume it would look something like this.function CheckPrinterExists(PrinterName){
var WScriptObj = Sys.OleObject("WScript.Network")
var PrintersCollection = WScriptObj.EnumPrinterConnections()
var Index
for (Index=0;Index<PrintersCollection.length;Index += 2)
{
if (PrintersCollection.Item(Index+1) == PrinterName)
return true
}
Log.Warning("Printer " + PrinterName + " not found in windows installation")
return false
}
Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----
Why automate? I do automated testing because there's only so much a human being can do and remain healthy. Sleep is a requirement. So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.
Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-22-2011
01:53 AM
09-22-2011
01:53 AM
Thanks Robert,
sure 🙂
sure 🙂
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2012
02:12 AM
07-19-2012
02:12 AM
Hi Robert,
few month ago you reply me with an answer contain the following line:
VBS stuff code would work, translated to JScript in TestComplete
can you please tell me how exactly TC translate VBS to JScript?how you did it?
Thanks
few month ago you reply me with an answer contain the following line:
VBS stuff code would work, translated to JScript in TestComplete
can you please tell me how exactly TC translate VBS to JScript?how you did it?
Thanks
