Support

If you have a problem or need to report a bug please email : support@dsprobotics.com

There are 3 sections to this support area:

DOWNLOADS: access to product manuals, support files and drivers

HELP & INFORMATION: tutorials and example files for learning or finding pre-made modules for your projects

USER FORUMS: meet with other users and exchange ideas, you can also get help and assistance here

NEW REGISTRATIONS - please contact us if you wish to register on the forum

Users are reminded of the forum rules they sign up to which prohibits any activity that violates any laws including posting material covered by copyright

Renaming a file on C:\ with a switch knob

For general discussion related FlowStone

Renaming a file on C:\ with a switch knob

Postby Mr. Mac Snoer » Fri Dec 04, 2015 7:26 pm

Lets say I have a file "a.txt" on my c:\.
When I turn the switch to "true" in the gui I want to rename "C:\a.txt" to "c:\xyz_a.txt".
When I turn the switch to "false" in the gui I want to rename the file back to "c:\a.txt".

Any hints would be appreciated. :)
Mr. Mac Snoer
 
Posts: 17
Joined: Sun Nov 08, 2015 1:05 am

Re: Renaming a file on C:\ with a switch knob

Postby Mr. Mac Snoer » Mon Dec 07, 2015 9:53 am

Code: Select all
File.rename("old_name", "new_name")

should work... :)

..now I just need to connect this to a switch
Mr. Mac Snoer
 
Posts: 17
Joined: Sun Nov 08, 2015 1:05 am

Re: Renaming a file on C:\ with a switch knob

Postby Mr. Mac Snoer » Thu Dec 10, 2015 5:42 pm

Here is another simple solution with Ruby Shoes.

The folder is C:\Test\, the file is called A.txt and will be renamed to INACTIVE_A.txt with button one and back to A.txt with button two.

Code: Select all
Shoes.app do
  stack do
    button "Rename A.txt to INACTIVE_A.txt" do
      Dir.chdir("C:/Test")
      File.rename("A.txt", "INACTIVE_A.txt")
    end
    button "Rename INACTIVE_A.txt to A.txt" do
      Dir.chdir("C:/Test")
      File.rename("INACTIVE_A.txt", "A.txt")
    end 
  end


I will try with Flowstone. :)
Mr. Mac Snoer
 
Posts: 17
Joined: Sun Nov 08, 2015 1:05 am


Return to General

Who is online

Users browsing this forum: No registered users and 55 guests