Welcome, Guest. Please Login
vTask Homepage
 
 
Home Help Search Login


Page Index Toggle Pages: 1
Send Topic Print
Relative vs. Asbolute paths for images (Read 761 times)
Email Question
Full Member (10+)
*
Offline



Posts: 19
Relative vs. Asbolute paths for images
Jan 13th, 2010 at 11:12am
 
Hi,

I am a newly registered user (got my licence a few days ago though our supplier at work). Anyway, I have a small feature request for a future release. What I would like is the option (as an application-wide preference under Tools > Options) to favour relative paths over absolute paths when creating new images for image automation. I like to create a folder containing my .vxm file and all associated images so that it is portable and I can move it around without it breaking. vTask Studio permits this kind of relative path if I change it manually, but whenever I create a new image or link to an existing one, by default it injects the absolute path. I'd like the options so that by default, it injects a relative image path.
Back to top
 
 
IP Logged
 
vTask Support
Moderator
*
Offline



Posts: 3596
Tucson, AZ
Re: Relative vs. Asbolute paths for images
Reply #1 - Jan 13th, 2010 at 11:14am
 
Hello,

Your observations about how it behaves now are accurate.  However, we have many users who have lots of scenarios for relatives paths, so it's unlikely that we would make everyone happy with one particular relative path mode. So, what we could do is have a "relative path mode" option that simply returns the base file name.  That way, we don't need to make assumptions about the actual location of the images directory.

It might seem like an obvious solution is to base the relative path on the current location of the source VXM script, but as mentioned above, we've seen lots of path scenarios from our users over the years:  images are a simple subdirectory, for other users it's one folder up and two down, for others they go to a common network location (repository) and then separate subdirectories for each project, etc.  To make it harder, these relative locations can change during production deployment after the initial development is completed -- in other words, we could easily create a large amount of tech support questions for any change made to relative path handling.  Typically, users get around this by using
variables
for the path, which can then be changed in a single spot (such as "%image_folder").  So any solution would have to be something simple like either a bare file name, or the full path.

Maybe others out there have hints or suggestions, but most probably use variables for path management.
Back to top
 

Thank you for using vTask Studio!
WWW  
IP Logged
 
Thomas
vTask Sultan (500+)
*
Offline


Using vTask for over a
Fiftieth of a Century...

Posts: 553
Kirkland, WA
Re: Relative vs. Asbolute paths for images
Reply #2 - Jan 13th, 2010 at 12:58pm
 
A possible different "read" on the thread.

When I captured an image, the text that was automatically inserted into the match data field was   C:\Untitled-Image001.bmp
Are you asking that instead of the full path being inserted that only the filename be inserted, like       \Untitled-Image001.bmp?

Back to top
 
 
IP Logged
 
cappy
vTask Pro (150+)
*
Offline



Posts: 154
over here
Re: Relative vs. Asbolute paths for images
Reply #3 - Jan 13th, 2010 at 1:03pm
 
If it was set up like that and you had more than one file with the same name in different folders, how would vtask know which one you wanted?

ex.
       \abc company\logo.bmp
       \xyz company\logo.bmp

Back to top
 
 
IP Logged
 
Thomas
vTask Sultan (500+)
*
Offline


Using vTask for over a
Fiftieth of a Century...

Posts: 553
Kirkland, WA
Re: Relative vs. Asbolute paths for images
Reply #4 - Jan 13th, 2010 at 1:08pm
 
Quote:
how would vtask know which one you wanted?


Just type it back in. I think the request was to leave the "C:" off by default.

Quote:
by default it injects the absolute path. I'd like the options so that by default, it injects a relative image path

Of course I am guessing, and not a fan of the change if I am right.  Tongue




Back to top
 
 
IP Logged
 
William Warby
Member (5+)
*
Offline



Posts: 8
Re: Relative vs. Asbolute paths for images
Reply #5 - Jan 14th, 2010 at 4:18am
 
Hi all,

I was the user who posted this request by email. First, I should clarify exactly what I mean:

Suppose I create a vTask project in a folder named "myproject" and I create 100 image-based automation steps using the built-in tool to capture a screen area to generate the image. I place each of those images in the "myproject" folder along with the .vxm file. By default, as each image is created, the path inserted into the properties of the "Click on Image" step is "C:\path\to\myproject\newimage.bmp". Now, if I ever want to move the "myproject" folder, I have instantly broken every single step in my project, so whenever I insert a new image into a "Click on Image" or "Move to Image" step, I delete "C:\path\to\myproject\" from the path, leaving just "newimage.bmp". This works well, and enables me to move the "myproject" around with ease, but it is tedious to have to delete the path leading to the image every time I use an image in a step. I want a user selectable option in "Tools > Options" to do this behaviour by default, so when I select or create an image, instead of using an absolute path it uses a path relative to the .vxm file. When I say default, I mean that when the option is enabled by the user, it becomes the default behavior - the option itself should probably not be enabled by default.

Now, it seems logical to me that if this option were enabled, then selecting an image in a subfolder 1 level down from the .vxm file, the inserted path would be ".\subfolder\newimage.bmp" and likewise a folder 1 level up would create a path like " "..\newimage.bmp". This would make it easier to organise lots of images into subfolders below the .vxm file. So, cappy, to answer your point, I would see it inserting "abc company" or "xyz company" as part of the relative path, so that's how it would know which image you meant. It would work on the same principal as relative paths in hyperlinks in HTML pages in that it is relative to the location of the .vxm file.

Having said that, I'd be quite happy at the moment if all it did was dump the entire path and insert "newimage.bmp" in all cases (requiring me to re-insert the folder path if the image was in a different folder) or more sensibly, have this behaviour only apply when the selected image was in the same folder as the .vxm file.

I'm not asking for new behaviour in how relative paths are resolved, only that the already existing behaviour for resolving relative paths is made easier to use by making it the default.
Back to top
 
 
IP Logged
 
cappy
vTask Pro (150+)
*
Offline



Posts: 154
over here
Re: Relative vs. Asbolute paths for images
Reply #6 - Jan 14th, 2010 at 12:55pm
 
I think I am starting to understand what you are talking about (I didn't even know what a relative path was until now).  Here's an idea that you could use until a real solution has been reached for your problem.  When you are writing the script, don't change each individual path on every step as you go.  Wait till you are done, then go to edit, and replace (I think its edit, I am not at my computer that has vTask on it now) and replace "C:\path\to\myproject\"  with nothing

After Thought:
That will replace all maches in all steps, not just image steps.
Back to top
 
 
IP Logged
 
JasonB
vTask Expert (200+)
*
Offline



Posts: 266
Minnesota, USA
Re: Relative vs. Asbolute paths for images
Reply #7 - Jan 20th, 2010 at 2:56pm
 
Cappy is correct.

Most often you will be using paths of subfolders that are relative to the location of the *.vxm script.  vTask already has this functionality build in. The vTask variable {filepath} returns the path of the vtask script that is running.

{filepath}  will return "C:\path\to\myproject"   

So do a find and replace on the entire script replacing "C:\path\to\myproject" with {filepath}. Then you can move things around and everything will work perfectly.
Back to top
 
 
IP Logged
 
vTask Support
Moderator
*
Offline



Posts: 3596
Tucson, AZ
Re: Relative vs. Asbolute paths for images
Reply #8 - Jan 20th, 2010 at 2:57pm
 
Quote:
So do a find and replace on the entire script replacing "C:\path\to\myproject" with {filepath}. Then you can move things around and everything will work perfectly.


Great suggestion!  Thanks.  {filepath} is the answer.
Back to top
 

Thank you for using vTask Studio!
WWW  
IP Logged
 
William Warby
Member (5+)
*
Offline



Posts: 8
Re: Relative vs. Asbolute paths for images
Reply #9 - Feb 9th, 2010 at 9:54am
 
I appreciate what everyone is saying here, but as far as I'm concerned, {filepath} is not the answer. My point is that I don't want to have to manually intervene to make the paths relative - I want this to happen automatically. I could globally replace my project path with {filepath}, equally I could globally replace my project path with "" which would have an identical effect. It doesn't make it any less inconvenient and I don't want to do it only when I've finished working on my project because I might forget - I'd rather do it every time I create a step, but what I really want is not to have to do it in the first place.
Back to top
 
 
IP Logged
 
cappy
vTask Pro (150+)
*
Offline



Posts: 154
over here
Re: Relative vs. Asbolute paths for images
Reply #10 - Feb 9th, 2010 at 10:53am
 
This question is directed at Support.
Is there anything that can be put at the beginning of the script, such as a command or "setting" that will tell the script to ignore "C:whatever\path\" or maybe interpret it as something else.

I am thinking along the lines that vTask knows to interpret all {1}'s as whatever I set it for earlier in the script.

**side note to William**
You said-"I don't want to do it only when I've finished working on my project because I might forget - I'd rather do it every time I create a step, but what I really want is not to have to do it in the first place. "

You will actually be better off saving it till the end and using the replace function in vTask because you will then see how many times and in how many steps it was replaced.  As opposed to doing it one at a time (besides its more time efficient.)  I understand that you would prefer not to have to do it in the first place, that would be ideal, however atleast vTask has the function to do it all at one time.  Which turns what would be a multistep, repetitive task into a one step adjustment.
Back to top
 
 
IP Logged
 
vTask Support
Moderator
*
Offline



Posts: 3596
Tucson, AZ
Re: Relative vs. Asbolute paths for images
Reply #11 - Feb 9th, 2010 at 12:06pm
 
Quote:
@William:  equally I could globally replace my project path with "" which would have an identical effect.

I'd rather do it every time I create a step, but what I really want is not to have to do it in the first place.


Going back to comment #2 on this thread, the best solution might be a global Options setting that only returns the base name, and not the entire path name, and thus require no manual intervention.  This would be an automatic response when selecting an image.  If that's the best solution, it can be added to the request list.

Quote:
@Cappy:  Is there anything that can be put at the beginning of the script, such as a command or "setting" that will tell the script to ignore "C:whatever\path\" or maybe interpret it as something else.


As you described it, a variable seems to provide the needed functionality.  Using a "%folder" variable, and then using it during the run, allows you to have that setting at the beginning of the script.  Adding something different might complicate things; not sure how else it could work cleanly.
Back to top
 

Thank you for using vTask Studio!
WWW  
IP Logged
 
William Warby
Member (5+)
*
Offline



Posts: 8
Re: Relative vs. Asbolute paths for images
Reply #12 - Feb 9th, 2010 at 12:21pm
 
vTask Support wrote on Feb 9th, 2010 at 12:06pm:
Going back to comment #2 on this thread, the best solution might be a global Options setting that only returns the base name, and not the entire path name, and thus require no manual intervention.  This would be an automatic response when selecting an image.  If that's the best solution, it can be added to the request list.

Yes. This is exactly what I wanted when I made the request originally by email.  As mentioned in one of my earlier posts, it would be good if when this global Options setting is enabled, the IDE actually translated the path into a real relative path (so if you select a .bmp file in a subfolder below the .vxm file it returns "subfolder\image.bmp" etc.) as these types of relative paths are already supported in the runtime engine, but if stripping back to the bare filename is the best that can be done, it'd still be a whole lot better than the current manual exercise of shortening the path.
Back to top
 
 
IP Logged
 
vTask Support
Moderator
*
Offline



Posts: 3596
Tucson, AZ
Re: Relative vs. Asbolute paths for images
Reply #13 - Feb 15th, 2010 at 6:54pm
 
Feature requests may be emailed to support@vtaskstudio.com.  Your request has been added to the database for consideration.
Back to top
 

Thank you for using vTask Studio!
WWW  
IP Logged
 
vTask Support
Moderator
*
Offline



Posts: 3596
Tucson, AZ
Re: Relative vs. Asbolute paths for images
Reply #14 - Mar 10th, 2010 at 3:55pm
 
This request has been added to version 7.75.  As described in the earlier posts above, there is a new option in the "Tools > Options > Files" screen, which controls this new feature, called "Return base name only for Property lookups".

...
Back to top
 

Thank you for using vTask Studio!
WWW  
IP Logged
 
Page Index Toggle Pages: 1
Send Topic Print