Save file in different name

How can I save the screenshot image in different names?
Example:When button 1 is click save in screenshot1.jpg, then button 1 is click again save in screenshot2.jpg ......etc
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim bmpScreenshot As Bitmap = New Bitmap(Panel1.Width, Panel1.Height - 300, PixelFormat.Format32bppArgb)
' Create a graphics object from the bitmap
Dim gfxScreenshot As Graphics = Graphics.FromImage(bmpScreenshot)
' Take screenshot of just the panel control
gfxScreenshot.CopyFromScreen(Me.PointToScreen(Panel1.Location), New Point(0, 0), Panel1.Size, CopyPixelOperation.SourceCopy)
' Save the screenshot
bmpScreenshot.Save("D:\screenshot.jpg", Imaging.ImageFormat.Jpeg)
End Sub
Thanks

If you only want to number the images like ScreenShot_0000, ScreenShot_0001, and so on...  Then you can use a class scoped integer variable to number them like below.  Also, you can draw the panel directly to a Bitmap without using the CopyFromScreen
method.
Public Class Form1
Private count As Integer = 0
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim bmp As New Bitmap(Panel1.Width, Panel1.Height)
Panel1.DrawToBitmap(bmp, New Rectangle(Point.Empty, Panel1.Size))
Dim fn As String = "ScreenShot_" & count.ToString.PadLeft(4, "0"c) & ".jpg"
Dim saveas As String = IO.Path.Combine("C:\TestFolder", fn)
bmp.Save(saveas, Imaging.ImageFormat.Jpeg)
count += 1
End Sub
End Class
 However, when you close your application and reopen it again it would start at ScreenShot_0000 again and would overwrite any images that are in that directory that have the same numbered names.  If you want it to automatically detect the last
numbered file and start with the next number then you can use a While loop in the above code to avoid overwriting the existing images like this.
Public Class Form1
Private count As Integer = 0
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim bmp As New Bitmap(Panel1.Width, Panel1.Height)
Panel1.DrawToBitmap(bmp, New Rectangle(Point.Empty, Panel1.Size))
Dim fn As String = "ScreenShot_" & count.ToString.PadLeft(4, "0"c) & ".jpg"
Dim saveas As String = IO.Path.Combine("C:\TestFolder", fn)
While IO.File.Exists(saveas)
count += 1
fn = "ScreenShot_" & count.ToString.PadLeft(4, "0"c) & ".jpg"
saveas = IO.Path.Combine("C:\TestFolder", fn)
End While
bmp.Save(saveas, Imaging.ImageFormat.Jpeg)
count += 1
End Sub
End Class
If you say it can`t be done then i`ll try it
Hi IronRazerz,
Thanks for your solution. I would like to ask you question about open files and rename files, I know that there are out of the question in this thread but the only way I can get the answer through your solution.
My problem is when I open files "ScreenShot_0000.jpg" and then when I want to rename files the file will rename  "ScreenShot_0001" instant of "ScreenShot_0000.jpg".
How can I suppose to open and rename files follow by sequence without interrupt?
Below codes are my modified codes to open and rename files.
Public Class Form1
Private count As Integer = 0
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
'rename files
Dim fn As String = "C:\Users\hwai\Desktop\Capture\ScreenShot_" & count.ToString.PadLeft(4, "0"c) & ".jpg"
Dim saveas As String = IO.Path.Combine("C:\Users\hwai\Desktop\Capture\", fn)
My.Computer.FileSystem.RenameFile(saveas, "Rename_" & count.ToString.PadLeft(4, "0"c) & ".jpg")
count += 1
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
'open files
Dim fn As String = "C:\Users\hwai\Desktop\Capture\ScreenShot_" & count.ToString.PadLeft(4, "0"c) & ".jpg"
Dim saveas As String = IO.Path.Combine("C:\Users\hwai\Desktop\Capture\", fn)
Dim ps2 As Process = Process.Start(saveas)
count += 1
End Sub
End Class
Thanks

Similar Messages

  • IE saves file in different name(ex. some[1].somthing.txt ) why adds [1]?

    I am streaming the file content from servlet. My header & content type setting looks as follows.
    String downloadType = "application/octet-stream";
    res.setContentType(downloadType + "; name=\"" + fileName + "\"");
    res.setHeader("Content-Disposition", "attachment; filename=\"" + fileName + "\";");
    When I click the link on the HTML page or if I right click and 'Save Target As' the file.
    Actual file name = some.somthing.txt
    but it saves As = some[1].somthing.txt
    If the file name contains only one '.' then it saves as same name, the problem arises only if the file name has more than one 'dot'.
    If any body has any idea please help me out..
    Note: The directory I chose to download doesn't have any files by name
    "some.somthing.txt" so it wasn't due to cache.

    If the file name contains only one '.' then it saves
    as same name, the problem arises only if the file name
    has more than one 'dot'.I encourage you to read RFC1806 and its successors. Start
    with RFC1806, '2.3 The Filename Parameter'. You should stick
    with 8.3 filenames.

  • I have been creating forms in InDesign and pulling into Acrobat XI Pro to do form fields. My client would like to fill in the PDF form, save under a different name locally on their device, and redistribute. The problem I have is that, sometimes, they want

    I have been creating forms in InDesign and pulling into Acrobat XI Pro to do form fields. My client would like to fill in the PDF form using Reader, save under a different name locally on their device, and redistribute. The problem I have is that, sometimes, they want to redistribute the form as Read Only. I know how to flatten the form on a mobile device, but uncertain how they can do that with a PC or Mac using Adobe Reader. I looked at FormsCentral thinking there might be a solution going that route, but don't believe there is. Any advice?

    FormsCentral won't help with flattening a form. You could set up the form in Acrobat so that the fields are set to read-only, using JavaScript. Not quite the same as flattening but it's the best Reader can do.
    Note that when Reader is used to e-sign a document, it gets flattened, but this won't be possible if you need to Reader-enable the form and under certain other conditions.

  • One file has different names

    I've never seen this before. A file has different names. See the get info: note the name at the top doesn't agree with the name & extension below. See the ls -l in the terminal as compared to the finder name.
    !http://farm3.static.flickr.com/2425/4042669881c9a9a0b767o.png!
    Robert

    Hi Robert, I've seen that a couple of times with Packages, I think it comes from them changing the Name of the APP but not in the Info.plist in the Package.
    My BJPrinterUtility.app is version 3.2.0 and has "BJPrinterUtility.app" in all places.

  • Save Task with Different name in workspace

    Hi,
    While using SAVE button in workspace, is there a way to save tasks with different names?
    steps:
          1) Click on start Process in workspace  - Complete task order
           2) Click on save button with some data.
                      - Is it possible to change the name here?
    if there are 50 tasks named "Complete task order" in To-do list, users want the ability to rename task.
    Any help is appreciated.
    Thanks,
    Krishna

    Hi,
    While using SAVE button in workspace, is there a way to save tasks with different names?
    steps:
          1) Click on start Process in workspace  - Complete task order
           2) Click on save button with some data.
                      - Is it possible to change the name here?
    if there are 50 tasks named "Complete task order" in To-do list, users want the ability to rename task.
    Any help is appreciated.
    Thanks,
    Krishna

  • Save file as or save file in different folder

    I want to open a file then save it in a different predetermined folder with the same name or maybe with a different name, is there a save or save as... action?
    I also want to sometimes create a new folder then rename it based on the name of the original file. Can't find that either. But I'm totally new at this.
    I'm getting stumped by both of these.
    Thanks,
    Automator newbie trying to convert 3d files to other format 3d files.
    Automator is so cool if I can get it to work.

    When using variables, the input items for the various Automator actions can be looked at like a stack of cards. You can do stuff with the stack you have, or set it aside to do stuff with a different stack and get the original stack back later.
    The following is an example that creates a folder from the name of a file, then copies the file there.
    1) *Ask for FInder Items* -- just get a single file
    2) *Set Value of Variable* { Variable: _Original Item_ } -- save it for later
    3) *Get Names of Finder Items* { Name: Basename only } -- get the name for the folder
    4) *Set Value of Variable* { Variable: _Item Name_ } -- save for use with the *New Folder* action
    5) *Get Value of Variable* { Variable: _Original Item_ } (Ignore Input) -- get the file back
    6) *New Folder* { Name: _drag Item Name variable here_ Where: wherever } -- create & copy
    Note that this workflow takes advantage of the fact that if items are passed to the *New Folder* action, it will copy them to the newly created folder.
    Since there isn't a way to loop a workflow other than the whole thing, to handle multiple items you would need to use an action such as the *Dispense Items Incrementally* action from http://automator.us/leopard/downloads/. The action will take your original input items and dispense them one at a time each time the workflow loops.

  • Problem saving files with different name with DFS installed

    I have a server that I have DFS installed and running on. This appears to work fine. There is one problem that I have encountered though:
    On a share I have a folder that is not inheriting rights from it parent object. This works fine with DFS. When I create a new word document and try to save it in this folder with a different name other than the default (doc1.doc) I get an error saying that the user doesn't have permission, but I can save it as the default name of doc1.doc. I can then re-name the file to what I want from windows explorer, open it up in word, work on it and save it again. Even with the new file name I can't do a save-as and save it as a different file.
    All the other folders under the share that inherit rights from the parent folder work.
    eg save-as in \\server\share\folder or below works
    save-as it in \\server\share\no_inheritance or below does not work
    Anyone have any ideas?

    Originally Posted by ndean
    I have a server that I have DFS installed and running on. This appears to work fine. There is one problem that I have encountered though:
    On a share I have a folder that is not inheriting rights from it parent object. This works fine with DFS. When I create a new word document and try to save it in this folder with a different name other than the default (doc1.doc) I get an error saying that the user doesn't have permission, but I can save it as the default name of doc1.doc. I can then re-name the file to what I want from windows explorer, open it up in word, work on it and save it again. Even with the new file name I can't do a save-as and save it as a different file.
    All the other folders under the share that inherit rights from the parent folder work.
    eg save-as in \\server\share\folder or below works
    save-as it in \\server\share\no_inheritance or below does not work
    Anyone have any ideas?
    I have the same problem... how did you solve it?
    Thanks!
    Andres, Blogger

  • SAVEAS FILE WITH OTHER NAME

    HI
    I'm trying to create a script to save a file that is already open in the same directory with a different name.
    Example: nome_0000_art to nome_0000_closed
    I tried to create from another script that saves EPS but as I am new to the subject could not make it work
    Could anyone help me, how do I perform the command saveas automatically without showing the dialog window by changing the file name?

    WORKED PERFECTLY!!!
    My script was well
    >>>>>>>>>>>>>>>>
    #target illustrator
    var sourceDoc = app.activeDocument;
    var sourceName = sourceDoc.name;
    var sourceDoc_Path = File(sourceDoc.path);
    var substituir_sourceName = sourceName.replace (/ARTE\..{2,4}$/,'DIGITAL.ai');
    var substituir_Path = sourceDoc_Path+"/" + substituir_sourceName;
    alert("sourceName: "+sourceName+"\nsourceDoc_Path: "+sourceDoc_Path+"\nsubstituir_Path: "+substituir_Path);
    function exportFileToAI (dest) {
        if ( app.documents.length > 0 ) {
            var saveOptions = new IllustratorSaveOptions();
            var ai8Doc = new File(dest);
            saveOptions.compatibility = Compatibility.ILLUSTRATOR16;
            saveOptions.flattenOutput = OutputFlattening.PRESERVEAPPEARANCE;
            app.activeDocument.saveAs( ai8Doc, saveOptions );
    var destFilePath = substituir_Path;
    exportFileToAI (destFilePath);
    <<<<<<<<<<<<<<<<<<<<
    Thanks!!!

  • How to read multiple files of different name using single file adapter

    There are two inbound locations inbound1 and inbound2 , and the files structure present in these two inbound locations are same but the files start with different names example
    (1)files in inbound1 starts with file1,file2...
    (2)files in inbound2 starts with abc1,abc2...
    by using same file adapter with read option how can i read both files....

    Hi K.A.N.N.,
    You can define multiple directories using the above link in 11g and poll for the file as \*.*.
    Alternatively you can use the Synchronous Read and specify the file name at runtime.
    You can also use Pick activity to define multiple branches each with a File Adapter to read from a specified location with specified file name. Although it would contain multiple Adapter Definitions at Development-time, only one of the Adapters will execute at Run-Time.
    Regards,
    Neeraj Sehgal

  • Picking file with different names

    Hi Experts,
        I am doing file to file scenario without IR.I am just picking up the files from sap appl server  and placing in third party server.
    my question is i having ten files different names.so i haev to pick up all the files.i can not put the * in file name scheme as it has different file in the same folder which should not picked ip.
    so how is is possible in file adapter do i need to create 10 different channels for 10 different file or any other way is there.
    Thanks,
    Bhaskar

    Hi,
    If you dont want any file to be picked by sender file adapter use the Exclusion mask in it.
    Go to advance selection for source file
    Refer http://help.sap.com/saphelp_nw04/helpdata/en/e3/94007075cae04f930cc4c034e411e1/content.htm
    Regards
    suraj
    Edited by: S.R.Suraj on Aug 11, 2009 6:34 AM

  • Look for files with different names

    Do we have any utility or command in solaris 8 where we can check for files in two folders with different names and display them somewhere? Manual search for such files becomes very difficult when there are a large number of files in the folders. Please suggest.

    Check with an Unix forum like http://www.unix.com

  • Batch Rename Multiple files with different names

    Hi,
    Is there any way to batch rename multiple files with individual names? I.e
    IMG_123 changed to  RSP45AS
    IMG_124 changed to MOL157A
    IMG_125 changed to AGKH135
    IMG_126 changed to MNOLH13
    IMG_127 changed to ASFBLUG
    Etc.
    Are they any programs or scripts or plug ins that would do that job?
    Thanks

    HI there Onemorewave,
    It looks like there is a batch remname feature included in OS X 10.10 Yosimte if you are planing on updating. 
    Rename files, folders, and disks - Mac Help
    Rename multiple items
    Select the items, then Control-click one of them.
    In the shortcut menu, select Rename Items.
    In the pop-up menu below Rename Folder Items, choose to replace text in the names, add text to the names, or change the name format.
    Replace text: Enter the text you want to remove in the Find field, then enter the text you want to add in the “Replace with” field.
    Add text: Enter the text to you want to add in the field, then choose to add the text before or after the current name.
    Format: Choose a name format for the files, then choose to put the index, counter, or date before or after the name. Enter a name in the Custom Format field, then enter the number you want to start with.
    Click Rename.
    Note: To batch rename, you would want to choose the "Format" option.
    -Griff W

  • Crertifiacte download in Safari Browser saves file with CGI name

    We need to download user certificate in FireFox and Safari browsers as a multiple MIME message.
    ---- Sample MIME message template - START ----
    Content-Type: multipart/mixed; boundary="ABABABABABAB"
    --ABABABABABAB
    Content-type: application/x-x509-user-cert
    <cert_blob binary here>
    --ABABABABABAB
    Content-Type:text/html
    <HTML content here>
    --ABABABABABAB--
    ---- Sample MIME message template - START ----
    In FireFox the certificate gets downloaded and installed properly.
    In an ideal world BROWSER should handle "Content-Type:
    application/x-x509-user-cert". Browser should recognize that a user
    certificate is being downloaded and provide steps for user to install.
    But Safari browser prompts user to save the file, where filename is same as the CGI. If you choose “Download”, you will be prompted to install certificate into KeyChain. Displaying the filename as CGI is bit odd and confuses end user.
    How this can be fixed. Why the end user experience is different than Firefox.
    Filename can be changed by using Content-Disposition: HTTP header, but then it would require to have different pages for Safari and Firefox.
    Any input is appreciated.
    Thanks

    hi..
    1. yes i am able to log the file name properly on the server side. Whatever name i use, in whatever language, its showing correctly on server logs.
    2. the content of the file is variable with japanese, english or any other language
    3. in firefox, the name is converted to ascii characters... a combination of asterix, underscores, letters and others.
    4 No i am not getting an exception.....the file isdownloaded with the kindof name i mentioned in above point but the contents are intact. So the contents of file really dont matter in this case. its only the name that is giving a problem.
    I found a solution which was by modifying the content-disposition field of the header. For firefox, it should be something like
    response.setHeader("Content-Disposition", "attachment;filename*=UTF-8''%D0%9C%D0%BE%D1%81%D0%BA%D0%B2%D0%B0.");
    where the numbers are the hex representation of the filename in bytes. ie
    byte[] utfName = filename.getBytes("utf-8");
    String nameToSend = /*Hex represenation of utfName with each hex character appended by % */
    This method is working in firefox but not IE. Now i need to get this sorted on that.
    ny help...

  • Creating Multiple Files with different name at Receiver side

    Gurus -
    Can anybd tell me how to generate multiple files at the Receiver side in the given target directory with different file names?
    One source message will contain number "N" using which we have to generate files "N" number of times at the Receiver side.
    Kindly help.

    hi,
    are you following this blog?
    provided you have SP>14 and no IDOC/HTTP involved.
    and have you got the error you mentioned when testing with sample payload?
    from where did you take the payload? if is from SXMB_MONI make sure you dont have <MESSAGE> tags in the payload,generally systems adds <MESSAGE> tags when you do multi mapping.
    get the payload from SXMB_MONI right click ->view source payload(this is raw data) and test it.
    it should be ok now.
    and refer my discussion in the thread ,as I got he same error.
    Split mapping created no messages -Mluti Mapping

  • How to deploy ear file with jar file and war file with different names

    Hi,
    As part of weblogic migration from WL 6.1 sp3 to WL 10, Iam facing some problem.
    Problem:
    I have one ear file(abc.ear) to deploy which contains one jar file(xyz.jar) and one war file(pqr.war).
    In config.xml file of WL 6.1, it was mentioned as :
    <Application Deployed="true" Name="abc" Path="./config/mydomain/applications/abc.ear">
    <EJBComponent Name="xyz" Targets="myserver" URI="xyz.jar"/>
    <WebAppComponent Name="pqr" Targets="myserver" URI="pqr.war"/>
    </Application>.
    The above is working fine.
    But in config.xml file WL10,I cannot mention the same.
    I need to have different application anmes for ear,jar and war.If I deploy as a ear file,the jar and war files are deployed with the same ear file name.
    I tried the following options:
    1) Deploying as a ear file by adding <sub-deployments>
    2) Deploying both war and jar seperately which is not recommended in my application.
    Please provide the content I should place in the config.xml so that everything works fine correctly.
    Any help is appreciated.

    Hi,
    As part of weblogic migration from WL 6.1 sp3 to WL 10, Iam facing some problem.
    Problem:
    I have one ear file(abc.ear) to deploy which contains one jar file(xyz.jar) and one war file(pqr.war).
    In config.xml file of WL 6.1, it was mentioned as :
    <Application Deployed="true" Name="abc" Path="./config/mydomain/applications/abc.ear">
    <EJBComponent Name="xyz" Targets="myserver" URI="xyz.jar"/>
    <WebAppComponent Name="pqr" Targets="myserver" URI="pqr.war"/>
    </Application>.
    The above is working fine.
    But in config.xml file WL10,I cannot mention the same.
    I need to have different application anmes for ear,jar and war.If I deploy as a ear file,the jar and war files are deployed with the same ear file name.
    I tried the following options:
    1) Deploying as a ear file by adding <sub-deployments>
    2) Deploying both war and jar seperately which is not recommended in my application.
    Please provide the content I should place in the config.xml so that everything works fine correctly.
    Any help is appreciated.

Maybe you are looking for

  • PO report with the GR and IR activities

    Hi All, Need a report for Purchase order history where we could get the last Goods receipt  activity and the Invoice receipt activity done.Please advice. Regards Rekha

  • How to create a Bool Option for Full Screen and Page Item in Mucow?

    Hi Guys! I was looking to create a bool option in Mucow widget options which toggles between Full Screen and a Normal Page Item . Example: Qooqee's Google Map Widget Need some help. Thanks in Advance

  • Difficulties when creating a slave repository on MDM 7.1

    Hi Experts, We're trying to create a Slave repository on MDM 7.1, but when trying to connect to the other DBMS a message shows up saying that it's unable to connect with Database Server. I went to the MDM log and found the following message: Service

  • How to determine the right PR Release strategy

    Hi Experts, Could u help me to solve this problem! As our business, we want the system automatically determine the right Release Strategy based on the total Amount(amt) of PR such as - if PR total amt <= 1000 USD --> must  checked by only Department

  • Tech Tool Deluxe Volume Structure test query

    Hi, Sorry if this is elsewhere, but my searches have not supplied a definitive answer. As part of my regular maintenance routine on my iMac (mid 2010 i7 quad core) that I purchased just before Christmas, I have run the AppleCare Tech Tool Deluxe scan