InterviewSolution
This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.
| 1151. |
Solve : Link between two pages same web site.? |
|
Answer» This situation is very confusing. Page ONE is a list of post offices. Page two is Notes: on those post offices. |
|
| 1152. |
Solve : quick vbs help? |
|
Answer» HI guys, I'm converting a old (fully working batch file) to vbs. Mainly because I'm trying to learn vbs, but also because I can do a few extra things with vbs that can't be done via batch. I'm using the following line (DOS) to install antivirus software silently. Code: [Select]start /wait X:\setup.exe /s /v"/l*v log.txt /qn NETWORKTYPE=1 SERVERNAME=basdc01 ENABLEAUTOPROTECT=1 RUNLIVEUPDATE=0 REBOOT=ReallySuppress my vbs version reads like this; Code: [Select]If (objFSO.FolderExists("C:\Program Files\Symantec AntiVirus") = false) Then shell.run """X:\setup.exe"" /s /qn NETWORKTYPE=1 SERVERNAME=basdc01 ENABLEAUTOPROTECT=1 RUNLIVEUPDATE=0 REBOOT=ReallySuppress", 1, True end if If you look closely you see that I've had to remove some of the switch's as the DOS version contained an extra " which confuses vbs. Is there a way to have an extra " within a pair of " " while still having the commented section run to the last " example; "some stuff here - an extra " would stop the comments there, but I'd like to contine you here." any ideas??? EDIT; I have since made a new varaible with the full command (including the extra "). I managed to use the chr(34) to add it. The problem now is I'm unsure how to run a .exe file with paramaters as a varaible. any ideas??I've never encountered quotes and stars as run time switches, but hey, according to the TV, I'm no smarter than a fifth grader This will balance the quotes, but testing this was limited. Perhaps it will work. Code: [Select]shell.run """X:\setup.exe /s /v""/l*v /qn NETWORKTYPE=1 SERVERNAME=basdc01 ENABLEAUTOPROTECT=1 RUNLIVEUPDATE=0 REBOOT=ReallySuppress""", 1, True Quote but also because I can do a few extra things with vbs that can't be done via batch. This should win the understatement of the month award. Cheers for the reply. Quote from: Sidewinder on May 22, 2008, 05:16:59 AM
Sadly that doesn't work, it looks for a file name "x:\setup.exe /s /v" and so keeps failing. I have managed to build a varaiable with all the swicth's: /s /v"/l*v log.txt /qn NETWORKTYPE=1 SERVERNAME=basdc01 ENABLEAUTOPROTECT=1 RUNLIVEUPDATE=0 REBOOT=ReallySuppress but I'm unsure how to get this varaiable in to the rull command. I've tried; shell.run "x:\setup.exe", commands, 1, true but it doesn't go. Shell.exec seems to have the same problem. Or have I missed something??? Quote I have since made a new varaible with the full command (including the extra "). I managed to use the chr(34) to add it. Can you not concatenate the strings on the run method: Code: [Select]shell.run "X:\setup.exe " & parameterstring,1,True Note: the space between setup.exe and the end quote. Are there really quotes and stars in the parameter string? This seems very strange to me especially where switches are USED. You may have to experiment with quotes or double quotes on the parameter string. I've used your suggested code and from a small test case it seems to work great. I'm working on a larger script to install programs, make system changes and generally make a fresh install of XP ready for a new user to log on. I'm just installing XP on another machine, once that has finished I'll GIVE it a bash and I'll update you. Cheers again sidewinder. UPDATE: I've noticed that if a pass this long string to a batch file and echo %1 I get everyting up to the first space, when it stops. vbs script; Code: [Select]set shell = WScript.CreateObject("Wscript.Shell") par = "/s /v" par2 = "/l*v log.txt /qn NETWORKTYPE=1 SERVERNAME=basdc01 ENABLEAUTOPROTECT=1 RUNLIVEUPDATE=0 REBOOT=ReallySuppress" compar = par + Chr(34) + par2 WScript.Echo compar shell.run "C:\echo.bat " & compar, 1, True wscript.quit batch file to display echo; Code: [Select]@echo off echo %1 pause exit if you run these you'll see what I mean. Is there a way to get %1 to see passed the space? cheers again.Not sure what you're asking. My results displayed the entire string: Quote Microsoft (R) Windows Script Host Version 5.7 I get the same results with both CScript and WScript. If your results are different try changing echo.bat as batch code uses the space as a default delimiter: Code: [Select]@echo off echo %* pause exit Hope this helps. Nice, echo %* does the job. I think this is my problem. I guessing the setup.exe will only take %1. (hench why everytime I run it, it just opens the setup.exe and doesn't install) I think I might have to start a batch file in vbs and have the batch file do the work. (tacky) what do you reakon??? Quote I think I might have to start a batch file in vbs and have the batch file do the work. (tacky) I had a problem similar to this only the passed parameter was a switch followed by a path with those pesky embedded spaces. Quote I think this is my problem. I guessing the setup.exe will only take %1. (hench why everytime I run it, it just opens the setup.exe and doesn't install) I'm guessing only the log.txt is resolving to %1 (in batch speak). The other parms should are switches and keywords which are not positional and are handled differently by the program. This mishmash sets up a string with the embedded quote and the quotes around the entire string that the run method requires Code: [Select]str = """X:\setup.exe /s /v" & """/l*v""" & " Log.txt " & """/qn NETWORKTYPE=1 SERVERNAME=basdc01 ENABLEAUTOPROTECT=1 RUNLIVEUPDATE=0 REBOOT=ReallySuppress""" shell.Run str, 1, True I'll let you test this and you can let us know how you made out. PS. You don't have to build a string. Should be ok inline on the shell.run statement. or just add the ascii value for " in the string, that works fine for me when I do stuff like thatHi guys, Sorry I forgot I started this thread !! I've got it running now, by using a bacth file to run the ACTUAL install. works a treat. Cheers for all your help |
|
| 1153. |
Solve : send keys and find text VB .NET? |
|
Answer» Hello again and thank you for helping me every time. 1. How can I Sendkeys to another process without being focused on, I mean if I have the MS Word opened but minimized or in background, can I send a text to that process without making it on top of all? In windows the only way I know how to pass keystroke info to another program is to select its focus and then enter the information, HOWEVER a memory hack could be performed to pass information into a program that is not the windows focus, but I cant show you how to hack it as for this can be used for evil intent..LOL Quote 2. Is it possible to find a text on another process and get the coordinates of where the text is? Ex find the Like button on a website with fb and get the coordinates? Without downloading the webpage, maybe using webbrowser control In order to access the information it will have to be loaded ( aka downloaded to your browser for example ) at least once. There is no way to get information from a website without at least 1 time download of the HTML etc to your browser or custom HTML interpreter which runs out same as a browser and loads the information to perform further tasks with it. As far as finding the location of the like button it could be done by dumping the video data to a 2 dimensional array and then look for the LIKE SYMBOL. Then when found report back the location. THIS IS A LOT OF WORK! As for you would need to create a template of positives, and change the information from color to Black and White Binary 0's and 1's, where you perform an analysis on pixel locations to detect if the binary layout of the PIXELS match against a positive template or not. Then when found be able to report back the X,Y coordinates which would probably be some trial and error to calibrate. If looking for text on a web page this is FAR EASIER, but IMAGE recognition of the Like symbol of Facebook would be quite an involved process. Just had a vision of a flat screen display mated up ( duck taped ) with a DIGITAL OCR scanner to hunt for the FaceBook Like symbol...LOL 1. Not using sendkeys. I don't know what your goal is but it's probably doable using Office Automation. 2. Searching for the like button would be searching for an image, mostly. Quote from: DaveLembke on August 08, 2012, 12:07:23 PM If looking for text on a web page this is FAR EASIER, but image recognition of the Like symbol of Facebook would be quite an involved process.I would think loading it into a webbrowser control and using DOM manipulation to find the image and get it's position might work. Of course as you point out the idea of getting any information from a site without downloading it is pretty silly. Also this has an issue in that if Facebook ever changes the image being pointed to, it stops working.the like button was an example, I want to find a text and click on it automatically but I won't know how to find the text in the pageWith intent of use still unclear, I have this to share: If you are visiting sites that always have the buttons you want to click in the same location, a simple keyboard/mouse macro can run. I have used such macros to gather information in an automated manner, but they could also be used to add clicks to generate bogus traffic if one was trying to generate what looks like traffic from others to get paid per click. BUT those who pay per click traffic usually track to verify that macro bots aren't creating false traffic from a single IP origin to verify the validity of the traffic that they are paying for. I can only think of a company being a fool to pay per click without such an audit to verify validity of the traffic to be real traffic vs simulated traffic from automation. If you are trying to find button locations that are ever changing, BC had the best option with the DOM manipulation to find the image and get its position to then send a simulated mouse click to it. Quote I want to find a text and click on it automaticallyAs far as hyperlinks in a web page, to follow those which are linked TEXT, you can create a program that loads the website and searches the HTML for keywords and then reads in the Hyperlink location for that matching text and then runs with that URL to perform additional duties. X and Y location of that text in the page is unnecessary because Hyperlinks in HTML are a standard structure and you can read in all information starting at " and ending at " of the URL to know the start and end point of the URL string in the page you are grabbing the link from. You then can pass that URL into a function that runs to the next page and performs another duty. And that is why finding text is so much easier than finding an image. The only other way i can think of finding an images link would be if the image was always the same name, but that doesnt happen 99% of the time. |
|
| 1154. |
Solve : delete with command prompt help? |
|
Answer» i used to use nero as a backup tool on an external hard drive, but i had my settings backing it up wayy too often and it has taken up a huge portion of the drive. I dont much care for the software anymore, so id rather just delete the entire folder of backups. |
|
| 1155. |
Solve : Guessing Game Program [JAVA]? |
|
Answer» I made a program that generates a random integer between 0 and 100, asks the user to guess it through console, and prints out results accordingly. I made use (most likely over use) of if and else if (methods? What do you call them?) and was wondering if what I have punched out is acceptable and efficient or unreadable spaghetti code. Why not try something like NetBeans and run it. You'll soon find out if it works. The program seems to run correctly. I'm more concerned with it's complexity. Am I following the correct style or reinventing the wheel?My tutor always told me "if it works, it works". Ask 10 people to do the same thing and you will probably get 10 different answers. Experience and practice will allow you to streamline code, as you progress. Example. Q: What 2 numbers, when ADDED, equal 10? A: 9+1 or 8+2 or 7+3 etc Also, test the boundries... Quote I made use (most likely over use) of if and else if (methods? What do you call them?Control structures. The code is not indented/formatted well, but I think that might be because it was placed into the post and not in a separate code tag: Code: [Select]package numberguessinggame2; import java.util.Scanner; public class NumberGuessingGame2 { public static void main(String[] args) { int rdmint = 0; int guess = 0; while (rdmint == 0){ rdmint = (int)(Math.random()*101); } Scanner input = new Scanner(System.in); while(guess != rdmint){ System.out.print("Enter an interger between 0 and 100: "); String userinput = input.nextLine(); try {guess = Integer.parseInt(userinput);} catch (NumberFormatException e) {} boolean range = ((guess < 100) && (guess > 0)); if ((guess == rdmint) && range){ System.out.println("Your guess is correct"); } else if ((guess > rdmint) && range){ System.out.println("Your guess is too high"); } else if ((guess < rdmint) && range){ System.out.println("Your guess is too low"); }else{ System.out.println("Your guess is invalid"); } } } } another common idiom is to label the closing brace for the larger constructs. (the second while here, the main method, and the class, for instance). You could also replace the try..catch logic with something a bit simpler, as well as more functional: eg. instead of: Code: [Select]System.out.print("Enter an interger between 0 and 100: "); String userinput = input.nextLine(); try {guess = Integer.parseInt(userinput);} catch (NumberFormatException e) {} boolean range = ((guess < 100) && (guess > 0)); Code: [Select]do { System.out.print("Enter an integer between 0 and 100: "); if(scanner.hasNextInt()) x = scanner.nextInt(); else scanner.next(); } while (guess < 0 || guess > 100); which would MAKE the use of "range" in the conditionals lower down redundant, since by that point the number has been guaranteed to be in that range by the input loop. I put in the hasNextInt method you put down as well as removed the range variable and tried to adjust the spacing of the brackets accordingly. Does the hasNextInt method (for lack of a BETTER word) initialize the scanner? Code: [Select]package numberguessinggame2; import java.util.Scanner; public class NumberGuessingGame2 { public static void main(String[] args) { // Initialize variables and scanners int rdmint = 0; int guess = 0; Scanner input = new Scanner(System.in); String invalidEntry = "Invalid entry."; //GENERATE a random integer between 0 and 100 while (rdmint == 0){ rdmint = (int)(Math.random()*101); } //Take in a guess from user and determine if it is a valid entry. Then determine if it is the correct entry. Display results to console. while ((guess <= 0) || (guess >= 100) || (guess != rdmint)){ System.out.print("Enter an integer between 0 and 100: "); if((input.hasNextInt())){ guess = input.nextInt(); if (guess < 100 && guess > 0){ if (guess == rdmint){ System.out.println("Your guess is correct"); } if (guess < rdmint){ System.out.println("Your guess is too low"); } if (guess > rdmint){ System.out.println("Your guess is too high"); } } else{ System.out.println(invalidEntry); } } else{ System.out.println(invalidEntry); input.next(); } } } } |
|
| 1156. |
Solve : Re: Visual FoxPro: Remove Duplicate entries? |
|
Answer» hi, |
|
| 1157. |
Solve : Algorithm used in Text Twist game? |
|
Answer» can anyone help me with this,im trying to LOOK for algorithms possibly USABLE for a game similar to text TWIST. an algorithm that can search for character combination in a string in different LENGTH like in a seven letter word, an algorithm that can GIVE letter combination of 3 4 5 6 letter.i need to study algorithms that can has this ability or somewhat similar t this. thanks in advance |
|
| 1158. |
Solve : SQL Jobs, can copy file in server1,2,3 and past file in server4? |
|
Answer» hellou. |
|
| 1159. |
Solve : Help with writing to file? |
|
Answer» HI i am having trouble with a BATCH file i am creating: i have successfully created batch files that WRITE into another batch file, but when i ADD a user-set variable to the NAME before the extension it wont create a file instead it creates a folder under the name of the user-set variable the the extension. Can someone please tell me what is going wrong with the file Quote from: darthv55 on June 16, 2012, 11:56:21 AM Can someone please tell me what is going wrong with the file When we see it, maybe... |
|
| 1160. |
Solve : Android Game? |
|
Answer» Hello all, |
|
| 1161. |
Solve : Managed arrays as SAFEARRAYS in native C++? |
|
Answer» Hey all: |
|
| 1162. |
Solve : Strange Pointer-Like Behaviour VB.NET? |
|
Answer» I have this piece of code, as an example and I'm totally confused why it's not working properly. I have this piece of code, as an example and I'm totally confused why it's not working properly.It is working 'properly'. Actually, it would work similarly in VB4, VB5, or VB6. Code: [Select]Dim p(0) As Planet Dim m(0) As Planet p(0) = New Planet m(0) = New Planet p(0).IsMoon = False m = p m(0).IsMoon = True MsgBox("P: " & p(0).IsMoon & " M: " & m(0).IsMoon) the assignment between arrays copies the array p to the array m. However, the array p is a 1-item array of "Planet". A Object VARIABLE is actually a REFERENCE to the actual object, not the object itself. Assigning Objects does not copy them. You assigned them both to new instances, but then set the m(0) to the same object as p(0). Quote Now, the weird thing is that when the MsgBox comes up, it prints "P: True M: True". Shouldn't it be "P: False M: True"? Why is vb.net, a language completely devoid of pointers, suddenly behaving as if it has them all of a sudden?VB.NET has never been devoid of pointers in the form of references. A Object variable is a reference(pointer) to a instance of that object (or Nothing). If you really want them to be separate, you will need to implement a method within the class to clone them. Alternatively, you can make the class a struct.oh, i didn't realize that assigning objects didn't copy them thanks. i still find it odd that vb should copy the reference, though. I thought it was only C-based languages that did this.Quote from: glaba on August 01, 2012, 02:57:58 PM oh, i didn't realize that assigning objects didn't copy them thanks. i still find it odd that vb should copy the reference, though. I thought it was only C-based languages that did this. I don't know of any language that doesn't. |
|
| 1163. |
Solve : automated emails for document modification? |
|
Answer» I am working with WINDOWS xp and have basically no programming experience... I have a basic excell (2010) document saved on a shared drive over the company network. The goal is to have a batch (or any language really, I'm not picky) program that will check if the document has been saved (ie modified RECENTLY) and SEND me an email (using outlook 2010) if it has been. I figured I can used Task Scheduler to run the Batch file every ten minutes or so, but I'm basically at a loss as FAR as the program itself. Any thoughts would be appreciated thanks!Welcome to CH. |
|
| 1164. |
Solve : How does it work?? sequence points??? |
|
Answer» INT i=0; i= ++i + i++ + ++i ; printf("%d",i);Result is five. Assuming standard C code. Left to right associativity is present for operators with equal precedence. ++i is evaluated first. The prefix operator RETURNS the incremented value. in this case, 1. 1 + i++ + ++i and i has the value 1. next, i++ is evaluated. this returns the value before increment; 1. 1 + 1 + ++i last, the prefix operator returns the incremented value, or three. 1 + 1 + 3 i changes value throughout the expression as it is evaluated. each increment operation is guaranteed to be complete before the value is used in an expression, so in that SENSE the binary + operators can be considered SEQUENCE points. thanx |
|
| 1165. |
Solve : Microsoft Visual Foxpro Newbie? |
|
Answer» GOOD morning sorry to disturb i wanna know how to lessen the NUMBER zeros when i compute a tuition fee program for example 10% discount of 1000 is 900.00 but it appears 900.000 instead . Any suggestions please . ty.Welcome to CH. Some THINGS to need to do. 1. Please include the NAME of the OS you use. 2. Provide some specific details about how you do the calculation. Fox PRO has the same expression rules as do similar programs. |
|
| 1166. |
Solve : C# Copy file problem.? |
|
Answer» Hello, I am having some problems with a code that I am working on it is supposed to copy everything in one folder and then place the copy where the file is. EDIT AGAIN: okay the problem was the file streams name all it needed was to be changed from is to just about anything else >.> Yep, sorry about that. 'is' is a C# keyword, so using it as a variable name was a mistake on my part. |
|
| 1167. |
Solve : Which language to choose between QBASIC or C++? |
|
Answer» I learned intro to C# off one of those MS Books and its a great book with examples and at the back of the book it came with a DVD containing all the Express packages C++, C#, Visual Basic, etc. They must have made 1 DVD for every Express Programming book they made vs making 3 or more different discs. My favorite project in the MS C# Express book was making your own custom browser, spinoff of IE. I found C# very easy given that I came from a background in Basic, C++, Perl, and a few other languages and scripting languages. Was amazed at how simple it is to use and it automatically populates sections of code when adding features to your programs in addition to how it starts you out with a template SORT of, of the necessities to make any program without having to type in what would be redundant to every program. C# was definately designed for RAPID development and ease of use. I too suggest C#. I started with GW-Basic way back in the 1980s and worked my way from that to QBasic, then C, then C++. I find C++ for the most part easy but its only because I have written programs in it for the past 14 years. Anyone jumping from say Basic with line numbers to C++ or any other modernized language for that sake is in for a challenge when they have to break the spaghetti code habits of what Basic with line numbers created. Teaching others programming basics I find it easier to train people with no experience than those with exposure to Basic with line numbers, as for some habits are hard to break, and although you can add goto's in modern languages its poor programming grammar to add them when they can be avoided with cleaner coding. Have I added goto's...YES... sometimes its nice to throw one in there for a 10 SECOND fix, but I generally avoid them when POSSIBLE. |
|
| 1168. |
Solve : VB Cross-Thread Operation not valid? |
|
Answer» Hello again! It works setting the label text, the error occures in line "If version = onlineversion Then" and I'm not getting the ideea...how i'm supposed to make the if condition if vb can't read those variables or idk why i'm getting that error:| The exception message indicates the error is caused by attempting to set the text of the label: Quote StackTrace: What is line 106 and 116 of "pornire.vb"? nvm i'm noob, i modified the previous POST, read it again please:))See Exception.InnerException for details. Sounds like an error within the Form_Load to me, but without the InnerException it's hard to say exactly where it is. EDIT: if you are using Visual Studio, the "Exception Helper" should let you look at the inner exception.It's working! I was using a double variable with a string text =)) Thank you dude, you're life saver |
|
| 1169. |
Solve : PHP - Help Scrape a page? |
|
Answer» Hey guys, |
|
| 1170. |
Solve : AS3 Rotating a sprite? |
|
Answer» Hey all, |
|
| 1171. |
Solve : python and tk? |
|
Answer» I'm starting to create a program but when it run an undesired result occurs. |
|
| 1172. |
Solve : LabView programming? |
|
Answer» I am on a robotics TEAM and I want to know if anyone knows any Kinect CODES in LabView to possibly make it easier to use.Welcome to CH. |
|
| 1173. |
Solve : Delphi 5 programming? |
|
Answer» I use a button to view a PDF (using a 3RD party) with the ShellExecute command. I WANT code to insert text and date () (auto update onto each PDF DOCUMENT viewed so that if printed it APPEARS at the bottom of the document. |
|
| 1174. |
Solve : C++ question regarding #import and Microsoft logic? |
|
Answer» Hey people... Note that the compiler will not find type libraries in different directories if you use the /I (Additional INCLUDE Directories) compiler option to specify those directories. If you want the compiler to find type libraries in different directories, add those directories to the PATH environment variable. My project does use the Additional Include Directories switch which could have something to do with this. However, msxml3.dll lives in C:\Windows\System32 which is part of the path so I am not sure why this wouldn't be working. Anybody have any experience with this situation? Thanks!I couldn't say if it was the CAUSE of the problem, but using MSXML from C++ usually means using the MSXML SDK; this SDK includes header files for you. if I understand correctly you used the "import" functionality to create the header file you are using now. It might help to use the "actual" header files, though I don't know that for sure. Hey BC_Programmer... Good to talk to you again. I guess saying the header file was derived from the dll is a poor choice of words on my part. Actually, the header file is part of the Microsoft Windows SDK which is indeed installed on my system. But the types are also found in the msxml dlls. Sorry about that. The code Code: [Select]#import "MYFAVLibrary.tlb" raw_interfaces_only, raw_native_types, no_namespace, named_guids will write out a MYFAVLibrary.tlh file that requires the types from MSXML. Somehow, I am missing where that reference needs to come from. The quoted text that I took from Microsofts website confuses me a little bit. So if you specify additional include directories, the compiler can't search them... That is how I read that and it seems counterproductive. But, the header file from the SDK is recognized in the project and the dll lives inside a directory found in the PATH environment variable. Hmm...I wonder if maybe MSXML might refer to other types, say from olelib? (I'm just guessing here, never really used COM & C/C++)Quote from: BC_Programmer on June 22, 2012, 09:32:40 AM I wonder if maybe MSXML might refer to other types, say from olelib? (I'm just guessing here, never really used COM & C/C++) I really don't know. I guess that would be a possibility but there are plenty of OLE headers being passed in as external dependencies as well, and from the same Windows SDK. The main problem is that I inherited this project so I don't FULLY understand all of it's intricacies. The people that gave it to me can build it just fine in a WinXP environment using the same compiler I am using (VS2010). I don't see how the OS (mine being Win7) would be what makes a DIFFERENCE. A different compiler, yea, maybe so. I have got to be missing something, either a library altogether or how something is referenced... Thanks.well, the only thing I can figure is maybe the DLL (MSXML3.dll) differs enough from the XP version that it won't compile with the same code- a source level incompatibility preventing things from linking properly (I'm not sure but I think there is some sort of linking taking place in the guts of a #import). Also, possibly dumb question: the XML include is before the #import for the external library? |
|
| 1175. |
Solve : Augh! Help, MS-DOS File??? |
|
Answer» Aaughh!!! |
|
| 1176. |
Solve : C++ Int Array Sorter? |
|
Answer» I typed up a SMALL C++ program for sorting int arrays. I was wondering if there are any issues with the program. As always, all help is appreciated. |
|
| 1177. |
Solve : C# Updating changes back to SQl database? |
|
Answer» Can someone please help me on this problem. I am trying to send the updated changes to the sql database when I remove a row. I use the delete method to delete the numbered row and then use the upadte command to update the changes. However, when I reload the PROGRAM all the rows are still showing again. Below is the current code I am using for forms 1 and 2. This has been giving me a headache for awhile now and any further help would be appreciated: |
|
| 1178. |
Solve : vbscript shell.run help....? |
|
Answer» hi guys, shell.Run app, 1, True Quote app = "C:\scripts\install_viewer.bat " & IP It might be helpful to see the contents of install_viewer.bat. It could be the batch file started up a secondary process, terminated, and returned control to the VBScript. Quote shell.Run "C:\scripts\NetSend07viewer.bat " & IP, true I believe you're missing a comma in this line. Quote from: Sidewinder on June 06, 2008, 06:24:33 AM [Quoteshell.Run "C:\scripts\NetSend07viewer.bat " & IP, true That one seems to be working fine ??!!?? install_viewer.bat; Code: [Select]@echo off start /wait /b e:\"my stuff"\pstools\psexec \\%1 c:\2007_viewer\viewer.exe /quiet if %errorlevel% gtr 0 (goto fail) exit :fail echo FAil >>\\%1\c$\installfailed.txt exit Seems like the start command cranks up psexec which in turn cranks up viewer. Question 1: Who has control? After psexec cranks up viewer does psexec terminate immediately and return control to the start command? Or does psexec wait for viewer to terminate before terminating itself? Question 2: Is the errorlevel returned from the start command or psexec? Highly unlikely it's from viewer. Once the batch file terminates, return reverts to the VBScript and life GOES on as we know it. Try inserting a pause after the start command, and use the task manager to see if viewer is still executing. I realize your logic is for a network, but you may have to debug on the local machine. PS. Is any of this related to this post?cheers for the reply; 1 - psexec starts viewer and then waits for it to exit (by defult) before returning control. 2 - the error level comes from the remote program. I've already put a pause in after the start line but to no effect. psexec /? >> PsExec executes a program on a remote system, where remotely executed console applications execute interactively. Usage: psexec [\\computer[,computer2[,...] | @file][-u user [-p psswd]][-n s][-l][-s|-e][-x][-i [session]][-c [-f|-v]][-w directory][-d][-<priority>][-a n,n,...] cmd [arguments] -a Separate processors on which the application can run with commas where 1 is the lowest numbered CPU. For example, to run the application on CPU 2 and CPU 4, enter: "-a 2,4" -c Copy the specified program to the remote system for execution. If you omit this option the application must be in the system path on the remote system. -d Don't wait for process to terminate (non-interactive). -e Does not load the specified account's profile. -f Copy the specified program even if the file already exists on the remote system. -i Run the program so that it interacts with the desktop of the specified session on the remote system. If no session is specified the process runs in the console session. -l Run process as limited user (strips the Administrators group and allows only privileges assigned to the Users group). On Windows Vista the process runs with Low Integrity. -n Specifies timeout in seconds connecting to remote computers. -p Specifies optional password for user name. If you omit this you will be prompted to enter a hidden password. -s Run the remote process in the System account. -u Specifies optional user name for login to remote computer. -v Copy the specified file only if it has a higher version number or is newer on than the one on the remote system. -w Set the working directory of the process (relative to remote computer). -x Display the UI on the Winlogon secure desktop (local system only). -prioritySpecifies -low, -belownormal, -abovenormal, -high or -realtime to run the process at a different priority. Use -background to run at low memory and I/O priority on Vista. computer Direct PsExec to run the application on the remote computer or computers specified. If you omit the computer name PsExec runs the application on the local system, and if you specify a wildcard (\\*), PsExec runs the command on all computers in the current domain. @file PsExec will execute the command on each of the computers listed in the file. program Name of application to execute. arguments Arguments to pass (note that file paths must be absolute paths on the target system). You can enclose applications that have spaces in their name with quotation marks e.g. psexec \\marklap "c:\long name app.exe". Input is only passed to the remote system when you press the enter key, and typing Ctrl-C terminates the remote process. If you omit a user name the process will run in the context of your account on the remote system, but will not have access to network resources (because it is IMPERSONATING). Specify a valid user name in the Domain\User syntax if the remote process requires access to network resources or to run in a different account. Note that the password is transmitted in clear text to the remote system. Error codes returned by PsExec are specific to the applications you execute, not PsExec. lol, No this has nothing to do with my other project. I supposed I could add it later, but for now I'm doing them as and when. cheers again.sorted. I changed the start psexec line in my batch file and removed the /b switch. (which starts psexec in the same window.) anyway. Cheers for your help, yet again sidewinder!! legend! |
|
| 1179. |
Solve : List to byte array in C#? |
|
Answer» If I have the following CODE: and object2 is not can not be serialized, how can I get this into a byte array?You can't. There is nothing to put in a byte array. What do you expect to be written for the nonserializable object? an Object that isn't serializable has no persistent representation by definition.OK. I kinda figured. What I am really trying to do is replace some old VB6 code that looks something like this: Code: [Select]Dim propBag As PropertyBag Set propBag = New PropertyBag propBag.WriteProperty "MyObject1", object1 propBag.WriteProperty "MyObject2", object2 Dim byteArray() As Byte byteArray = propBag.Contents The problem with my previous code snippet falls with object2. So can you think of a way to do something like this? What is "object2" in the VB6 code? Or, more precisely, what type of object is object2? if that works with the VB6 code, than WHATEVER object2 is (in VB6) is Persistable/Serializable.object2 is a C++ class that represents a geographical object and is accessed through an interface. But since it was used in VB6 like it was, I didn't think there would be an issue with serializing it. I just attempted a serializable class and passed the two objects in through its constructor and the results were the same. This doesn't seem like there should be much to it but I am stumped right now. I appreciate your input. Keep it coming... Well, that helps... That means the Object in question is a COM object (that's the only way a VB6 consumer could access a C++ object); which also answers the question of how it works. a COM Object implements persistence by implementing the IPersist,IPersistStream, and/or IPersistFile interfaces. Visual Basic's PropertyBag is smart enough to see when the object you pass it implements one of those interfaces and handles it appropriately; that is, it goes, oh, hey, this object is persistable! And writes the bytes to it's bag. HOWEVER, the .NET SerializationInfo class (the propertybag equivalent) is a managed class and has no understanding of COM; in a similar way to the propertybag, it looks at the object, but it doesn't understand IPersistStream, IPersistFile, ETC. It only understands ISerializable and the Serializable attribute. I tried to create a test, but it bloated very quickly. I'm not 100% sure how you access the IPersistStream interface and there are about a dozen examples on the web, all implemented in different ways. I ended up with a C# project that had a definition for IPersist, IPersistStream, A wrapper around a COM stream, but no way to create a IStream (ideally, a memory stream...) so I got stuck. Basically, it would boil down to this: 1.Determine if the object supports IPersistStream 2. if so, create an IStream, and call the objects Save() routine to write it to the stream. 3. retrieve the bytes from the IStream. 2. and 3. are a bit of a hairy bit because much like the IPersistStream there is varying information on it. I did find that IStream is present in System.Runtime.InteropServices.ComTypes, at least, but I have no idea how you could such a stream. It's possible to create a wrapper that exposes an existing IStream object, but what you really need is a way to create one, and I wasn't able to find a way to do that. I can however, think of a cheap workaround. Instead of trying to implement all this in C# where COM stuff is foreign, you could create a small Wrapper in VB that exposes a method for converting a COM object ot a sequence of bytes by way of the method you illustrated. The only down-side is that you would be forced to compile to 32-bit, but if you are using an Object from a C++ COM DLL already, you are already restricted to 32-bit, so that shouldn't be an issue. Basically, it could be a simple ActiveX DLL that has a single class with a method like this: Code: [Select]Public Function ComObjectToBytes(Object serializeme) As Byte() Dim PropBag As PropertyBag Set PropBag = new PropertyBag PropBag.WriteProperty("Object",serializeme) ComObjectToBytes = PropBag.Contents End Function Public Function ComObjectFromBytes(Byte readfrom()) As Object Dim PropBag As PropertyBag Set PropBag = New PropertyBag PropBag.Contents = readfrom Set ComObjectFromBytes = PropBag.ReadProperty("Object") End Function You can reference the compiled DLL in Visual Studio, which will create a Wrapper .NET Assembly for you. At that point, you can create the class defined above (whatever it may be called) and call the ComObjectToBytes() method to convert your object2 to a sequence of bytes, which you can then write to your stream. If you want to turn that array of bytes back again, you call the second method in the COM component. [/code] The COM Interop available with C# is pretty good, but it's also very finicky. Then again, that's COM for you, really Wow. Thanks a bunch for sitting down with that! I am going to look at it again in the morning with fresh eyeballs when I am back in my office. I follow everything your saying. I have done a lot of stuff dealing with COM and Interops but never had to deal with serialization before. I will let the forum know what comes from this tomorrow... Thanks again!OK, so I will throw this out there real quick... I have built the class and added it to my project. The interop gets built as expected. Here's the catch. The calling program is installed to the GAC. When I get to the class creation in the code, the application will fail saying that the file (the new interop for the VB6 code) can not be found. I have seen this with a couple of other interops in my project. When the interops are created, they are created as strong named and sharing the same key as the calling application. With the others, I simply added them to the GAC and they worked as expected. With this one, however, the installation to the GAC says that it failed because it was expecting an assembly manifest. I need a quick fix for this one as well. Anyone have any ideas? |
|
| 1180. |
Solve : Access database/Producing a message when the weekday turns to Friday? |
|
Answer» I'm LOOKING for Code that will allow me to PROGRAM a command button whose function is to CLOSE the database to produce the MESSAGE "Happy FRIDAY and have a nice weekend" - only, of course, when the weekday becomes Friday. |
|
| 1181. |
Solve : Access database combo box issue? |
|
Answer» I have 2 forms in a database which I’ll call form A (BASED on table A) and form B (based on table B.) A field on form B is populated using a combo box ( a list of names) based on table A. If the name is missing in the combo box it needs to be added to table A but I don’t want to have the user exit form B, GO into form A, enter the item and reopen form B. I used a command button to bring up a pop-up form on form B where the user can enter the name to go into table A. The newly entered name won’t show up in the combo box unless form B is closed and then REOPENED. |
|
| 1182. |
Solve : Access Database? |
|
Answer» I have added a TEXT BOX on a form that performs a calculation. Is there code that would ALLOW me to SAVE the results in a table? |
|
| 1183. |
Solve : Access Database - required fields? |
|
Answer» I have 2 databases where I've set up certain fields to be required or not null. The fields are required, at the table level, based on a Validation Rule and Validation Text not by setting the property Required to Yes. In one database, this is WORKING perfectly. If a user doesn't fill out one of the "required" fields and tries to close the form using a "close form " command button, the user keeps getting the Validation Text message until they enter data in the field. |
|
| 1184. |
Solve : About NSIS? |
|
Answer» Does anyone KNOWS something about the NSIS (Nullsoft Scriptable Install System)?, specifically if someone have an explicit manual, I'll glad with it. Do you already have the product? You can download from here. It comes with help files (.chm) and online documentation. Holy CRAP!! Sidewinder, You're STILL around!!! Do you remember me from like one or two years AGO?? Quote from: Mr. Google on July 28, 2008, 08:25:24 AM Holy CRAP!! Sidewinder, You're still around!!! Do you remember me from like one or two years ago?? My single living brain cell keeps me from remembering what I had for breakfast, much less stuff from 1 or 2 years ago. Quote from: Sidewinder on July 29, 2008, 07:50:43 AM Quote from: Mr. Google on July 28, 2008, 08:25:24 AMHoly CRAP!! Sidewinder, You're still around!!! Do you remember me from like one or two years ago?? Haha, well I remember you. You were the most famous person on CHF pretty much back then. Now it seems some more geniuses have strolled into rewardedness-if that makes SENSE... Doesn't mean he isn't our friend anymore. Quote You were the most famous person on CHF pretty much back then. I can't imagine that ever being the perception. Much like the White Rabbit, I prefer to keep a low profile, surfacing occasionally with a burst of unbridled brilliance and humor, before retreating back into the rabbit hole. HAHA, funny. Dudeoxide- I never said that, did I... I just wanted to post the picture of the car. Quote from: Carbon Dudeoxide on July 31, 2008, 10:04:47 AM I just wanted to post the picture of the car. Alright, sounds good... |
|
| 1185. |
Solve : C++ program for this formula? |
|
Answer» How do I WRITE a program to convert centigrade temperatures to Fahrenheit temperatures, using this formula: F=9 0ver 5 C + 32? pow....maybe? pow is still confusing me. HELP!It's just math. It doesn't matter much what the programming language is, it is just math. |
|
| 1186. |
Solve : Can I make VoIP in Java...?? |
|
Answer» Hello how are all of you? I am learning Java language. I want to make a VoIP (VOICE Over Internet Protocole) application. So is it possible in Java? |
|
| 1187. |
Solve : make VB.net find operating language? |
|
Answer» I am USING vb.net to write a program and I NEED it KNOW if I'm in 1033, 1046, or 2052 (that's ENGLISH, portuguese and CHINESE). Any idea how this could be accomplished? |
|
| 1188. |
Solve : WSH Scripting? |
|
Answer» What is the best book to learn WSH scripting? I have done alot of UNIX shell scripting, but WANT to learn WSH scripting. I LIKE the format of the SAMS Teach Yourself books. The WSH scripting book on that topic is dated 1999, so I don't know if it would have any info on Win 2000 or AD. |
|
| 1189. |
Solve : vxd? |
|
Answer» I am getting the MESSAGE cannot find device filed that may be NEEDED to run windows or a windows application. |
|
| 1190. |
Solve : Trying to install JAVA program? |
|
Answer» Hello. I am taking a computer science course at my high school and i needed help installing the program on my computer at HOME. i downloaded java and jcreator, but now i need to copy 3 files into 2 CERTAIN directories. I am not sure how to do this. Can SOMEONE please tell me how to deal with directories??thanks.A directory is the proper term for a folder. And if you don't know what a folder is then GOD help you in your course. |
|
| 1191. |
Solve : VB Sendkeys problem? |
|
Answer» Hello guys. The plus sign (+), caret (^), percent sign (%), tilde (~), and parentheses () have special meanings to SendKeys. To specify one of these characters, enclose it within braces ({}). For example, to specify the plus sign, use "{+}". To specify brace characters, use "{{}" and "{}}". Square Brackets ([ ]) have no special meaning to SendKeys, but you must enclose them in braces. |
|
| 1192. |
Solve : Error using DELOLDER Script to delete old files? |
|
Answer» i don't know if anyone here has ever used the DELOLDER script found on http://www.ss64.com/ntsyntax/, but basically it deletes all files older than a certain number of days. for example: |
|
| 1193. |
Solve : VBA programming with FTP sessions? |
|
Answer» HELLO all, There is a problem I can't get my head around. I have this code for example:Code: [Select] Dim vPath As String Dim vFTPServ As String Dim fNum As Long vPath = "C:" vFTPServ = "www.domain.com" fNum = FreeFile() Open vPath & "\FtpComm.txt" For Output As #fNum Print #1, "USER myUN" ' your login Print #1, "pass" ' your password Print #1, "dir " & Me.namefield & " c:\test.txt" Print #1, "close" Print #1, "quit" Close Shell "ftp -n -i -g -s:" & vPath & "\FtpComm.txt " & vFTPServ, vbHide i am doing this everytime I want to view the contents of the TEST text file. my question is, is there a way that I can leave the FTP session open, and keep printing lines in the FTPCOMM file and keep EXECUTING DOS commands one at a time this way instead of opening and closing the connection each time? I am getting a huge delay in updates when I run this procedure seperately evertime I want to update my interface with the DOS output, so if I can leave the session open I think I can completely eliminate the time I have to wait! I am using VBA with OFFICE 2003 and windows vista. thanks all!do you absolutely have to do this with VBA? you are using the wrong choice of tools to do FTP.i do NEED to do it in VBA, yes. I searched for the INET active X, but apparently you have to pay to get it downloaded. is that true?Quote from: ajetrumpet on November 02, 2009, 06:53:21 PM i do need to do it in VBA, yes. I searched for the INET active X, but apparently you have to pay to get it downloaded. is that true?I am not sure because I don't have to pay to do programming. If you are being forced to pay to program, then you are being ripped off. A lot of stuff to do programming are free. Perl/Python etc comes with excellent FTP libraries that makes your file transfer job easier. If you can find a library that you can use with VBA that is free, go ahead and use it. |
|
| 1194. |
Solve : (VBA) myCell.Value= 2, myCell.Text=xlLandscape? |
|
Answer» How do I ACCOMPLISH this? As in setting myCell to set the integer to 2 for any references, but to the end-user, it should just show "xlLandscape" |
|
| 1195. |
Solve : (VB 6.0) Auto-execute via Combo Box Selection? |
|
Answer» Can anyone help me... I NEED to ensure whenever I select a Combo Box Option, it will run the respective command. Private Sub Combo3_Change() In here, how do i encode it so that a specific excel document will open when i choose the option from the combo box? Is it possible or is there something i'm missing out on?Quote I need to ensure whenever I select a Combo Box Option, it will run the respective command Misread read your question to imply an external command. What was I thinking :-? This should work: Code: [Select]Private Sub Combo3_Change() xlDoc = cbx_DailyRep.Text Set xlApp = New Excel.Application Set xlBook = xlApp.Workbooks.Open("d:\oss\" & [highlight]combo3.seltext[/highlight] & ".xls") xlApp.Visible = True Set xlBook = Nothing Set xlApp = Nothing End Sub Naturally all the choices in the list need to be Excel workbooks. 8-)sry for the tardy reply, but thanks for your help |
|
| 1196. |
Solve : running a batch file? |
|
Answer» I do have a question on a batch file if you do not mind. |
|
| 1197. |
Solve : need help when compiling? |
|
Answer» Im just beginning to learn how to USE C. i got this script from this site: http://randimus.freeservers.com/ctut1.html and after i compile this: |
|
| 1198. |
Solve : RightCLick and it's Invisible?? |
|
Answer» Hi All.. |
|
| 1199. |
Solve : Help with conditional statements on C programming? |
|
Answer» I am a BEGINNER on C programming and an error message (underlined) that I have typed on the below program is not working....can anyone help please??? C:\Temp\tcc>test Quote C:\Temp\tcc>test Seems fine to me. PS. You did too include the math header file. |
|
| 1200. |
Solve : Programmers? |
|
Answer» Quote from: Carbon Dudeoxide on August 20, 2008, 07:22:21 AM What's with all these questions? Well the IBM Roadrunner, is runnin at 1PetaFlop. so it could probably have AI, like in T3. Terminator: "SkyNet is now self-aware, it will launch a nuclear attack to destroy its enemy in 1 hour and 46 minutes." But if you want to see some simple AI, because proccessor speed is not really were AI will start, AI depends upon how the program is wrote, by what kind of althithograms its uses(srry for my spelling), my Lego Mindstorms robot, learns how to sort bricks through TRIAL and ERROR, and its proccessor speed is about 8MHz so i has a simple AI but without the speed like the Roadrunner. You can see the video of my Learning Brick Sorter in action at youtube, here: http://www.youtube.com/watch?v=6iflWlWs3ss Back then we KNEW we were on the cutting edge of technology. One of the engineers that i worked with used to say: When we walk through that back door ( no one ever used the front door...MAYBE that's a metaphor for other things? ) we walk into a computer; the whole building is a computer. After it was "cut over": turned over the Bell Telephone the building/computer was unmanned. Every once in awhile humans had to go there to change a light bulb at the back door, or to dust a few things. Drove by the building a few months ago and it looks exactly the same as it did when i worked there except the parking lot is gone.I'm not a programmer in any sense of the word. I am also an ME that has found that purely mechanical systems are amazing in their complexity and functionality and in their ability to be REPLACED by a few hundred lines of code. Basically I try to program in order to find ways to automate the "15 year old" tasks that I am faced with. (15 year old tasks are things that a 15 year old could do with limited training that I find myself doing now and again rather than doing what I would call real work.) By combining a mechanical system with an appropriate electrical systems and a program it is amazing what can be accomplished. Unfortunatelly this means that eventually my job will be replaced by machines, but until then it keeps the lights on. well no machine can replace any job that involves people, such as a phycologist (srry for my spelling)it's not your spelling that's the problem it's your phrasing... Quote from: macdad- on August 25, 2008, 04:08:16 PM well no machine can replace any job that involves people what like manual labour?? or welding bits of car together?? I understand what you mean but your sentence is rather confusing! FBi mean interacting with them, understanding them and all. |
|