Page 1 of 1
Renaming a file on C:\ with a switch knob
Posted: Fri Dec 04, 2015 7:26 pm
by Mr. Mac Snoer
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.

Re: Renaming a file on C:\ with a switch knob
Posted: Mon Dec 07, 2015 9:53 am
by Mr. Mac Snoer
Code: Select all
File.rename("old_name", "new_name")
should work...
..now I just need to connect this to a switch
Re: Renaming a file on C:\ with a switch knob
Posted: Thu Dec 10, 2015 5:42 pm
by Mr. Mac Snoer
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.
