| Author | 
		Message | 
	
		 
		vicml21
 
 
 
    
		 | 
		
		
			
				  Posted: Tue May 30, 2006 4:02 pm    Post subject: one small quick question  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				i was wondering if anyone knew the code to open a file, using its default program. For example, open a text file using notepad, or open a music file using windows media player, like for Turing, it is:
 
 
	  | code: | 	 		  Sys.Exec("C:/File.txt")  | 	  
 
 
or something like that. thanks in advance.
		
 | 
			 
			
				 | 
			 
		  | 
	
	 
		 | 
		
		 | 
	
	
 
		  | 
	
		 
		Sponsor Sponsor 
		 
  
		 | 
		
 | 
	
	 
		  | 
	
				 
		Tony
 
  
 
    
		 | 
		
		
			
				  Posted: Tue May 30, 2006 4:16 pm    Post subject: (No subject)  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				| oddly enough it's [url=http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Runtime.html#exec(java.lang.String)]exec()[/url]
		
 | 
			 
			
				 
Tony's programming blog. DWITE - a programming contest. | 
			 
		  | 
	
	 
		 | 
		
		 | 
	
	
 
		  | 
	
				 
		vicml21
 
 
 
    
		 | 
		
		
			
				  Posted: Tue May 30, 2006 5:19 pm    Post subject: (No subject)  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				hmm i looked it up a bit online too, and couldnt get it to run. Basically what im trying to do is run a *.asx file (playlist) in windows media player when the button "Flow" is pressed. It's all included in the zip (java files & the *.asx file im trying to play)
		
	
  
          
							 
	
	
		
	 
	
		|  Description: | 
		
			
			
				| 3 files: 2 java, one *.asx file. | 
			 
			 
		 | 
		  Download | 
	 
	
		|  Filename: | 
		 zip.zip | 
	 
	
		|  Filesize: | 
		 1.17 KB | 
	 
	
		|  Downloaded: | 
		 89 Time(s) | 
	 
	 
	 
		
 | 
			 
			
				 | 
			 
		  | 
	
	 
		 | 
		
		 | 
	
	
 
		  | 
	
				 
		Tony
 
  
 
    
		 | 
		
		
			
				  Posted: Tue May 30, 2006 5:26 pm    Post subject: (No subject)  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				| does the line you are trying to execute works from command-line console? (cmd)
		
 | 
			 
			
				 
Tony's programming blog. DWITE - a programming contest. | 
			 
		  | 
	
	 
		 | 
		
		 | 
	
	
 
		  | 
	
				 
		vicml21
 
 
 
    
		 | 
		
		
			
				  Posted: Tue May 30, 2006 5:30 pm    Post subject: (No subject)  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				| no, it keeps telling me "command failed" (the message i get when it throws an exception, and doesnt run the file). Ive tried a couple of different ways to use the code, but none of them that I've found worked.
		
 | 
			 
			
				 | 
			 
		  | 
	
	 
		 | 
		
		 | 
	
	
 
		  | 
	
				 
		rizzix
 
 
 
    
		 | 
		
		
			
				  Posted: Tue May 30, 2006 8:35 pm    Post subject: (No subject)  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				| I believe to get this functionality in windows (through the command line) you need to execute "start", as in "start blabla.asx"
		
 | 
			 
			
				 | 
			 
		  | 
	
	 
		 | 
		
		 | 
	
	
 
		  | 
	
				 
		vicml21
 
 
 
    
		 | 
		
		
			
				  Posted: Tue May 30, 2006 9:50 pm    Post subject: (No subject)  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				| hmm.. im not sure what you mean. like if the file was in the same folder, and i wanted to open Flow.asx in windows media player, what would the code look like?
		
 | 
			 
			
				 | 
			 
		  | 
	
	 
		 | 
		
		 | 
	
	
 
		  | 
	
				 
		Tony
 
  
 
    
		 | 
		
		
			
				  Posted: Tue May 30, 2006 9:56 pm    Post subject: (No subject)  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				http://support.microsoft.com/KB/241422 wrote: 
 
Mplayer2.exe /play C:\location\Flow.asx
 
 
		
 | 
			 
			
				 
Tony's programming blog. DWITE - a programming contest. | 
			 
		  | 
	
	 
		 | 
		
		 | 
	
	
 
		  | 
	
		 
		Sponsor Sponsor 
		 
  
		 | 
		
 | 
	
	 
		  | 
	
				 
		rizzix
 
 
 
    
		 | 
		
		
			
				  Posted: Tue May 30, 2006 10:30 pm    Post subject: (No subject)  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				| Or as mentioned before (but I haven't tested it) 
		
 | 
			 
			
				 | 
			 
		  | 
	
	 
		 | 
		
		 | 
	
	
 
		  | 
	
				 
		vicml21
 
 
 
    
		 | 
		
		
			
				  Posted: Tue May 30, 2006 11:46 pm    Post subject: (No subject)  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				| well the "start ./Flow.asx" works in cmd to run the file. but i was wondering.. how would i use this in java program?
		
 | 
			 
			
				 | 
			 
		  | 
	
	 
		 | 
		
		 | 
	
	
 
		  | 
	
				 
		[Gandalf]
 
  
 
    
		 | 
		
		
			
				  Posted: Wed May 31, 2006 9:42 pm    Post subject: (No subject)  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				| Anything you can type in the command prompt will work with the exec() method Tony posted.
		
 | 
			 
			
				 | 
			 
		  | 
	
	 
		 | 
		
		 | 
	
	
 
		  | 
	
				 
		vicml21
 
 
 
    
		 | 
		
		
			
				  Posted: Fri Jun 02, 2006 12:19 am    Post subject: (No subject)  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				| well i just got it to open regular *.exe's, regular websites (on my comp anyway), and *.bat files. I could use the *.bat files to run the cmd commands, but if anyone else knows anyway to run any random file (with no specific extension, not just bat & exe), i would greatly appreciate it!
		
 | 
			 
			
				 | 
			 
		  | 
	
	 
		 | 
		
		 | 
	
	
 
		  | 
	
				 
		rizzix
 
 
 
    
		 | 
		
		
			
				  Posted: Fri Jun 02, 2006 11:26 am    Post subject: (No subject)  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				| I thought start <file> was supposed to do just that. It should open the <file> with the default application.
		
 | 
			 
			
				 | 
			 
		  | 
	
	 
		 | 
		
		 | 
	
	
 
		  | 
	
				 
		 |