[solved]how to search for via routes when there are no direc

Get help with using AutoHotkey and its commands and hotkeys
User avatar
smorgasbord
Posts: 490
Joined: 30 Sep 2013, 09:34

[solved]how to search for via routes when there are no direc

07 Apr 2015, 20:09

How to make it work when there is no direct route, like from Mangalore (to Mumbai) to Vishakapatnam.

The required end result for simple direct routes is shown, eg put in from Agartala and Guwahati in to.Can i get the same kind of results if there is no direct route as shown in the first line above?
Yet bigger problem sometimes there is more than one via station. how to get that too.like to reach from A to B we have to go like A to c to D to B ( line separated, all routes shown and the lowest of HLTC+Airfuel out of those at the top )

Thanks a Ton in advance.

Code: [Select all] [Expand] [Download] (Script.ahk)GeSHi © Codebox Plus

Last edited by smorgasbord on 19 Apr 2015, 00:50, edited 2 times in total.
John ... you working ?
User avatar
boiler
Posts: 2372
Joined: 21 Dec 2014, 02:44

Re: how to search for via routes when there are no direct ro

07 Apr 2015, 21:45

You have brackets around the optional parameters in your function calls. From the documentation:
Throughout the documentation, you will see these two symbols ([ and ]) surrounding code in the yellow syntax box at the top of almost all pages. Anything inside of these brackets are OPTIONAL. Meaning the stuff inside can be left out if you don't need them. When writing your code, it is very important to NOT type the []'s in your code.
User avatar
smorgasbord
Posts: 490
Joined: 30 Sep 2013, 09:34

Re: how to search for via routes when there are no direct ro

07 Apr 2015, 22:43

@boiler, please tell the line no.s thanks.
BTW i reached to work with level 2 so far

till level 4 is required


Code: [Select all] [Expand] [Download] (Script.ahk)GeSHi © Codebox Plus

John ... you working ?
Guest

Re: how to search for via routes when there are no direct ro

08 Apr 2015, 03:13

An improved level 2, similarly there has to be level 3 and level 4

Code: [Select all] [Expand] [Download] (Script.ahk)GeSHi © Codebox Plus

User avatar
smorgasbord
Posts: 490
Joined: 30 Sep 2013, 09:34

Re: how to search for via routes when there are no direct ro

08 Apr 2015, 04:07

@hd0202
not working :\
sorry if i am missing something.
Btw: the guest is also by me.

thanks for your time. :)
John ... you working ?
hd0202
Posts: 61
Joined: 04 Oct 2013, 03:07
Location: Germany near Cologne

Re: how to search for via routes when there are no direct ro

08 Apr 2015, 05:21

Here is my new suggestion, I deleted the previous as I found the problems by myself:

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus

Hubert
User avatar
boiler
Posts: 2372
Joined: 21 Dec 2014, 02:44

Re: how to search for via routes when there are no direct ro

08 Apr 2015, 07:08

smorgasbord wrote:@boiler, please tell the line no.s thanks.

You have this:
complete_Array := strsplit(var, ["`n", "`t"])

You can't have the [ ] in it. So it should look like this:
complete_Array := strsplit(var, "`n", "`t")

...except I don't think you are really trying to use the third parameter which would say you want to omit the tab character. If you are trying to make a two-dimensional array, You can't do that from one StrSplit.
User avatar
smorgasbord
Posts: 490
Joined: 30 Sep 2013, 09:34

Re: how to search for via routes when there are no direct ro

08 Apr 2015, 07:20

@hd0202
Attachments
hd.PNG
hd.PNG (2.41 KiB) Viewed 2162 times
John ... you working ?
hd0202
Posts: 61
Joined: 04 Oct 2013, 03:07
Location: Germany near Cologne

Re: how to search for via routes when there are no direct ro

08 Apr 2015, 07:24

@boiler: sorry, you are wrong. Please read the docu about StrSplit():
Delimiters

If this parameter is blank or omitted, each character of the input string will be treated as a separate substring.

Otherwise, Delimiters can be either a single string or an array of strings, each of which is used to determine where the boundaries between substrings occur.
Hubert
User avatar
smorgasbord
Posts: 490
Joined: 30 Sep 2013, 09:34

Re: how to search for via routes when there are no direct ro

08 Apr 2015, 07:24

@boiler

Code: [Select all] [Expand] [Download] (Script.ahk)GeSHi © Codebox Plus

John ... you working ?
hd0202
Posts: 61
Joined: 04 Oct 2013, 03:07
Location: Germany near Cologne

Re: how to search for via routes when there are no direct ro

08 Apr 2015, 07:40

@smorgasbord: sorry, this is one of my test cases, and here is the result as msgbox:
---------------------------
Script(2)_neu2.ahk
---------------------------
From: Agartala To: Guwahati HLTC (Economy Class): 4831 DLTC (Executive Class): 10140 Airline Fuel Charge:1850 HLTC (Economy Class)+Airline Fuel Charge: 6681

a_ahkversion: 1.1.21.00
a_osversion: WIN_8.1
a_is64bitos 1
---------------------------
OK
---------------------------
Hubert
User avatar
smorgasbord
Posts: 490
Joined: 30 Sep 2013, 09:34

Re: how to search for via routes when there are no direct ro

08 Apr 2015, 07:48

@Hubert
Version v1.1.21.02
WIN_8
Attachments
hubert.PNG
hubert.PNG (1.24 KiB) Viewed 2141 times
John ... you working ?
User avatar
smorgasbord
Posts: 490
Joined: 30 Sep 2013, 09:34

Re: how to search for via routes when there are no direct ro

08 Apr 2015, 07:53

@Hubert
Attachments
hubert.PNG
John ... you working ?
hd0202
Posts: 61
Joined: 04 Oct 2013, 03:07
Location: Germany near Cologne

Re: how to search for via routes when there are no direct ro

08 Apr 2015, 07:56

@smorgasbord: remove #warn

Hubert
hd0202
Posts: 61
Joined: 04 Oct 2013, 03:07
Location: Germany near Cologne

Re: how to search for via routes when there are no direct ro

08 Apr 2015, 08:04

@smorgasbord: or insert at the beginning:

Code: [Select all] [Download] GeSHi © Codebox Plus

test := ""
list_of_from_places := ""
list_of_to_places := ""

and change the loop:

Code: [Select all] [Download] GeSHi © Codebox Plus

loop, % result.maxindex()
{
k := result.maxindex() - a_index + 1
v := result[k]
test .= "From: " . v[1] . " To: " . v[2] . " HLTC (Economy Class): " . v[3] . " DLTC (Executive Class): " . v[4] . " Airline Fuel Charge:" . v[5] . " HLTC (Economy Class)+Airline Fuel Charge: " . v[3] + v[5] "`n"
}
Hubert
User avatar
TLM
Posts: 1322
Joined: 01 Oct 2013, 07:52

Re: how to search for via routes when there are no direct ro

08 Apr 2015, 08:21

boiler wrote:You have this:
complete_Array := strsplit(var, ["`n", "`t"])

You can't have the [ ] in it. So it should look like this:
complete_Array := strsplit(var, "`n", "`t")

...except I don't think you are really trying to use the third parameter which would say you want to omit the tab character. If you are trying to make a two-dimensional array, You can't do that from one StrSplit.
This is not true. The StrSplit() function excepts an array of delimiters: msgbox % StrSplit( "a,b,c!d*e", [ ",", "!", "*" ] ).Length()

Code: [Select all] [Download] (Script.ahk)GeSHi © Codebox Plus

For i, key in StrSplit( "a,b,c!d*e", [ ",", "!", "*" ] )
msgbox % key
User avatar
smorgasbord
Posts: 490
Joined: 30 Sep 2013, 09:34

Re: how to search for via routes when there are no direct ro

08 Apr 2015, 08:27

@Hubert

Code: [Select all] [Expand] [Download] (Script.ahk)GeSHi © Codebox Plus


:( not working
John ... you working ?
User avatar
smorgasbord
Posts: 490
Joined: 30 Sep 2013, 09:34

Re: how to search for via routes when there are no direct ro

08 Apr 2015, 08:40

Reached LEVEL 3. eg: AgartalAgatti to Ranchi

Code: [Select all] [Expand] [Download] (Script.ahk)GeSHi © Codebox Plus

John ... you working ?
hd0202
Posts: 61
Joined: 04 Oct 2013, 03:07
Location: Germany near Cologne

Re: how to search for via routes when there are no direct ro

08 Apr 2015, 08:47

@smorgasbord: please copy the 191 flight lines from your old version. On the way over this forum the `t were expanded to spaces

Hubert
User avatar
smorgasbord
Posts: 490
Joined: 30 Sep 2013, 09:34

Re: how to search for via routes when there are no direct ro

08 Apr 2015, 08:55

@hd0202
could you paste the code at some other site?
like
http://ahk.uk.to/
OR
someother similar site?
thanks
John ... you working ?

Return to “Ask For Help”

Who is online

Users browsing this forum: No registered users and 44 guests