Passing a number through as a literal string Topic is solved

Get help with using AutoHotkey and its commands and hotkeys
5nwYHrhNRY
Posts: 10
Joined: 01 May 2018, 07:18

Passing a number through as a literal string

03 Jun 2018, 05:59

I am not an experienced coder but I have this script almost working after an embarrassing number of total man hours lol. I need a little help getting this finished. TIA in advance for any help and I appreciate your patience. If you're wondering "why would he try to do it this way" I would refer you back to the first sentence lol.

The intent of this code is to launch an image after certain checks have been run. If a series of pixelgetcolor checks return as true then it stores an image pathname as a variable (Path). If ImageSearch returns errorlevel=0 it is (supposed to) store the name of the first existing filename as a variable (File). Not every path contains every file name, I have OR operators connecting a series of possible filenames and I want it to check the names in order and store the first name that actually exists in the directory (I am definitely not sure that my code will actually do this). One thing that I am sure of is that the script stores a value of either '1' or '0' for the file variable every time. I am almost positive this is because I am trying to pass a number through a literal string. Could you have a look at my code and see if you can suggest something? Thanks

Code: Select all

#SingleInstance,Force
CoordMode,Mouse,screen 
CoordMode,Pixel,screen  


Target_Color_2H := "0x00FF00" 
Target_Color_3H := "0x00FFFF" 
Target_Color_BB := "0x8000FF"
Target_Color_SB := "0xFF0080" 
Target_Color_BT := "0xFFFF00" 
Target_Color_R_LMPa := "0xFFFFFF" 
Target_Color_L_LMPa := "0xFFFFFF" 
Target_Color_R_FLDa := "0xFF00FF" 
Target_Color_L_FLDa := "0xFF00FF" 
Target_Color_R_RA2a := "0xFFFFFF" 
Target_Color_L_RA2a := "0xFFFFFF" 
Target_Color_R_RA2b := "0xFFFFFF" 
Target_Color_L_RA2b := "0xFFFFFF" 
Target_Color_R_RA3a := "0xFFFFFF" 
Target_Color_L_RA3a := "0xFFFFFF" 
Target_Color_R_RA3b := "0xFFFFFF" 
Target_Color_L_RA3b := "0xFFFFFF" 
Target_Color_R_RA3c := "0x000000" 
Target_Color_L_RA3c := "0x000000" 
Target_Color_R_AINa := "0x800038" 
Target_Color_L_AINa := "0x800040" 
Target_Color_R_CALa := "0xFFFFFF" 
Target_Color_L_CALa := "0xFFFFFF" 
Target_Color_R_3BTa := "0xFFFFFF"
Target_Color_L_3BTa := "0xFFFFFF" 
Target_Color_L_3BTb := "0xFFFFFF" 
Target_Color_L_3BTc := "0x004000" 
Target_Color_Fold := "0xFFFFFF" 
L_FLDa_X := 334 
L_FLDa_Y := 105 
L_LMPa_X := 134 
L_LMPa_Y := 288 
L_RA2a_X := 141 
L_RA2a_Y := 271 
L_RA2b_X := 197 
L_RA2b_Y := 296 
L_RA3a_X := 141 
L_RA3a_Y := 271 
L_RA3b_X := 195 
L_RA3b_Y := 281 
L_RA3c_X := 177 
L_RA3c_Y := 273
L_AINa_X := 259 
L_AINa_Y := 110 
L_CALa_X := 134 
L_CALa_Y := 289 
L_3BTa_X := 150 
L_3BTa_Y := 281 
R_FLDa_X := 538 
R_FLDa_Y := 109 
R_LMPa_X := 476 
R_LMPa_Y := 310 
R_RA2a_X := 480 
R_RA2a_Y := 297
R_RA2b_X := 540 
R_RA2b_Y := 319 
R_RA3a_X := 480 
R_RA3a_Y := 297 
R_RA3b_X := 539 
R_RA3b_Y := 304 
R_RA3c_X := 521 
R_RA3c_Y := 296 
R_AINa_X := 463 
R_AINa_Y := 110 
R_CALa_X := 476 
R_CALa_Y := 324 
R_3BTa_X := 493 
R_3BTa_Y := 305 
Target_Pos_X := 316 
Target_Pos_Y := 394 
Target_PCount_X := 24 
Target_PCount_Y := 385 
Target_3H_X := 24
Target_3H_Y := 385
Target_2H_X := 23
Target_2H_Y := 387
Target_BB_X := 316 
Target_BB_Y := 394 
Target_SB_X := 316
Target_SB_Y := 394 
Target_BT_X := 315 
Target_BT_Y := 393 
Path := ""
File := ""

Esc::

	PixelGetColor, CC_PCount, Target_PCount_X, Target_PCount_Y, RGB
	PixelGetColor, CC_Pos, Target_Pos_X, Target_Pos_Y, RGB 
	PixelGetColor, CC_FFSBa, R_FLDa_X, R_FLDa_Y, RGB  	
	PixelGetColor, CC_FFSBb, R_FLDb_X, R_FLDb_Y, RGB  
	PixelGetColor, CC_FLSBa, R_LMPa_X, R_LMPa_Y, RGB
	PixelGetColor, CC_F2SBa, R_RA2a_X, R_RA2a_Y, RGB
	PixelGetColor, CC_F2SBb, R_RA2b_X, R_RA2b_Y, RGB
	PixelGetColor, CC_F2SBc, R_AINa_X, R_AINa_Y, RGB
	PixelGetColor, CC_F3SBa, R_RA3a_X, R_RA3a_Y, RGB
	PixelGetColor, CC_F3SBb, R_RA3b_X, R_RA3b_Y, RGB
	PixelGetColor, CC_F3SBc, R_RA3c_X, R_RA3c_Y, RGB
	PixelGetColor, CC_F3SBd, R_AINa_X, R_AINa_Y, RGB
	PixelGetColor, CC_FASBa, R_AINa_X, R_AINa_Y, RGB
	PixelGetColor, CC_FASBb, R_RA2a_X, R_RA2a_Y, RGB
	PixelGetColor, CC_FASBc, R_RA2b_X, R_RA2b_Y, RGB
	PixelGetColor, CC_FASBd, R_RA3b_X, R_RA3b_Y, RGB
	PixelGetColor, CC_FASBe, R_RA3c_X, R_RA3c_Y, RGB
	PixelGetColor, CC_FFLBa, L_FLDa_X, L_FLDa_Y, RGB
	PixelGetColor, CC_FFLBb, R_LMPa_X, R_LMPa_Y, RGB
	PixelGetColor, CC_FFRBa, L_FLDa_X, L_FLDa_Y, RGB
	PixelGetColor, CC_FFRBb, R_RA2a_X, R_RA2a_Y, RGB
	PixelGetColor, CC_FFRBc, R_RA2b_X, R_RA2b_Y, RGB
	PixelGetColor, CC_FFRBd, R_RA3b_X, R_RA3b_Y, RGB
	PixelGetColor, CC_FFRBe, R_RA3c_X, R_RA3c_Y, RGB
	PixelGetColor, CC_FFABa, L_FLDa_X, L_FLDa_Y, RGB
	PixelGetColor, CC_FFABb, R_RA2a_X, R_RA2a_Y, RGB
	PixelGetColor, CC_FFABc, R_RA2b_X, R_RA2b_Y, RGB
	PixelGetColor, CC_FFABd, R_RA3b_X, R_RA3b_Y, RGB	
	PixelGetColor, CC_FFABe, R_RA3c_X, R_RA3c_Y, RGB	
	PixelGetColor, CC_FFABf, R_AINa_X, R_AINa_Y, RGB
	PixelGetColor, CC_FLFBa, L_LMPa_X, L_LMPa_Y, RGB
	PixelGetColor, CC_FLFBb, R_FLDa_X, R_FLDa_Y, RGB
	PixelGetColor, CC_FLLBa, L_LMPa_X, L_LMPa_Y, RGB
	PixelGetColor, CC_FLLBb, R_LMPa_X, R_LMPa_Y, RGB
	PixelGetColor, CC_FLRBa, L_LMPa_X, L_LMPa_Y, RGB
	PixelGetColor, CC_FLRBb, R_RA2a_X, R_RA2a_Y, RGB
	PixelGetColor, CC_FLRBc, R_RA2b_X, R_RA2b_Y, RGB
	PixelGetColor, CC_FLRBd, R_AINa_X, R_AINa_Y, RGB
	PixelGetColor, CC_FLRBe, R_RA3b_X, R_RA3b_Y, RGB
	PixelGetColor, CC_FLRBf, R_RA3c_X, R_RA3c_Y, RGB
	PixelGetColor, CC_FLABa, L_LMPa_X, L_LMPa_Y, RGB
	PixelGetColor, CC_FLABb, R_RA2a_X, R_RA2a_Y, RGB	
	PixelGetColor, CC_FLABc, R_RA2b_X, R_RA2b_Y, RGB	
	PixelGetColor, CC_FLABd, R_RA3b_X, R_RA3b_Y, RGB	
	PixelGetColor, CC_FLABe, R_RA3c_X, R_RA3c_Y, RGB	
	PixelGetColor, CC_FRFBa, L_RA2a_X, L_RA2a_Y, RGB
	PixelGetColor, CC_FRFBb, L_RA2b_X, L_RA2b_Y, RGB	
	PixelGetColor, CC_FRFBc, R_FLDa_X, R_FLDa_Y, RGB	
	PixelGetColor, CC_FRFBd, L_RA3b_X, L_RA3b_Y, RGB
	PixelGetColor, CC_FRFBe, L_RA3c_X, R_RA3c_Y, RGB	
	PixelGetColor, CC_FRCBa, L_RA2a_X, L_RA2a_Y, RGB
	PixelGetColor, CC_FRCBb, L_RA2b_X, L_RA2b_Y, RGB	
	PixelGetColor, CC_FRCBc, R_CALa_X, R_CALa_Y, RGB	
	PixelGetColor, CC_FRCBd, L_RA3b_X, L_RA3b_Y, RGB
	PixelGetColor, CC_FRCBe, L_RA3c_X, L_RA3c_Y, RGB
	PixelGetColor, CC_FRABa, L_RA2a_X, L_RA2a_Y, RGB
	PixelGetColor, CC_FRABb, L_RA2b_X, L_RA2b_Y, RGB
	;PixelGetColor, CC_FRABc, L_RA3a_X, L_RA3a_Y, RGB
	PixelGetColor, CC_FRABd, L_RA3b_X, L_RA3b_Y, RGB
	PixelGetColor, CC_FRABe, R_3BTa_X, R_3BTa_Y, RGB
	PixelGetColor, CC_FRABf, L_RA3c_X, L_RA3c_Y, RGB
	PixelGetColor, CC_FRABg, R_3BTc_X, R_3BTb_Y, RGB	
	PixelGetColor, CC_FAFBa, L_RA2a_X, L_RA2a_Y, RGB
	PixelGetColor, CC_FAFBb, L_RA2b_X, L_RA2b_Y, RGB
	PixelGetColor, CC_FAFBc, L_RA3b_X, L_RA3b_Y, RGB
	PixelGetColor, CC_FAFBd, L_RA3c_X, L_RA3c_Y, RGB
	PixelGetColor, CC_FAFBe, R_FLDa_X, R_FLDa_Y, RGB 
	PixelGetColor, CC_FAFBf, L_AINa_X, L_AINa_Y, RGB 
	PixelGetColor, CC_FACBa, L_RA2a_X, L_RA2b_Y, RGB
	PixelGetColor, CC_FACBb, L_RA2b_X, L_RA2b_Y, RGB
	PixelGetColor, CC_FACBc, L_RA3b_X, L_RA3b_Y, RGB  
	PixelGetColor, CC_FACBd, L_RA3c_X, L_RA3c_Y, RGB
	PixelGetColor, CC_FACBe, R_CALa_X, R_CALa_Y, RGB
	PixelGetColor, CC_FA3Ba, L_RA2a_X, L_RA2b_Y, RGB
	PixelGetColor, CC_FA3Bb, L_RA2b_X, L_RA2b_Y, RGB
	PixelGetColor, CC_FA3Bc, L_RA3b_X, L_RA3b_Y, RGB  
	PixelGetColor, CC_FA3Bd, L_RA3c_X, L_RA3c_Y, RGB	
	PixelGetColor, CC_FACBe, R_3BTa_X, R_3BTa_Y, RGB
	PixelGetColor, CC_HULLa, L_LMPa_X, L_LMPa_Y, RGB
	PixelGetColor, CC_HULRa, R_LMPa_X, R_LMPa_Y, RGB
	PixelGetColor, CC_HU2La, L_RA2a_X, L_RA2a_Y, RGB
	PixelGetColor, CC_HU2Ra, R_RA2a_X, R_RA2a_Y, RGB
	PixelGetColor, CC_HU2Lb, L_RA2b_X, L_RA2b_Y, RGB
	PixelGetColor, CC_HU2Rb, R_RA2b_X, R_RA2b_Y, RGB
	PixelGetColor, CC_HU3La, L_RA3a_X, L_RA3a_Y, RGB
	PixelGetColor, CC_HU3Ra, R_RA3a_X, R_RA3a_Y, RGB
	PixelGetColor, CC_HU3Lb, L_RA3b_X, L_RA3b_Y, RGB
	PixelGetColor, CC_HU3Rb, R_RA3b_X, R_RA3b_Y, RGB
	PixelGetColor, CC_HU3Lc, L_RA3c_X, L_RA3c_Y, RGB
	PixelGetColor, CC_HU3Rc, R_RA3c_X, R_RA3c_Y, RGB
	PixelGetColor, CC_HUALa, L_AINa_X, L_AINa_Y, RGB
	PixelGetColor, CC_HUARa, R_AINa_X, R_AINa_Y, RGB
	PixelGetColor, CC_HUALb, L_FLDa_X, L_FLDa_Y, RGB
	PixelGetColor, CC_HUARb, R_FLDa_X, R_FLDa_Y, RGB
	
		if(CC_PCount==Target_Color_3H&&CC_Pos==Target_Color_BT)
			Path := "C:\Users\User\Desktop\Ranges\img\3 Handed\BTN\"
		if(CC_PCount==Target_Color_3H&&CC_Pos==Target_Color_SB&&CC_FFSBa==Target_Color_R_FLDa)
			Path := "C:\Users\User\Desktop\Ranges\img\3 Handed\SB\BTN FOLD\"
		if(CC_PCount==Target_Color_3H&&CC_Pos==Target_Color_SB&&CC_FLSBa==Target_Color_R_LMPa)
			Path := "C:\Users\User\Desktop\Ranges\img\3 Handed\SB\BTN LIMP\"
		if(CC_PCount==Target_Color_3H&&CC_Pos==Target_Color_SB&&CC_F2SBa==Target_Color_R_RA2a&&CC_F2SBb==Target_Color_R_RA2b&&CC_F2SBc!=Target_Color_R_AINa) 
			Path := "C:\Users\User\Desktop\Ranges\img\3 Handed\SB\BTN RAISE\"
		if(CC_PCount==Target_Color_3H&&CC_Pos==Target_Color_SB&&CC_FASBa==Target_Color_R_AINa) 
			Path := "C:\Users\User\Desktop\Ranges\img\3 Handed\SB\BTN AI\"
		if(CC_PCount==Target_Color_3H&&CC_Pos==Target_Color_SB&&CC_FASBb==Target_Color_R_RA2a&&CC_FASBc!=Target_Color_R_RA2b&&CC_FASBd!=Target_Color_R_RA3b&&CC_FASBe!=Target_Color_R_RA3c) 
			Path := "C:\Users\User\Desktop\Ranges\img\3 Handed\SB\BTN AI\"
		if(CC_PCount==Target_Color_3H&&CC_Pos==Target_Color_BB&&CC_FFLBa==Target_Color_L_FLDa&&CC_FFLBb==Target_Color_R_LMPa) 
			Path := "C:\Users\User\Desktop\Ranges\img\3 Handed\BB\BTN FOLD\SB LIMP\"
		if(CC_PCount==Target_Color_3H&&CC_Pos==Target_Color_BB&&CC_FFRBa==Target_Color_L_FLDa&&CC_FFRBb==Target_Color_R_RA2a&&CC_FFRBc==Target_Color_R_RA2b) 
			Path := "C:\Users\User\Desktop\Ranges\img\3 Handed\BB\BTN FOLD\SB RAISE\"
		if(CC_PCount==Target_Color_3H&&CC_Pos==Target_Color_BB&&CC_FFRBa==Target_Color_L_FLDa&&CC_FFRBb==Target_Color_R_RA2a&&CC_FFRBd==Target_Color_R_RA3b&&CC_FFRBe==Target_Color_R_RA3c) 
			Path := "C:\Users\User\Desktop\Ranges\img\3 Handed\BB\BTN FOLD\SB RAISE\"
		if(CC_PCount==Target_Color_3H&&CC_Pos==Target_Color_BB&&CC_FFABa==Target_Color_L_FLDa&&CC_FFABf==Target_Color_R_AINa) 
			Path := "C:\Users\User\Desktop\Ranges\img\3 Handed\BB\BTN FOLD\SB ALL IN\"
		if(CC_PCount==Target_Color_3H&&CC_Pos==Target_Color_BB&&CC_FFABa==Target_Color_L_FLDa&&CC_FFABb==Target_Color_R_RA2a&&CC_FFABd==Target_Color_R_RA3b&&CC_FFABe==Target_Color_R_RA3c) 
			Path := "C:\Users\User\Desktop\Ranges\img\3 Handed\BB\BTN FOLD\SB ALL IN\"
		if(CC_PCount==Target_Color_3H&&CC_Pos==Target_Color_BB&&CC_FLFBa==Target_Color_L_LMPa&&CC_FLFBb==Target_Color_R_FLDa) 
			Path := "C:\Users\User\Desktop\Ranges\img\3 Handed\BB\BTN LIMP\SB FOLD\"
		if(CC_PCount==Target_Color_3H&&CC_Pos==Target_Color_BB&&CC_FLLBa==Target_Color_L_LMPa&&CC_FLLBb==Target_Color_R_LMPa) 
			Path := "C:\Users\User\Desktop\Ranges\img\3 Handed\BB\BTN LIMP\SB LIMP\"
		if(CC_PCount==Target_Color_3H&&CC_Pos==Target_Color_BB&&CC_FLRBa==Target_Color_L_LMPa&&CC_FLRBb==Target_Color_R_RA2a&&CC_FLRBc==Target_Color_R_RA2b&&CC_FLRBd!=Target_Color_R_AINa) 
			Path := "C:\Users\User\Desktop\Ranges\img\3 Handed\BB\BTN LIMP\SB RAISE\"
		if(CC_PCount==Target_Color_3H&&CC_Pos==Target_Color_BB&&CC_FLRBa==Target_Color_L_LMPa&&CC_FLRBb==Target_Color_R_RA2a&&FLRBe==Target_Color_R_RA3b&&CC_FLRBf==Target_Color_R_RA3c&&CC_FLRBd!=Target_Color_R_AINa) 
			Path := "C:\Users\User\Desktop\Ranges\img\3 Handed\BB\BTN LIMP\SB RAISE\"
		if(CC_PCount==Target_Color_3H&&CC_Pos==Target_Color_BB&&CC_FLABa==Target_Color_L_LMPa&&CC_FLABb==Target_Color_R_RA2a&&CC_FLABc!=Target_Color_R_RA2b&&CC_FLABd!=Target_Color_R_RA3b&&CC_FLABe!=Target_Color_R_RA3c) 
			Path := "C:\Users\User\Desktop\Ranges\img\3 Handed\BB\BTN LIMP\SB ALL IN\"
		if(CC_PCount==Target_Color_3H&&CC_Pos==Target_Color_BB&&CC_FRFBa==Target_Color_L_RA2a&&CC_FRFBb==Target_Color_L_RA2b&&CC_FRFBc==Target_Color_R_FLDa)
			Path := "C:\Users\User\Desktop\Ranges\img\3 Handed\BB\BTN RAISE\SB FOLD\"
		if(CC_PCount==Target_Color_3H&&CC_Pos==Target_Color_BB&&CC_FRFBa==Target_Color_L_RA2a&&CC_FRFBd==Target_Color_L_RA3b&&CC_FRFBe==Target_Color_L_RA3c&&CC_FRFBc==Target_Color_R_FLDa) 
			Path := "C:\Users\User\Desktop\Ranges\img\3 Handed\BB\BTN RAISE\SB FOLD\"
		if(CC_PCount==Target_Color_3H&&CC_Pos==Target_Color_BB&&CC_FRCBa==Target_Color_L_RA2a&&CC_FRCBb==Target_Color_L_RA2b&&CC_FRCBc==Target_Color_R_CALa) 
			Path := "C:\Users\User\Desktop\Ranges\img\3 Handed\BB\BTN RAISE\SB CALL\"
		if(CC_PCount==Target_Color_3H&&CC_Pos==Target_Color_BB&&CC_FRCBa==Target_Color_L_RA2a&&CC_FRCBd==Target_Color_L_RA3b&&CC_FRCBe==Target_Color_L_RA3c&&CC_FRCBc==Target_Color_R_CALa) 
			Path := "C:\Users\User\Desktop\Ranges\img\3 Handed\BB\BTN RAISE\SB CALL\"
		if(CC_PCount==Target_Color_3H&&CC_Pos==Target_Color_BB&&CC_FRABa==Target_Color_L_RA2a&&CC_FRABb==Target_Color_L_RA2b&&CC_FRABe==Target_Color_R_3BTa) 
			Path := "C:\Users\User\Desktop\Ranges\img\3 Handed\BB\BTN RAISE\SB ALL IN\"
		if(CC_PCount==Target_Color_3H&&CC_Pos==Target_Color_BB&&CC_FRABa==Target_Color_L_RA2a&&CC_FRABd==Target_Color_L_RA3b&&CC_FRABe==Target_Color_R_3BTa&&CC_FRABf==Target_Color_L_RA3c) 
			Path := "C:\Users\User\Desktop\Ranges\img\3 Handed\BB\BTN RAISE\SB ALL IN\"
		if(CC_PCount==Target_Color_3H&&CC_Pos==Target_Color_BB&&CC_FAFBf==Target_Color_L_AINa&&CC_FAFBe==Target_Color_R_FLDa) 
			Path := "C:\Users\User\Desktop\Ranges\img\3 Handed\BB\BTN ALL IN\SB FOLD\"
		if(CC_PCount==Target_Color_3H&&CC_Pos==Target_Color_BB&&CC_FAFBa==Target_Color_L_RA2a&&CC_FAFBb!=Target_Color_L_RA2b&&CC_FAFBc!=Target_Color_L_RA3b&&CC_FAFBd!=Target_Color_L_RA3c&&CC_FAFBe==Target_Color_R_FLDa) 
			Path := "C:\Users\User\Desktop\Ranges\img\3 Handed\BB\BTN ALL IN\SB FOLD\"
		if(CC_PCount==Target_Color_3H&&CC_Pos==Target_Color_BB&&CC_FACBa==Target_Color_L_RA2a&&CC_FACBb!=Target_Color_L_RA2b&&CC_FACBc!=Target_Color_L_RA3b&&CC_FACBd!=Target_Color_L_RA3c&&CC_FACBe==Target_Color_R_CALa) 
			Path := "C:\Users\User\Desktop\Ranges\img\3 Handed\BB\BTN ALL IN\SB CALL\"
		if(CC_PCount==Target_Color_3H&&CC_Pos==Target_Color_BB&&CC_FA3Ba==Target_Color_L_RA2a&&CC_FA3Bb!=Target_Color_L_RA2b&&CC_FA3Bc!=Target_Color_L_RA3b&&CC_FA3Bd!=Target_Color_L_RA3c&&CC_FA3Be==Target_Color_R_3BTa) 
			Path := "C:\Users\User\Desktop\Ranges\img\3 Handed\BB\BTN ALL IN\SB CALL"
		if(CC_PCount==Target_Color_2H&&CC_Pos==Target_Color_BT) 
			Path := "C:\Users\User\Desktop\Ranges\img\HU\SB\"
		if(CC_PCount==Target_Color_2H&&CC_Pos==Target_Color_BB&&CC_HULLa==Target_Color_L_LMPa) 
			Path := "C:\Users\User\Desktop\Ranges\img\HU\BB\SB LIMP\"
		if(CC_PCount==Target_Color_2H&&CC_Pos==Target_Color_BB&&CC_HULRa==Target_Color_R_LMPa) 
			Path := "C:\Users\User\Desktop\Ranges\img\HU\BB\SB LIMP\"
		if(CC_PCount==Target_Color_2H&&CC_Pos==Target_Color_BB&&CC_HU2La==Target_Color_L_RA2a&&CC_HU2Lb==Target_Color_L_RA2b) 
			Path := "C:\Users\User\Desktop\Ranges\img\HU\BB\SB 2 X R\"
		if(CC_PCount==Target_Color_2H&&CC_Pos==Target_Color_BB&&CC_HU2Ra==Target_Color_R_RA2a&&CC_HU2Rb==Target_Color_R_RA2b) 
			Path := "C:\Users\User\Desktop\Ranges\img\HU\BB\SB 2 X R\"
		if(CC_PCount==Target_Color_2H&&CC_Pos==Target_Color_BB&&CC_HU3La==Target_Color_L_RA3a&&CC_HU3Lb==Target_Color_L_RA3b&&CC_HU3Lc==Target_Color_L_RA3c) 
			Path := "C:\Users\User\Desktop\Ranges\img\HU\BB\SB 3 X R\"
		if(CC_PCount==Target_Color_2H&&CC_Pos==Target_Color_BB&&CC_HU3Ra==Target_Color_R_RA3a&&CC_HU3Rb==Target_Color_R_RA3b&&CC_HU3Rc==Target_Color_R_RA3c) 
			Path := "C:\Users\User\Desktop\Ranges\img\HU\BB\SB 3 X R\"
		if(CC_PCount==Target_Color_2H&&CC_Pos==Target_Color_BB&&CC_HUALa==Target_Color_L_AINa) 
			Path := "C:\Users\User\Desktop\Ranges\img\HU\BB\SB ALL IN\"
		if(CC_PCount==Target_Color_2H&&CC_Pos==Target_Color_BB&&CC_HUARa==Target_Color_R_AINa) 
			Path := "C:\Users\User\Desktop\Ranges\img\HU\BB\SB ALL IN\"
	
			ImageSearch, 00EBB_X, 00EBB_Y, 340, 370, 370, 400, 00C.png
				if(ErrorLevel=0)
				File := "00"
			ImageSearch, 01EBB_X, 01EBB_Y, 340, 370, 370, 400, 01C.png
				if(ErrorLevel=0)
				File := "00"
			ImageSearch, 02EBB_X, 02EBB_Y, 340, 370, 370, 400, 02C.png
				if(ErrorLevel=0)
				File := "02" OR "00"
			ImageSearch, 03EBB_X, 03EBB_Y, 340, 370, 370, 400, 03C.png
				if(ErrorLevel=0)
				File := "03" OR "00"
			ImageSearch, 04EBB_X, 04EBB_Y, 340, 370, 370, 400, 04C.png
				if(ErrorLevel=0)
				File := "04" OR "00"
			ImageSearch, 05EBB_X, 05EBB_Y, 340, 370, 370, 400, 05C.png
				if(ErrorLevel=0)
				File := "05" OR "04" OR "00"
			ImageSearch, 06EBB_X, 06EBB_Y, 340, 370, 370, 400, 06C.png
				if(ErrorLevel=0)
				File := "06" OR "00"
			ImageSearch, 07EBB_X, 07EBB_Y, 340, 370, 370, 400, 07C.png
				if(ErrorLevel=0)
				File := "07" OR "06" OR "00"
			ImageSearch, 08EBB_X, 08EBB_Y, 340, 370, 370, 400, 08C.png
				if(ErrorLevel=0)
				File := "08" OR "00"
			ImageSearch, 09EBB_X, 09EBB_Y, 340, 370, 370, 400, 09C.png
				if(ErrorLevel=0)
				File := "09" OR "08" OR "00"
			ImageSearch, 10EBB_X, 10EBB_Y, 340, 370, 370, 400, 10C.png
				if(ErrorLevel=0)
				File := "10" OR "09" OR "00"
			ImageSearch, 11EBB_X, 11EBB_Y, 340, 370, 370, 400, 11C.png
				if(ErrorLevel=0)
				File := "11" OR "10" OR "09" OR "00"
			ImageSearch, 12EBB_X, 12EBB_Y, 340, 370, 370, 400, 12C.png
				if(ErrorLevel=0)
				File := "12" OR "11" OR "10" OR "00"	
			ImageSearch, 13EBB_X, 13EBB_Y, 340, 370, 370, 400, 13C.png
				if(ErrorLevel=0)
				File := "13" OR "12" OR "11" OR "10" OR "00"
			ImageSearch, 14EBB_X, 14EBB_Y, 340, 370, 370, 400, 14C.png
				if(ErrorLevel=0)
				File := "13" OR "12" OR "11" OR "10" OR "00"
			ImageSearch, 15EBB_X, 15EBB_Y, 340, 370, 370, 400, 15C.png
				if(ErrorLevel=0)
				File := "15" OR "13" OR "12" OR "11" OR "00"
			ImageSearch, 16EBB_X, 16EBB_Y, 340, 370, 370, 400, 16C.png
				if(ErrorLevel=0)
				File := "16" OR "15" OR "13" OR "12" OR "11" OR "00"	
			ImageSearch, 17EBB_X, 17EBB_Y, 340, 370, 370, 400, 17C.png
				if(ErrorLevel=0)
				File := "17" OR "16" OR "15" OR "12"
			ImageSearch, 18EBB_X, 18EBB_Y, 340, 370, 370, 400, 18C.png
				if(ErrorLevel=0)
				File := "18" OR "17" OR "15"
			ImageSearch, 19EBB_X, 19EBB_Y, 340, 370, 370, 400, 19C.png
				if(ErrorLevel=0)
				File := "18" OR "17" OR "15"
			ImageSearch, 20EBB_X, 20EBB_Y, 340, 370, 370, 400, 20C.png
				if(ErrorLevel=0)
				File := "20" OR "18" OR "17"
			ImageSearch, 21EBB_X, 21EBB_Y, 340, 370, 370, 400, 21C.png
				if(ErrorLevel=0)
				File := "21" OR "20" OR "18" OR "17"					
			ImageSearch, 22EBB_X, 22EBB_Y, 340, 370, 370, 400, 22C.png
				if(ErrorLevel=0)
				File := "21" OR "20" OR "18" OR "17"		
			ImageSearch, 23EBB_X, 23EBB_Y, 340, 370, 370, 400, 23C.png
				if(ErrorLevel=0)
				File := "21" OR "20" OR "18" OR "17"
			ImageSearch, 24EBB_X, 24EBB_Y, 340, 370, 370, 400, 24C.png
				if(ErrorLevel=0)
				File := "21" OR "20" OR "18" OR "17"
			ImageSearch, 25EBB_X, 25EBB_Y, 340, 370, 370, 400, 25C.png
				if(ErrorLevel=0)
				File := "25" OR "21" OR "20" OR "18" OR "17"
			ImageSearch, 26EBB_X, 26EBB_Y, 340, 370, 370, 400, 26C.png
				if(ErrorLevel=0)
				File := "25" OR "21" OR "20" OR "18" OR "17"
			ImageSearch, 27EBB_X, 27EBB_Y, 340, 370, 370, 400, 27C.png
				if(ErrorLevel=0)
				File := "25" OR "21" OR "20" OR "18" OR "17"
			ImageSearch, 28EBB_X, 28EBB_Y, 340, 370, 370, 400, 28C.png
				if(ErrorLevel=0)
				File := "25" OR "21" OR "20" OR "18" OR "17"
			ImageSearch, 29EBB_X, 29EBB_Y, 340, 370, 370, 400, 29C.png
				if(ErrorLevel=0)
				File := "25" OR "21" OR "20" OR "18" OR "17"
			ImageSearch, 30EBB_X, 30EBB_Y, 340, 370, 370, 400, 30C.png
				if(ErrorLevel=0)
				File := "25" OR "21" OR "20" OR "18" OR "17"
			ImageSearch, 31EBB_X, 31EBB_Y, 340, 370, 370, 400, 31C.png
				if(ErrorLevel=0)
				File := "25" OR "21" OR "20" OR "18" OR "17"
			ImageSearch, 32BB_X, 32EBB_Y, 340, 370, 370, 400, 32C.png
				if(ErrorLevel=0)
				File := "25" OR "21" OR "20" OR "18" OR "17"
			ImageSearch, 33EBB_X, 33EBB_Y, 340, 370, 370, 400, 33C.png
				if(ErrorLevel=0)
				File := "25" OR "21" OR "20" OR "18" OR "17"
			ImageSearch, 34EBB_X, 34EBB_Y, 340, 370, 370, 400, 34C.png
				if(ErrorLevel=0)
				File := "25" OR "21" OR "20" OR "18" OR "17"
			ImageSearch, 35EBB_X, 35EBB_Y, 340, 370, 370, 400, 35C.png
				if(ErrorLevel=0)
				File := "25" OR "21" OR "20" OR "18" OR "17"



			Run, %Path%%File%.bmp
SirRFI
Posts: 404
Joined: 25 Nov 2015, 16:52

Re: Passing a number through as a literal string

03 Jun 2018, 06:36

5nwYHrhNRY wrote:One thing that I am sure of is that the script stores a value of either '1' or '0' for the file variable every time.
This is likely because you made logical expression in the assign line - more precisely the ORs. If either of the strings are considered "true" (for what ever reason), it returns 1 (equivalent of true), otherwise 0 (false).
5nwYHrhNRY wrote:

Code: Select all

ImageSearch, 05EBB_X, 05EBB_Y, 340, 370, 370, 400, 05C.png
if(ErrorLevel=0)
	File := "05" OR "04" OR "00"
What do you want to achieve there?
Use

Code: Select all

[/c] forum tag to share your code.
Click on [b]✔[/b] ([b][i]Accept this answer[/i][/b]) on top-right part of the post if it has answered your question / solved your problem.
5nwYHrhNRY
Posts: 10
Joined: 01 May 2018, 07:18

Re: Passing a number through as a literal string

03 Jun 2018, 07:34

SirRFI wrote:
5nwYHrhNRY wrote:One thing that I am sure of is that the script stores a value of either '1' or '0' for the file variable every time.
This is likely because you made logical expression in the assign line - more precisely the ORs. If either of the strings are considered "true" (for what ever reason), it returns 1 (equivalent of true), otherwise 0 (false).
5nwYHrhNRY wrote:

Code: Select all

ImageSearch, 05EBB_X, 05EBB_Y, 340, 370, 370, 400, 05C.png
if(ErrorLevel=0)
	File := "05" OR "04" OR "00"
What do you want to achieve there?
In each of the "File := "05" OR "04" OR "00"" lines only one of the filenames will actually exist in any given directory. In the quoted example I need it to try to open 05.bmp and if that doesn't exist then try to open 04.bmp and if that doesn't exist then it needs to open 00.bmp. Or more specifically it needs to store the corresponding file number that actually exists in the given directory as the variable "File". There will always be at least one and never more than one successful filename match in any given directory.

Edit: "There will always be at least one and never more than one successful filename match in any given directory." <-- This isn't true. Sometimes there will be more than one match and I need it to select the first one in line.
SirRFI
Posts: 404
Joined: 25 Nov 2015, 16:52

Re: Passing a number through as a literal string  Topic is solved

03 Jun 2018, 08:34

I see. In that case you may try following:

demo:

Code: Select all

MsgBox % lookForFiles("C:\Windows\", ["iBetYouDontHaveSuchFileOrFolder", "notepad.exe"])

lookForFiles(path, files) ; path must be string, files must be array
{
	if (!IsObject(files))
		throw Exception("Provided file list is not an array!")
	for id, file_name in files
	{
		if (FileExist(path file_name) != "")
			return file_name
	}
	throw Exception("Neither of provided files exist in: " path, -1)
}
in your code:

Code: Select all

ImageSearch, 05EBB_X, 05EBB_Y, 340, 370, 370, 400, 05C.png
if(ErrorLevel=0)
	File := lookForFiles(path, ["05", "04", "00"])
Note that you'll need to add your .bmp part to either file list of into the function, otherwise file won't be found.
Use

Code: Select all

[/c] forum tag to share your code.
Click on [b]✔[/b] ([b][i]Accept this answer[/i][/b]) on top-right part of the post if it has answered your question / solved your problem.
5nwYHrhNRY
Posts: 10
Joined: 01 May 2018, 07:18

Re: Passing a number through as a literal string

03 Jun 2018, 10:43

Thanks for replying. I wasn't 100% sure what to do with the code but I have it worked into my script now and it no longer throws an error, but the behavior is not what we're looking for. When I press the hotkey to run the searches I get a msgbox that says 'notepad.exe'. Then when I click ok on the msgbox it opens my file manager to the corresponding directory (Path variable). Thx for taking the time I appreciate it.

Code: Select all

#SingleInstance,Force
CoordMode,Mouse,screen 
CoordMode,Pixel,screen  


Target_Color_2H := "0x00FF00" 
Target_Color_3H := "0x00FFFF" 
Target_Color_BB := "0x8000FF"
Target_Color_SB := "0xFF0080" 
Target_Color_BT := "0xFFFF00" 
Target_Color_R_LMPa := "0xFFFFFF" 
Target_Color_L_LMPa := "0xFFFFFF" 
Target_Color_R_FLDa := "0xFF00FF" 
Target_Color_L_FLDa := "0xFF00FF" 
Target_Color_R_RA2a := "0xFFFFFF" 
Target_Color_L_RA2a := "0xFFFFFF" 
Target_Color_R_RA2b := "0xFFFFFF" 
Target_Color_L_RA2b := "0xFFFFFF" 
Target_Color_R_RA3a := "0xFFFFFF" 
Target_Color_L_RA3a := "0xFFFFFF" 
Target_Color_R_RA3b := "0xFFFFFF" 
Target_Color_L_RA3b := "0xFFFFFF" 
Target_Color_R_RA3c := "0x000000" 
Target_Color_L_RA3c := "0x000000" 
Target_Color_R_AINa := "0x800038" 
Target_Color_L_AINa := "0x800040" 
Target_Color_R_CALa := "0xFFFFFF" 
Target_Color_L_CALa := "0xFFFFFF" 
Target_Color_R_3BTa := "0xFFFFFF"
Target_Color_L_3BTa := "0xFFFFFF" 
Target_Color_L_3BTb := "0xFFFFFF" 
Target_Color_L_3BTc := "0x004000" 
Target_Color_Fold := "0xFFFFFF" 
L_FLDa_X := 334 
L_FLDa_Y := 105 
L_LMPa_X := 134 
L_LMPa_Y := 288 
L_RA2a_X := 141 
L_RA2a_Y := 271 
L_RA2b_X := 197 
L_RA2b_Y := 296 
L_RA3a_X := 141 
L_RA3a_Y := 271 
L_RA3b_X := 195 
L_RA3b_Y := 281 
L_RA3c_X := 177 
L_RA3c_Y := 273
L_AINa_X := 259 
L_AINa_Y := 110 
L_CALa_X := 134 
L_CALa_Y := 289 
L_3BTa_X := 150 
L_3BTa_Y := 281 
R_FLDa_X := 538 
R_FLDa_Y := 109 
R_LMPa_X := 476 
R_LMPa_Y := 310 
R_RA2a_X := 480 
R_RA2a_Y := 297
R_RA2b_X := 540 
R_RA2b_Y := 319 
R_RA3a_X := 480 
R_RA3a_Y := 297 
R_RA3b_X := 539 
R_RA3b_Y := 304 
R_RA3c_X := 521 
R_RA3c_Y := 296 
R_AINa_X := 463 
R_AINa_Y := 110 
R_CALa_X := 476 
R_CALa_Y := 324 
R_3BTa_X := 493 
R_3BTa_Y := 305 
Target_Pos_X := 316 
Target_Pos_Y := 394 
Target_PCount_X := 24 
Target_PCount_Y := 385 
Target_3H_X := 24
Target_3H_Y := 385
Target_2H_X := 23
Target_2H_Y := 387
Target_BB_X := 316 
Target_BB_Y := 394 
Target_SB_X := 316
Target_SB_Y := 394 
Target_BT_X := 315 
Target_BT_Y := 393 
Path := ""
File := ""

Esc::

	PixelGetColor, CC_PCount, Target_PCount_X, Target_PCount_Y, RGB
	PixelGetColor, CC_Pos, Target_Pos_X, Target_Pos_Y, RGB 
	PixelGetColor, CC_FFSBa, R_FLDa_X, R_FLDa_Y, RGB  	
	PixelGetColor, CC_FFSBb, R_FLDb_X, R_FLDb_Y, RGB  
	PixelGetColor, CC_FLSBa, R_LMPa_X, R_LMPa_Y, RGB
	PixelGetColor, CC_F2SBa, R_RA2a_X, R_RA2a_Y, RGB
	PixelGetColor, CC_F2SBb, R_RA2b_X, R_RA2b_Y, RGB
	PixelGetColor, CC_F2SBc, R_AINa_X, R_AINa_Y, RGB
	PixelGetColor, CC_F3SBa, R_RA3a_X, R_RA3a_Y, RGB
	PixelGetColor, CC_F3SBb, R_RA3b_X, R_RA3b_Y, RGB
	PixelGetColor, CC_F3SBc, R_RA3c_X, R_RA3c_Y, RGB
	PixelGetColor, CC_F3SBd, R_AINa_X, R_AINa_Y, RGB
	PixelGetColor, CC_FASBa, R_AINa_X, R_AINa_Y, RGB
	PixelGetColor, CC_FASBb, R_RA2a_X, R_RA2a_Y, RGB
	PixelGetColor, CC_FASBc, R_RA2b_X, R_RA2b_Y, RGB
	PixelGetColor, CC_FASBd, R_RA3b_X, R_RA3b_Y, RGB
	PixelGetColor, CC_FASBe, R_RA3c_X, R_RA3c_Y, RGB
	PixelGetColor, CC_FFLBa, L_FLDa_X, L_FLDa_Y, RGB
	PixelGetColor, CC_FFLBb, R_LMPa_X, R_LMPa_Y, RGB
	PixelGetColor, CC_FFRBa, L_FLDa_X, L_FLDa_Y, RGB
	PixelGetColor, CC_FFRBb, R_RA2a_X, R_RA2a_Y, RGB
	PixelGetColor, CC_FFRBc, R_RA2b_X, R_RA2b_Y, RGB
	PixelGetColor, CC_FFRBd, R_RA3b_X, R_RA3b_Y, RGB
	PixelGetColor, CC_FFRBe, R_RA3c_X, R_RA3c_Y, RGB
	PixelGetColor, CC_FFABa, L_FLDa_X, L_FLDa_Y, RGB
	PixelGetColor, CC_FFABb, R_RA2a_X, R_RA2a_Y, RGB
	PixelGetColor, CC_FFABc, R_RA2b_X, R_RA2b_Y, RGB
	PixelGetColor, CC_FFABd, R_RA3b_X, R_RA3b_Y, RGB	
	PixelGetColor, CC_FFABe, R_RA3c_X, R_RA3c_Y, RGB	
	PixelGetColor, CC_FFABf, R_AINa_X, R_AINa_Y, RGB
	PixelGetColor, CC_FLFBa, L_LMPa_X, L_LMPa_Y, RGB
	PixelGetColor, CC_FLFBb, R_FLDa_X, R_FLDa_Y, RGB
	PixelGetColor, CC_FLLBa, L_LMPa_X, L_LMPa_Y, RGB
	PixelGetColor, CC_FLLBb, R_LMPa_X, R_LMPa_Y, RGB
	PixelGetColor, CC_FLRBa, L_LMPa_X, L_LMPa_Y, RGB
	PixelGetColor, CC_FLRBb, R_RA2a_X, R_RA2a_Y, RGB
	PixelGetColor, CC_FLRBc, R_RA2b_X, R_RA2b_Y, RGB
	PixelGetColor, CC_FLRBd, R_AINa_X, R_AINa_Y, RGB
	PixelGetColor, CC_FLRBe, R_RA3b_X, R_RA3b_Y, RGB
	PixelGetColor, CC_FLRBf, R_RA3c_X, R_RA3c_Y, RGB
	PixelGetColor, CC_FLABa, L_LMPa_X, L_LMPa_Y, RGB
	PixelGetColor, CC_FLABb, R_RA2a_X, R_RA2a_Y, RGB	
	PixelGetColor, CC_FLABc, R_RA2b_X, R_RA2b_Y, RGB	
	PixelGetColor, CC_FLABd, R_RA3b_X, R_RA3b_Y, RGB	
	PixelGetColor, CC_FLABe, R_RA3c_X, R_RA3c_Y, RGB	
	PixelGetColor, CC_FRFBa, L_RA2a_X, L_RA2a_Y, RGB
	PixelGetColor, CC_FRFBb, L_RA2b_X, L_RA2b_Y, RGB	
	PixelGetColor, CC_FRFBc, R_FLDa_X, R_FLDa_Y, RGB	
	PixelGetColor, CC_FRFBd, L_RA3b_X, L_RA3b_Y, RGB
	PixelGetColor, CC_FRFBe, L_RA3c_X, R_RA3c_Y, RGB	
	PixelGetColor, CC_FRCBa, L_RA2a_X, L_RA2a_Y, RGB
	PixelGetColor, CC_FRCBb, L_RA2b_X, L_RA2b_Y, RGB	
	PixelGetColor, CC_FRCBc, R_CALa_X, R_CALa_Y, RGB	
	PixelGetColor, CC_FRCBd, L_RA3b_X, L_RA3b_Y, RGB
	PixelGetColor, CC_FRCBe, L_RA3c_X, L_RA3c_Y, RGB
	PixelGetColor, CC_FRABa, L_RA2a_X, L_RA2a_Y, RGB
	PixelGetColor, CC_FRABb, L_RA2b_X, L_RA2b_Y, RGB
	;PixelGetColor, CC_FRABc, L_RA3a_X, L_RA3a_Y, RGB
	PixelGetColor, CC_FRABd, L_RA3b_X, L_RA3b_Y, RGB
	PixelGetColor, CC_FRABe, R_3BTa_X, R_3BTa_Y, RGB
	PixelGetColor, CC_FRABf, L_RA3c_X, L_RA3c_Y, RGB
	PixelGetColor, CC_FRABg, R_3BTc_X, R_3BTb_Y, RGB	
	PixelGetColor, CC_FAFBa, L_RA2a_X, L_RA2a_Y, RGB
	PixelGetColor, CC_FAFBb, L_RA2b_X, L_RA2b_Y, RGB
	PixelGetColor, CC_FAFBc, L_RA3b_X, L_RA3b_Y, RGB
	PixelGetColor, CC_FAFBd, L_RA3c_X, L_RA3c_Y, RGB
	PixelGetColor, CC_FAFBe, R_FLDa_X, R_FLDa_Y, RGB 
	PixelGetColor, CC_FAFBf, L_AINa_X, L_AINa_Y, RGB 
	PixelGetColor, CC_FACBa, L_RA2a_X, L_RA2b_Y, RGB
	PixelGetColor, CC_FACBb, L_RA2b_X, L_RA2b_Y, RGB
	PixelGetColor, CC_FACBc, L_RA3b_X, L_RA3b_Y, RGB  
	PixelGetColor, CC_FACBd, L_RA3c_X, L_RA3c_Y, RGB
	PixelGetColor, CC_FACBe, R_CALa_X, R_CALa_Y, RGB
	PixelGetColor, CC_FA3Ba, L_RA2a_X, L_RA2b_Y, RGB
	PixelGetColor, CC_FA3Bb, L_RA2b_X, L_RA2b_Y, RGB
	PixelGetColor, CC_FA3Bc, L_RA3b_X, L_RA3b_Y, RGB  
	PixelGetColor, CC_FA3Bd, L_RA3c_X, L_RA3c_Y, RGB	
	PixelGetColor, CC_FACBe, R_3BTa_X, R_3BTa_Y, RGB
	PixelGetColor, CC_HULLa, L_LMPa_X, L_LMPa_Y, RGB
	PixelGetColor, CC_HULRa, R_LMPa_X, R_LMPa_Y, RGB
	PixelGetColor, CC_HU2La, L_RA2a_X, L_RA2a_Y, RGB
	PixelGetColor, CC_HU2Ra, R_RA2a_X, R_RA2a_Y, RGB
	PixelGetColor, CC_HU2Lb, L_RA2b_X, L_RA2b_Y, RGB
	PixelGetColor, CC_HU2Rb, R_RA2b_X, R_RA2b_Y, RGB
	PixelGetColor, CC_HU3La, L_RA3a_X, L_RA3a_Y, RGB
	PixelGetColor, CC_HU3Ra, R_RA3a_X, R_RA3a_Y, RGB
	PixelGetColor, CC_HU3Lb, L_RA3b_X, L_RA3b_Y, RGB
	PixelGetColor, CC_HU3Rb, R_RA3b_X, R_RA3b_Y, RGB
	PixelGetColor, CC_HU3Lc, L_RA3c_X, L_RA3c_Y, RGB
	PixelGetColor, CC_HU3Rc, R_RA3c_X, R_RA3c_Y, RGB
	PixelGetColor, CC_HUALa, L_AINa_X, L_AINa_Y, RGB
	PixelGetColor, CC_HUARa, R_AINa_X, R_AINa_Y, RGB
	PixelGetColor, CC_HUALb, L_FLDa_X, L_FLDa_Y, RGB
	PixelGetColor, CC_HUARb, R_FLDa_X, R_FLDa_Y, RGB
	
	
	
		if(CC_PCount==Target_Color_3H&&CC_Pos==Target_Color_BT)
			Path := "C:\Users\User\Desktop\Ranges\img\3 Handed\BTN\"
		if(CC_PCount==Target_Color_3H&&CC_Pos==Target_Color_SB&&CC_FFSBa==Target_Color_R_FLDa)
			Path := "C:\Users\User\Desktop\Ranges\img\3 Handed\SB\BTN FOLD\"
		if(CC_PCount==Target_Color_3H&&CC_Pos==Target_Color_SB&&CC_FLSBa==Target_Color_R_LMPa)
			Path := "C:\Users\User\Desktop\Ranges\img\3 Handed\SB\BTN LIMP\"
		if(CC_PCount==Target_Color_3H&&CC_Pos==Target_Color_SB&&CC_F2SBa==Target_Color_R_RA2a&&CC_F2SBb==Target_Color_R_RA2b&&CC_F2SBc!=Target_Color_R_AINa) 
			Path := "C:\Users\User\Desktop\Ranges\img\3 Handed\SB\BTN RAISE\"
		if(CC_PCount==Target_Color_3H&&CC_Pos==Target_Color_SB&&CC_FASBa==Target_Color_R_AINa) 
			Path := "C:\Users\User\Desktop\Ranges\img\3 Handed\SB\BTN AI\"
		if(CC_PCount==Target_Color_3H&&CC_Pos==Target_Color_SB&&CC_FASBb==Target_Color_R_RA2a&&CC_FASBc!=Target_Color_R_RA2b&&CC_FASBd!=Target_Color_R_RA3b&&CC_FASBe!=Target_Color_R_RA3c) 
			Path := "C:\Users\User\Desktop\Ranges\img\3 Handed\SB\BTN AI\"
		if(CC_PCount==Target_Color_3H&&CC_Pos==Target_Color_BB&&CC_FFLBa==Target_Color_L_FLDa&&CC_FFLBb==Target_Color_R_LMPa) 
			Path := "C:\Users\User\Desktop\Ranges\img\3 Handed\BB\BTN FOLD\SB LIMP\"
		if(CC_PCount==Target_Color_3H&&CC_Pos==Target_Color_BB&&CC_FFRBa==Target_Color_L_FLDa&&CC_FFRBb==Target_Color_R_RA2a&&CC_FFRBc==Target_Color_R_RA2b) 
			Path := "C:\Users\User\Desktop\Ranges\img\3 Handed\BB\BTN FOLD\SB RAISE\"
		if(CC_PCount==Target_Color_3H&&CC_Pos==Target_Color_BB&&CC_FFRBa==Target_Color_L_FLDa&&CC_FFRBb==Target_Color_R_RA2a&&CC_FFRBd==Target_Color_R_RA3b&&CC_FFRBe==Target_Color_R_RA3c) 
			Path := "C:\Users\User\Desktop\Ranges\img\3 Handed\BB\BTN FOLD\SB RAISE\"
		if(CC_PCount==Target_Color_3H&&CC_Pos==Target_Color_BB&&CC_FFABa==Target_Color_L_FLDa&&CC_FFABf==Target_Color_R_AINa) 
			Path := "C:\Users\User\Desktop\Ranges\img\3 Handed\BB\BTN FOLD\SB ALL IN\"
		if(CC_PCount==Target_Color_3H&&CC_Pos==Target_Color_BB&&CC_FFABa==Target_Color_L_FLDa&&CC_FFABb==Target_Color_R_RA2a&&CC_FFABd==Target_Color_R_RA3b&&CC_FFABe==Target_Color_R_RA3c) 
			Path := "C:\Users\User\Desktop\Ranges\img\3 Handed\BB\BTN FOLD\SB ALL IN\"
		if(CC_PCount==Target_Color_3H&&CC_Pos==Target_Color_BB&&CC_FLFBa==Target_Color_L_LMPa&&CC_FLFBb==Target_Color_R_FLDa) 
			Path := "C:\Users\User\Desktop\Ranges\img\3 Handed\BB\BTN LIMP\SB FOLD\"
		if(CC_PCount==Target_Color_3H&&CC_Pos==Target_Color_BB&&CC_FLLBa==Target_Color_L_LMPa&&CC_FLLBb==Target_Color_R_LMPa) 
			Path := "C:\Users\User\Desktop\Ranges\img\3 Handed\BB\BTN LIMP\SB LIMP\"
		if(CC_PCount==Target_Color_3H&&CC_Pos==Target_Color_BB&&CC_FLRBa==Target_Color_L_LMPa&&CC_FLRBb==Target_Color_R_RA2a&&CC_FLRBc==Target_Color_R_RA2b&&CC_FLRBd!=Target_Color_R_AINa) 
			Path := "C:\Users\User\Desktop\Ranges\img\3 Handed\BB\BTN LIMP\SB RAISE\"
		if(CC_PCount==Target_Color_3H&&CC_Pos==Target_Color_BB&&CC_FLRBa==Target_Color_L_LMPa&&CC_FLRBb==Target_Color_R_RA2a&&FLRBe==Target_Color_R_RA3b&&CC_FLRBf==Target_Color_R_RA3c&&CC_FLRBd!=Target_Color_R_AINa) 
			Path := "C:\Users\User\Desktop\Ranges\img\3 Handed\BB\BTN LIMP\SB RAISE\"
		if(CC_PCount==Target_Color_3H&&CC_Pos==Target_Color_BB&&CC_FLABa==Target_Color_L_LMPa&&CC_FLABb==Target_Color_R_RA2a&&CC_FLABc!=Target_Color_R_RA2b&&CC_FLABd!=Target_Color_R_RA3b&&CC_FLABe!=Target_Color_R_RA3c) 
			Path := "C:\Users\User\Desktop\Ranges\img\3 Handed\BB\BTN LIMP\SB ALL IN\"
		if(CC_PCount==Target_Color_3H&&CC_Pos==Target_Color_BB&&CC_FRFBa==Target_Color_L_RA2a&&CC_FRFBb==Target_Color_L_RA2b&&CC_FRFBc==Target_Color_R_FLDa)
			Path := "C:\Users\User\Desktop\Ranges\img\3 Handed\BB\BTN RAISE\SB FOLD\"
		if(CC_PCount==Target_Color_3H&&CC_Pos==Target_Color_BB&&CC_FRFBa==Target_Color_L_RA2a&&CC_FRFBd==Target_Color_L_RA3b&&CC_FRFBe==Target_Color_L_RA3c&&CC_FRFBc==Target_Color_R_FLDa) 
			Path := "C:\Users\User\Desktop\Ranges\img\3 Handed\BB\BTN RAISE\SB FOLD\"
		if(CC_PCount==Target_Color_3H&&CC_Pos==Target_Color_BB&&CC_FRCBa==Target_Color_L_RA2a&&CC_FRCBb==Target_Color_L_RA2b&&CC_FRCBc==Target_Color_R_CALa) 
			Path := "C:\Users\User\Desktop\Ranges\img\3 Handed\BB\BTN RAISE\SB CALL\"
		if(CC_PCount==Target_Color_3H&&CC_Pos==Target_Color_BB&&CC_FRCBa==Target_Color_L_RA2a&&CC_FRCBd==Target_Color_L_RA3b&&CC_FRCBe==Target_Color_L_RA3c&&CC_FRCBc==Target_Color_R_CALa) 
			Path := "C:\Users\User\Desktop\Ranges\img\3 Handed\BB\BTN RAISE\SB CALL\"
		if(CC_PCount==Target_Color_3H&&CC_Pos==Target_Color_BB&&CC_FRABa==Target_Color_L_RA2a&&CC_FRABb==Target_Color_L_RA2b&&CC_FRABe==Target_Color_R_3BTa) 
			Path := "C:\Users\User\Desktop\Ranges\img\3 Handed\BB\BTN RAISE\SB ALL IN\"
		if(CC_PCount==Target_Color_3H&&CC_Pos==Target_Color_BB&&CC_FRABa==Target_Color_L_RA2a&&CC_FRABd==Target_Color_L_RA3b&&CC_FRABe==Target_Color_R_3BTa&&CC_FRABf==Target_Color_L_RA3c) 
			Path := "C:\Users\User\Desktop\Ranges\img\3 Handed\BB\BTN RAISE\SB ALL IN\"
		if(CC_PCount==Target_Color_3H&&CC_Pos==Target_Color_BB&&CC_FAFBf==Target_Color_L_AINa&&CC_FAFBe==Target_Color_R_FLDa) 
			Path := "C:\Users\User\Desktop\Ranges\img\3 Handed\BB\BTN ALL IN\SB FOLD\"
		if(CC_PCount==Target_Color_3H&&CC_Pos==Target_Color_BB&&CC_FAFBa==Target_Color_L_RA2a&&CC_FAFBb!=Target_Color_L_RA2b&&CC_FAFBc!=Target_Color_L_RA3b&&CC_FAFBd!=Target_Color_L_RA3c&&CC_FAFBe==Target_Color_R_FLDa) 
			Path := "C:\Users\User\Desktop\Ranges\img\3 Handed\BB\BTN ALL IN\SB FOLD\"
		if(CC_PCount==Target_Color_3H&&CC_Pos==Target_Color_BB&&CC_FACBa==Target_Color_L_RA2a&&CC_FACBb!=Target_Color_L_RA2b&&CC_FACBc!=Target_Color_L_RA3b&&CC_FACBd!=Target_Color_L_RA3c&&CC_FACBe==Target_Color_R_CALa) 
			Path := "C:\Users\User\Desktop\Ranges\img\3 Handed\BB\BTN ALL IN\SB CALL\"
		if(CC_PCount==Target_Color_3H&&CC_Pos==Target_Color_BB&&CC_FA3Ba==Target_Color_L_RA2a&&CC_FA3Bb!=Target_Color_L_RA2b&&CC_FA3Bc!=Target_Color_L_RA3b&&CC_FA3Bd!=Target_Color_L_RA3c&&CC_FA3Be==Target_Color_R_3BTa) 
			Path := "C:\Users\User\Desktop\Ranges\img\3 Handed\BB\BTN ALL IN\SB CALL"
		if(CC_PCount==Target_Color_2H&&CC_Pos==Target_Color_BT) 
			Path := "C:\Users\User\Desktop\Ranges\img\HU\SB\"
		if(CC_PCount==Target_Color_2H&&CC_Pos==Target_Color_BB&&CC_HULLa==Target_Color_L_LMPa) 
			Path := "C:\Users\User\Desktop\Ranges\img\HU\BB\SB LIMP\"
		if(CC_PCount==Target_Color_2H&&CC_Pos==Target_Color_BB&&CC_HULRa==Target_Color_R_LMPa) 
			Path := "C:\Users\User\Desktop\Ranges\img\HU\BB\SB LIMP\"
		if(CC_PCount==Target_Color_2H&&CC_Pos==Target_Color_BB&&CC_HU2La==Target_Color_L_RA2a&&CC_HU2Lb==Target_Color_L_RA2b) 
			Path := "C:\Users\User\Desktop\Ranges\img\HU\BB\SB 2 X R\"
		if(CC_PCount==Target_Color_2H&&CC_Pos==Target_Color_BB&&CC_HU2Ra==Target_Color_R_RA2a&&CC_HU2Rb==Target_Color_R_RA2b) 
			Path := "C:\Users\User\Desktop\Ranges\img\HU\BB\SB 2 X R\"
		if(CC_PCount==Target_Color_2H&&CC_Pos==Target_Color_BB&&CC_HU3La==Target_Color_L_RA3a&&CC_HU3Lb==Target_Color_L_RA3b&&CC_HU3Lc==Target_Color_L_RA3c) 
			Path := "C:\Users\User\Desktop\Ranges\img\HU\BB\SB 3 X R\"
		if(CC_PCount==Target_Color_2H&&CC_Pos==Target_Color_BB&&CC_HU3Ra==Target_Color_R_RA3a&&CC_HU3Rb==Target_Color_R_RA3b&&CC_HU3Rc==Target_Color_R_RA3c) 
			Path := "C:\Users\User\Desktop\Ranges\img\HU\BB\SB 3 X R\"
		if(CC_PCount==Target_Color_2H&&CC_Pos==Target_Color_BB&&CC_HUALa==Target_Color_L_AINa) 
			Path := "C:\Users\User\Desktop\Ranges\img\HU\BB\SB ALL IN\"
		if(CC_PCount==Target_Color_2H&&CC_Pos==Target_Color_BB&&CC_HUARa==Target_Color_R_AINa) 
			Path := "C:\Users\User\Desktop\Ranges\img\HU\BB\SB ALL IN\"
	
	
		MsgBox % lookForFiles("C:\Windows\", ["iBetYouDontHaveSuchFileOrFolder", "notepad.exe"])

		lookForFiles(path, files) ; path must be string, files must be array
		{
			if (!IsObject(files))
				throw Exception("Provided file list is not an array!")
			for id, file_name in files
			{
				if (FileExist(path file_name) != "")
					return file_name
			}
	
	
	
			ImageSearch, 00EBB_X, 00EBB_Y, 340, 370, 370, 400, 00C.png
				if(ErrorLevel=0)
					File := lookForFiles(path, ["00.bmp"])
			ImageSearch, 01EBB_X, 01EBB_Y, 340, 370, 370, 400, 01C.png
				if(ErrorLevel=0)
					File := lookForFiles(path, ["00.bmp"])
			ImageSearch, 02EBB_X, 02EBB_Y, 340, 370, 370, 400, 02C.png
				if(ErrorLevel=0)
					File := lookForFiles(path, ["02.bmp", "00.bmp"])
			ImageSearch, 03EBB_X, 03EBB_Y, 340, 370, 370, 400, 03C.png
				if(ErrorLevel=0)
					File := lookForFiles(path, ["03.bmp", "00.bmp"])
			ImageSearch, 04EBB_X, 04EBB_Y, 340, 370, 370, 400, 04C.png
				if(ErrorLevel=0)
					File := lookForFiles(path, ["04.bmp", "00.bmp"])
			ImageSearch, 05EBB_X, 05EBB_Y, 340, 370, 370, 400, 05C.png
				if(ErrorLevel=0)
					File := lookForFiles(path, ["05.bmp", "04.bmp", "00.bmp"])
			ImageSearch, 06EBB_X, 06EBB_Y, 340, 370, 370, 400, 06C.png
				if(ErrorLevel=0)
					File := lookForFiles(path, ["06.bmp", "00.bmp"])
			ImageSearch, 07EBB_X, 07EBB_Y, 340, 370, 370, 400, 07C.png
				if(ErrorLevel=0)
					File := lookForFiles(path, ["07.bmp", "06.bmp", "00.bmp"])
			ImageSearch, 08EBB_X, 08EBB_Y, 340, 370, 370, 400, 08C.png
				if(ErrorLevel=0)
					File := lookForFiles(path, ["08.bmp", "00.bmp"])
			ImageSearch, 09EBB_X, 09EBB_Y, 340, 370, 370, 400, 09C.png
				if(ErrorLevel=0)
					File := lookForFiles(path, ["09.bmp", "08.bmp", "00.bmp"])
			ImageSearch, 10EBB_X, 10EBB_Y, 340, 370, 370, 400, 10C.png
				if(ErrorLevel=0)
					File := lookForFiles(path, ["10.bmp", "09.bmp", "00.bmp"])
			ImageSearch, 11EBB_X, 11EBB_Y, 340, 370, 370, 400, 11C.png
				if(ErrorLevel=0)
					File := lookForFiles(path, ["11.bmp", "10.bmp", "09.bmp", "00.bmp"])
			ImageSearch, 12EBB_X, 12EBB_Y, 340, 370, 370, 400, 12C.png
				if(ErrorLevel=0)
					File := lookForFiles(path, ["12.bmp", "11.bmp", "10.bmp", "00.bmp"])
			ImageSearch, 13EBB_X, 13EBB_Y, 340, 370, 370, 400, 13C.png
				if(ErrorLevel=0)
					File := lookForFiles(path, ["13.bmp", "12.bmp", "11.bmp", "10.bmp", "00.bmp"])
			ImageSearch, 14EBB_X, 14EBB_Y, 340, 370, 370, 400, 14C.png
				if(ErrorLevel=0)
					File := lookForFiles(path, ["13.bmp", "12.bmp", "11.bmp", "10.bmp", "00.bmp"])
			ImageSearch, 15EBB_X, 15EBB_Y, 340, 370, 370, 400, 15C.png
				if(ErrorLevel=0)
					File := lookForFiles(path, ["15.bmp", "13.bmp", "12.bmp", "11.bmp", "00.bmp"])
			ImageSearch, 16EBB_X, 16EBB_Y, 340, 370, 370, 400, 16C.png
				if(ErrorLevel=0)
					File := lookForFiles(path, ["16.bmp", "15.bmp", "13.bmp", "12.bmp", "11.bmp", "00.bmp"])
			ImageSearch, 17EBB_X, 17EBB_Y, 340, 370, 370, 400, 17C.png
				if(ErrorLevel=0)
					File := lookForFiles(path, ["17.bmp", "16.bmp", "15.bmp", "12.bmp"])
			ImageSearch, 18EBB_X, 18EBB_Y, 340, 370, 370, 400, 18C.png
				if(ErrorLevel=0)
					File := lookForFiles(path, ["18.bmp", "17.bmp", "15.bmp"])
			ImageSearch, 19EBB_X, 19EBB_Y, 340, 370, 370, 400, 19C.png
				if(ErrorLevel=0)
					File := lookForFiles(path, ["18.bmp", "17.bmp", "15.bmp"])
			ImageSearch, 20EBB_X, 20EBB_Y, 340, 370, 370, 400, 20C.png
				if(ErrorLevel=0)
					File := lookForFiles(path, ["20.bmp", "18.bmp", "17.bmp"])
			ImageSearch, 21EBB_X, 21EBB_Y, 340, 370, 370, 400, 21C.png
				if(ErrorLevel=0)
					File := lookForFiles(path, ["21.bmp", "20.bmp", "18.bmp", "17.bmp"])				
			ImageSearch, 22EBB_X, 22EBB_Y, 340, 370, 370, 400, 22C.png
				if(ErrorLevel=0)
					File := lookForFiles(path, ["21.bmp", "20.bmp", "18.bmp", "17.bmp"])	
			ImageSearch, 23EBB_X, 23EBB_Y, 340, 370, 370, 400, 23C.png
				if(ErrorLevel=0)
					File := lookForFiles(path, ["21.bmp", "20.bmp", "18.bmp", "17.bmp"])	
			ImageSearch, 24EBB_X, 24EBB_Y, 340, 370, 370, 400, 24C.png
				if(ErrorLevel=0)
					File := lookForFiles(path, ["21.bmp", "20.bmp", "18.bmp", "17.bmp"])	
			ImageSearch, 25EBB_X, 25EBB_Y, 340, 370, 370, 400, 25C.png
				if(ErrorLevel=0)
					File := lookForFiles(path, ["25.bmp", "21.bmp", "20.bmp", "18.bmp", "17.bmp"])	
			ImageSearch, 26EBB_X, 26EBB_Y, 340, 370, 370, 400, 26C.png
				if(ErrorLevel=0)
					File := lookForFiles(path, ["25.bmp", "21.bmp", "20.bmp", "18.bmp", "17.bmp"])	
			ImageSearch, 27EBB_X, 27EBB_Y, 340, 370, 370, 400, 27C.png
				if(ErrorLevel=0)
					File := lookForFiles(path, ["25.bmp", "21.bmp", "20.bmp", "18.bmp", "17.bmp"])	
			ImageSearch, 28EBB_X, 28EBB_Y, 340, 370, 370, 400, 28C.png
				if(ErrorLevel=0)
					File := lookForFiles(path, ["25.bmp", "21.bmp", "20.bmp", "18.bmp", "17.bmp"])	
			ImageSearch, 29EBB_X, 29EBB_Y, 340, 370, 370, 400, 29C.png
				if(ErrorLevel=0)
					File := lookForFiles(path, ["25.bmp", "21.bmp", "20.bmp", "18.bmp", "17.bmp"])	
			ImageSearch, 30EBB_X, 30EBB_Y, 340, 370, 370, 400, 30C.png
				if(ErrorLevel=0)
					File := lookForFiles(path, ["25.bmp", "21.bmp", "20.bmp", "18.bmp", "17.bmp"])	
			ImageSearch, 31EBB_X, 31EBB_Y, 340, 370, 370, 400, 31C.png
				if(ErrorLevel=0)
					File := lookForFiles(path, ["25.bmp", "21.bmp", "20.bmp", "18.bmp", "17.bmp"])	
			ImageSearch, 32BB_X, 32EBB_Y, 340, 370, 370, 400, 32C.png
				if(ErrorLevel=0)
					File := lookForFiles(path, ["25.bmp", "21.bmp", "20.bmp", "18.bmp", "17.bmp"])	
			ImageSearch, 33EBB_X, 33EBB_Y, 340, 370, 370, 400, 33C.png
				if(ErrorLevel=0)
					File := lookForFiles(path, ["25.bmp", "21.bmp", "20.bmp", "18.bmp", "17.bmp"])	
			ImageSearch, 34EBB_X, 34EBB_Y, 340, 370, 370, 400, 34C.png
				if(ErrorLevel=0)
					File := lookForFiles(path, ["25.bmp", "21.bmp", "20.bmp", "18.bmp", "17.bmp"])	
			ImageSearch, 35EBB_X, 35EBB_Y, 340, 370, 370, 400, 35C.png
				if(ErrorLevel=0)
					File := lookForFiles(path, ["25.bmp", "21.bmp", "20.bmp", "18.bmp", "17.bmp"])	

		}

			Run, %Path%%File%
SirRFI
Posts: 404
Joined: 25 Nov 2015, 16:52

Re: Passing a number through as a literal string

03 Jun 2018, 10:53

The MsgBox line was only for presentation of how this function works. You don't need it in your actual script.
If you look at it - it checks if file or folder iBetYouDontHaveSuchFileOrFolder exists in C:\Windows, if it doesn't - tries next file in array, which is notepad.exe. This file actually exists (or should exist) in your C:\Windows, therefore it returns the file name - just as you requested. If it didn't exist either, you would get a notification that none of the files from array exist, while you said at least one always exists. In other words, the error thrown would show that apparently your statement about always having at least one file isn't valid after all, so you need to do something to make it valid.

So, did you solve your issue in the end? Just to be sure.

Ps. There are plenty of things you can do to the current code to make it shorter and easier to manage, assuming you are interested.
Use

Code: Select all

[/c] forum tag to share your code.
Click on [b]✔[/b] ([b][i]Accept this answer[/i][/b]) on top-right part of the post if it has answered your question / solved your problem.
5nwYHrhNRY
Posts: 10
Joined: 01 May 2018, 07:18

Re: Passing a number through as a literal string

03 Jun 2018, 11:43

Code: Select all

lookForFiles(path, files) ; path must be string, files must be array
		{
			if (!IsObject(files))
				throw Exception("Provided file list is not an array!")
			for id, file_name in files
			{
				if (FileExist(path file_name) != "")
					return file_name
			}
I don't really know what is going on here at all. What is lookForFiles? What is path (is this a reference to my variable?)
SirRFI
Posts: 404
Joined: 25 Nov 2015, 16:52

Re: Passing a number through as a literal string

03 Jun 2018, 14:31

5nwYHrhNRY wrote:I don't really know what is going on here at all. What is lookForFiles? What is path (is this a reference to my variable?)
lookForFiles is how I called this custom function.

path and files is how I called function's arguments (variables that exist only within the function, and contain contents that were passed on function's call; they do not collide with other variables outside the function even if named the same). Since you pass your path to the function every time you call it - the function uses it for it's own purposes.

Code: Select all

if (!IsObject(files))
	throw Exception("Provided file list is not an array!")
This part check if files variable is in valid format - an array or object more precisely. If I didn't do the checking and you provided something formatted differently, the function wouldn't work properly without even letting you know. Instead, you get an error informing you about this.

Code: Select all

for id, file_name in files
{
	if (FileExist(path file_name) != "")
		return file_name
}
This part on other hand, goes through every element (for-loop) of the array (list of images in this case) and checks if the file exist (FileExist) - if it does, it returns (gives back to the place it was used in) name of the file.

Lastly, when the function went through all files and haven't found an existing file (which you claimed should never happen) - an error is displayed.

Code: Select all

throw Exception("Neither of provided files exist in: " path, -1)
Use

Code: Select all

[/c] forum tag to share your code.
Click on [b]✔[/b] ([b][i]Accept this answer[/i][/b]) on top-right part of the post if it has answered your question / solved your problem.
5nwYHrhNRY
Posts: 10
Joined: 01 May 2018, 07:18

Re: Passing a number through as a literal string

03 Jun 2018, 17:05

SirRFI wrote:

Code: Select all

for id, file_name in files
{
	if (FileExist(path file_name) != "")
		return file_name
}
This part on other hand, goes through every element (for-loop) of the array (list of images in this case) and checks if the file exist (FileExist) - if it does, it returns (gives back to the place it was used in) name of the file.
I'm sorry still confused, but appreciate you replying. If it's checking to see if the file exists then shouldn't it be if (FileExist(path file_name) == "")? And where is it returning the value to? The function itself? Is that why in our code File := lookForFiles(path, ["00.bmp" etc.])?
SirRFI
Posts: 404
Joined: 25 Nov 2015, 16:52

Re: Passing a number through as a literal string

03 Jun 2018, 17:32

5nwYHrhNRY wrote:f it's checking to see if the file exists then shouldn't it be if (FileExist(path file_name) == "")?
See FileExist - quote from the docs:
This function returns the attribute string of the first matching file or folder ... If the file has no attributes (rare), "X" is returned. If no file is found, an empty string is returned.
That said, if file does not exist - empty string is returned. As result, your expression would achieve the exact opposite - return file name of a file that does not exist.

5nwYHrhNRY wrote:And where is it returning the value to? The function itself? Is that why in our code File := lookForFiles(path, ["00.bmp" etc.])?
No and yes. The function is the part of code explained in previous post. It does not return something to itself - it's like telling yourself something you already know. It's returning the result to the place it was used in, aka the line you just mentioned. You assign the returned value from function lookForFiles to variable File.

Maybe this funny example helps (pseudo code):
Say you are a client of a restaurant or something. It's your turn to order. You say what you want to eat and pay: your_food := orderFood("hamburger", 20).
Now it's their job to say if they are selling hamburgers and check if the amount of money if enough to progress. Too least - ask for more (throw error, do not progress), too much - return rest of the money and start the order.
Past this point the order is passed to kitchen, while you just wait till it's ready. Possible outcomes are: you get what you ordered (success), or you get told they ran out of ingredients and get your money back. They (the orderFood function) return the response to you (the your_food variable), which is either of the outcomes. As you can see, from your perspective you don't really care what's happening in the backend - only the result matters.

I suggest you read up the documentation.
Use

Code: Select all

[/c] forum tag to share your code.
Click on [b]✔[/b] ([b][i]Accept this answer[/i][/b]) on top-right part of the post if it has answered your question / solved your problem.
5nwYHrhNRY
Posts: 10
Joined: 01 May 2018, 07:18

Re: Passing a number through as a literal string

03 Jun 2018, 18:45

It is working now! Thank you very much for your explanations and code it was very helpful.
Ps. There are plenty of things you can do to the current code to make it shorter and easier to manage, assuming you are interested.
Yes please what would you do differently?
SirRFI
Posts: 404
Joined: 25 Nov 2015, 16:52

Re: Passing a number through as a literal string

05 Jun 2018, 14:32

5nwYHrhNRY wrote:
Ps. There are plenty of things you can do to the current code to make it shorter and easier to manage, assuming you are interested.
Yes please what would you do differently?
I wanted to say plenty, but actually there just few things, since most of the code is somewhat repeated and can be shortened.

Let's start with simple things, step at a time. I noticed many variables are related to each other, such as following:

Code: Select all

Target_Color_R_FLDa := "0xFF00FF"
Target_Color_L_FLDa := "0xFF00FF"
; ...
L_FLDa_X := 334
L_FLDa_Y := 105
; ...
R_FLDa_X := 538
R_FLDa_Y := 109
These 6 variables could be merged onto one. How? Somewhat similarly to the custom function described before, where list of files had to be an array. That one is known as indexed, numbered or ordered array.
In this case we would use thing known as associated array, also known as object, which has similar functionality. There are various ways to do this, so I picked one I think will fit your case:

Code: Select all

FLDa :=
(Join QC
{
	"color":
	{
		"left": 0xFF00FF,
		"right": 0xFF00FF
	},
	"coords":
	{
		"left": {"X": 334, "Y": 105},
		"right": {"X": 538, "Y": 109}
	}
}
)
Isn't that a lot more readable? Everything related to FLDa is in one place. You can think of it as a variable which contains more variables inside. Here's how to use it: MsgBox % FLDa.coords.left.X

You may not see the advantages of this approach right now, other than readability. Remember how our function checked each image file one after another? Imagine if you could do that here as well, instead of having a wall of PixelSearch and ifs.

Let me know when you are ready for next step. You'll have to explain me why do you PixelGetColor from same X and Y few times, to different output variable.
Use

Code: Select all

[/c] forum tag to share your code.
Click on [b]✔[/b] ([b][i]Accept this answer[/i][/b]) on top-right part of the post if it has answered your question / solved your problem.
swagfag
Posts: 3273
Joined: 11 Jan 2017, 17:59

Re: Passing a number through as a literal string

05 Jun 2018, 15:53

what is spaceQ in:

Code: Select all

...
(Join QC
...
supposed to be?

Return to “Ask For Help”

Who is online

Users browsing this forum: Bing [Bot], cadudesun, flyingDman, Kobaltauge, Rohwedder and 245 guests