Select File starting with xx

Discussions and Tech Support related to the iMacros Firefox Add-on, including the built-in Javascript scripting interface for playing .js files.
Forum rules
Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the search box (at the top of each forum page) to see if a similar problem or question has already been addressed.
3. Try searching the iMacros Wiki - it contains the complete iMacros reference as well as plenty of samples and tutorials.
4. We can respond much faster to your posts if you include the following information:CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST
Post Reply
dawidR
Posts: 13
Joined: Thu May 31, 2018 3:27 pm

Select File starting with xx

Post by dawidR » Wed Mar 27, 2019 3:36 pm

Hello,
this maybe a silly question. But is there a way to select a file that starts with specific characters?

For example to select image that start with th code below

Code: Select all

TAG POS=1 TYPE=INPUT:FILE FORM=NAME:image_to_upload ATTR=NAME:image CONTENT=/Users/Desktop/th*.jpg
Maybe it is not doable, I am not sure. Thank you for checking on this question
iMacros for FF V8.9.7
FF v55.0.2
MacOS v10.13
chivracq
Posts: 8406
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Select File starting with xx

Post by chivracq » Wed Mar 27, 2019 5:13 pm

dawidR wrote:
Wed Mar 27, 2019 3:36 pm

Code: Select all

iMacros for FF V8.9.7
FF v55.0.2
MacOS v10.13

Hello,
this maybe a silly question. But is there a way to select a file that starts with specific characters?

For example to select image that start with th code below

Code: Select all

TAG POS=1 TYPE=INPUT:FILE FORM=NAME:image_to_upload ATTR=NAME:image CONTENT=/Users/Desktop/th*.jpg
Maybe it is not doable, I am not sure. Thank you for checking on this question
Here is a Technique that works on Win_x32/x64, I reckon/hope it will probably work the same on MacOS...:

Code: Select all

VERSION BUILD=8820413 RECORDER=FX
SET !EXTRACT_TEST_POPUP NO
SET !TIMEOUT_STEP 1

'SET Folder_Path "/Users/Desktop/"
SET Folder_Path "D:/TEMP/"
SET File_Start "th"
SET File_Ext "jpg"

TAB T=1
TAG POS=1 TYPE=BODY ATTR=*
WAIT SECONDS=0.5

'TAB OPEN
TAB T=2
'URL GOTO=file:///D:/TEMP/
URL GOTO=file:///{{Folder_Path}}

SET !EXTRACT NULL
TAG POS=1 TYPE=TD ATTR=TXT:{{File_Start}}*.{{File_Ext}} EXTRACT=TXT
SET File_Name {{!EXTRACT}}
'PROMPT _{{!EXTRACT}}_
'PAUSE

TAB T=1
'TAG POS=1 TYPE=INPUT:FILE FORM=NAME:image_to_upload ATTR=NAME:image CONTENT=/Users/Desktop/th*.jpg
TAG POS=1 TYPE=INPUT:FILE FORM=NAME:image_to_upload ATTR=NAME:image CONTENT={{Folder_Path}}{{File_Name}}
(Tested on iMacros for FF v8.8.2, Pale Moon v26.3.3 (=FF47), Win10_x64.)

The Path (and the 'Folder_Path' Var) can be specified with or without Double Quotes and with Single or Double Forward Slashes, at least on Windows in my FCI.

The "file:///" Protocol/Syntax for the 'URL GOTO' needs 3x Forward Slashes on Windows, => 4x Forward Slashes on MacOS, I would think...
If unsure, open some local '.txt'/'.html'/'.jpg' in some Tab in FF, then delete the Filename part from the URL in the Browser and hit 'Enter' to open the OS Explorer Folder View and the URL will have automatically the correct Syntax/Path...

OK, I hope it works for you as well on MacOS..., and I hope you won't take 2 weeks to follow up again, ah-ah...! :wink:
Last edited by chivracq on Wed Mar 27, 2019 6:35 pm, edited 1 time in total.
- (F)CIM = (Full) Config Info Missing: iMacros + Browser + OS with all 3 Versions...
- I usually don't even read the Question if that (required) Info is not mentioned...
- Script & URL usually help a lot for a more "educated" Help...
dawidR
Posts: 13
Joined: Thu May 31, 2018 3:27 pm

Re: Select File starting with xx

Post by dawidR » Wed Mar 27, 2019 6:20 pm

Actually very creative solution :) It worked on MAC as well with 3 ///
I have removed the Tab 2 and still works great.

thank you for this! Again works awesomely!
iMacros for FF V8.9.7
FF v55.0.2
MacOS v10.13
chivracq
Posts: 8406
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Select File starting with xx

Post by chivracq » Wed Mar 27, 2019 6:28 pm

dawidR wrote:
Wed Mar 27, 2019 6:20 pm
Actually very creative solution :) It worked on MAC as well with 3 ///
I have removed the Tab 2 and still works great.

thank you for this! Again works awesomely!
Yep-yep, a "creative Mind" is indeed all you need to do "interesting things" with iMacros, ah-ah...! 8)

Good to hear that it works also on MacOS... :D

Yeah well, the 'TAB_2' part was if you didn't want to "pollute" your 'TAB_1' as I didn't know what your Script was doing on that 'TAB_1' before coming to the Upload part..., you can remove it of course... :wink:
- (F)CIM = (Full) Config Info Missing: iMacros + Browser + OS with all 3 Versions...
- I usually don't even read the Question if that (required) Info is not mentioned...
- Script & URL usually help a lot for a more "educated" Help...
Post Reply