Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by el-santia93 · Dec 10, 2013 at 10:34 AM · javascriptscreenshotfolderpaint

paint.exe cant find saved image folder

I capture screenshots in my game and use paint to call it up the problem is the paint application cannot find the path where the picture is saved or is searching for it in the wrong directory as i get this error "C:\User\user\Documents\project\Mytree-0 was not found".Please i need help with this my code is below. Thanks

 Application.CaptureScreenshot( System.IO.Path.Combine(
         System.Environment.GetFolderPath( System.Environment.SpecialFolder.MyPictures ),
             "MyTree-" + PlayerPrefs.GetInt("HighScore") + ".png") );
     yield WaitForSeconds(2);
     
     System.Diagnostics.Process.Start("mspaint.exe","MyTree-" + PlayerPrefs.GetInt("HighScore") + ".png");
Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
2
Best Answer

Answer by KellyThomas · Dec 10, 2013 at 12:34 PM

You are passing different values to CaptureScreenShot() and Start().

CaptureScreenShot() is receiving a fully qualified path, while Start() (and by extension mspaint.exe) is receiving only a filename.

As a result windows is mapping the filename to the current working directory.


I suggest making liberal use of intermediate variables when they will enhance readability and consistency. As a bonus they can make debugging unexpected behaviour easier.

Here is an alternative implementation:

 var directory: String = System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyPictures);
 var filename: String = "MyTree-" + PlayerPrefs.GetInt("HighScore") + ".png";
 var filepath: String =  System.IO.Path.Combine(directory, filename);
     
 Debug.Log("filepath: " + filepath);
     
 Application.CaptureScreenshot( filepath );
 yield WaitForSeconds(2);
 System.Diagnostics.Process.Start("mspaint.exe", filepath);
Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image el-santia93 · Dec 11, 2013 at 07:57 AM 0
Share

thanks a bunch will try this out

avatar image el-santia93 · Dec 11, 2013 at 08:56 AM 1
Share

works like a charm thanks once more

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

17 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Javascript command for taking a screenshot then saving it to a folder directory?? 3 Answers

Unity - JavaScript, it takes screen shot but doesn't post(form) to server. it works fine with pc (web cam) but not on android device. is it because of resolution???? 0 Answers

Sound system not working correctly 0 Answers

Setting Scroll View Width GUILayout 1 Answer

Can someone help me fix my Javascript for Flickering Light? 6 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges