Jump to content

If $iniread[2][1] = 'True' and $iniread[3][1] = 'True' Then


chie
 Share

Recommended Posts

The problem is that as far as I see it should be all correct but its not working, I wonder Why? I have exactly same code that works perfect, but I would like to use the code 1, so i can read info from inifile.

To start press ALT+1

To pause press pause/Break on your keyboard

To see the problem start script & pause at time to time ,check other checkbox, & make untitled window active again.

Code 1. Not working

Func startclick()
    Run("Notepad.exe")
while 1
    winWaitActive("Untitled") 
    If $iniread[2][1] = 'True' and $iniread[3][1] = 'True' Then
    send("Right_")
    Sleep(GUICtrlRead($Clickspeed_Input))
    send("Left_")
    Elseif $iniread[2][1] = 'True' Then ; If Right_Click=True
        send("Right_")  
    ElseIf $iniread[3][1] = 'True' Then ; If Left_Click=True
        send("Left_")
    EndIf
        Sleep(GUICtrlRead($Clickspeed_Input))
WEnd
EndFuncoÝ÷ Ø*{e¨®H§«­¢+ÙÕ¹ÍÑÉѱ¥¬ ¤(%IÕ¸ ÅÕ½Ðí9½ÑÁ¹áÅÕ½Ðì¤)Ý¡¥±È(%Ý¥¹]¥ÑÑ¥Ù ÅÕ½ÐíU¹Ñ¥Ñ±ÅÕ½Ðì¤(%%U%
ÑɱI ÀÌØí1Ñ}
±¥­}¡­½à¤ôÀÌØíU%}
!
-¹U%
ÑɱI ÀÌØíI¥¡Ñ}
±¥­}¡­½à¤ôÀÌØíU%}
!
-Q¡¸(%͹ ÅÕ½ÐíI¥¡Ñ|ÅÕ½Ðì¤(%M±À¡U%
ÑɱI ÀÌØí
±¥­ÍÁ}%¹ÁÕФ¤(%͹ ÅÕ½Ðí1Ñ|ÅÕ½Ðì¤(%±Í%U%
ÑɱI ÀÌØíI¥¡Ñ}
±¥­}¡­½à¤ôÀÌØíU%}
!
-Q¡¸ì%
¡­½à¥ÌͱѵÀìÁÉÍÌ1P¬9ÕµÁÍÕ($%͹ ÅÕ½ÐíI¥¡Ñ|ÅÕ½Ðì¤(%±Í%U%
ÑɱI ÀÌØí1Ñ}
±¥­}¡­½à¤ôÀÌØíU%}
!
-Q¡¸ì%
¡­½à¥ÌͱѵÀìÁÉÍÌ1P¬9ÕµÁÍÕ($%͹ ÅÕ½Ðí1Ñ|ÅÕ½Ðì¤(%¹%(%M±À¡U%
ÑɱI ÀÌØí
±¥­ÍÁ}%¹ÁÕФ¤ìЭ±¥­ÍÁɽ´¥¹¥¥±)]¹)¹Õ¹oÝ÷ ØU,#«­¢+Ø¥¹±Õ±ÐíÕ¥
½¹ÍѹÑ̹ÔÌÐì)=ÁÐ ÅÕ½Ðí]¥¹Q¥Ñ±5Ñ¡5½ÅÕ½Ðì°È¤ìÕ͹äÁÉнѡݥ¹½Ü¹µ)±½°ÀÌØí±¥­ÍÁ}Ù±Õ}¹È°ÀÌØí¥¹¥É°ÀÌØíAÕÍ°ÀÌØí±¥­É}½ÁÑ}Ý¥¹½Ü()!½Ñ­åMÐ ÅÕ½ÐìÌÌìÄÅÕ½Ðì°ÅÕ½ÐíÍÑÉѱ¥¬ÅÕ½Ðì¤)!½Ñ-åMÐ ÅÕ½ÐííAUMôÅÕ½Ðì°ÅÕ½ÐíQ½±AÕÍÅÕ½Ðì¤()Õ¹Q½±AÕÍ ¤(ÀÌØíAÕÍô9=PÀÌØíAÕÍ(]¡¥±ÀÌØíAÕÍ(íøá¥Ð½¸ÀÌØíU%}Y9Q}
1=MÝ¡¥±AÕÍ(íø´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´($ÀÌØíµÍôU%Ñ5Í ¤(M±Ð(%
ÍÀÌØíµÍôÀÌØíU%}Y9Q}
1=M($ÀÌØí!ݹô]¥¹Ñ!¹± ÌäìÌäì¤($$$(%%ÀÌØí!ݹôÀÌØí±¥­É}½ÁÑ}Ý¥¹½ÜQ¡¸ì%±½ÍÍÉ ½ÁÑ¥½¹ÌÝ¥¹½Ü(%á¥Ð)¹%$$)¹M±Ð(íø¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨)ͱÀ ÄÀÀ¤(Q½½±Q¥À ÌäíMÉ¥ÁÐ¥ÌÅÕ½ÐíAÕÍÅÕ½ÐìÌäì°À°À¤(]¹(Q½½±Q¥À ÅÕ½ÐìÅÕ½Ðì¤)¹Õ¹((íø
ÉÑ¥¹¤¥¹½Ðá¥ÍеÀìÍÐ¥¹¥ÉÙ±ÕÌ(íø´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´)%9½Ð¥±á¥ÍÑÌ ÅÕ½ÐíèÀäÈíµå¥±¹¥¹¤ÅÕ½Ðì¤Q¡¸)%¹¥]É¥Ñ ÅÕ½ÐíèÀäÈíµå¥±¹¥¹¤ÅÕ½Ðì°ÅÕ½Ðí±¥­É}¥¹¼ÅÕ½Ðì°ÅÕ½ÐíÍÁÅÕ½Ðì°ÅÕ½ÐìÄÀÀÀÅÕ½Ðì¤)%¹¥]É¥Ñ ÅÕ½ÐíèÀäÈíµå¥±¹¥¹¤ÅÕ½Ðì°ÅÕ½Ðí±¥­É}¥¹¼ÅÕ½Ðì°ÅÕ½ÐíI¥¡Ñ}
±¥¬ÅÕ½Ðì°ÅÕ½ÐíQÉÕÅÕ½Ðì¤)%¹¥]É¥Ñ ÅÕ½ÐíèÀäÈíµå¥±¹¥¹¤ÅÕ½Ðì°ÅÕ½Ðí±¥­É}¥¹¼ÅÕ½Ðì°ÅÕ½Ðí1Ñ}
±¥¬ÅÕ½Ðì°ÅÕ½Ðí1MÅÕ½Ðì¤)¹%(ÀÌØí¥¹¥Éô%¹¥IMÑ¥½¸ ÅÕ½ÐíèÀäÈíµå¥±¹¥¹¤ÅÕ½Ðì°ÅÕ½Ðí±¥­É}¥¹¼ÅÕ½Ðì¤(ÀÌØí¥¹¥É}ÍÁô%¹¥I ÅÕ½ÐíèÀäÈíµå¥±¹¥¹¤ÅÕ½Ðì°ÅÕ½Ðí±¥­É}¥¹¼ÅÕ½Ðì°ÅÕ½ÐíÍÁÅÕ½Ðì°ÅÕ½Ðí9½Ð½Õ¹ÅÕ½Ðì¤((íøÕѽ±¥­ÈU$(íø´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´(ÀÌØí±¥­É}½ÁÑ}Ý¥¹½ÜôU%
ÉÑ ÅÕ½ÐíÕѽ±¥­È=ÁÑ¥½¹ÌÅÕ½Ðì°ÌÀÀ°ÄÀÔ¤)U%
Ñɱ
ÉÑ1° ÅÕ½Ðí
±¥­ÍÁ°ÄÀÀÀôÄÍèÅÕ½Ðì°Ô°ÄĤ$$$$$$ì$%1°UÍɹµ(ÀÌØí
±¥­ÍÁ}%¹ÁÕÐôU%
Ñɱ
ÉÑ%¹ÁÕÐ ÀÌØí¥¹¥É}ÍÁ°ÄÌÔ°ÄÀ°àÀ°ÈÀ¤í%¹ÁÕÐUÍɹµ(ÀÌØíÍÙ}
±¥­É}¥¹½}ÕÑѽ¸ôU%
Ñɱ
ÉÑ    ÕÑѽ¸ ÅÕ½ÐíMÙÅÕ½Ðì°ÄÈÀ°ÜÀ°ØÀ°ÈÌ¤í    ÕÑѽ¸=,¡±Ð°Ñ½À°Ý¥Ñ °¡¥¡Ð¤((ÀÌØíI¥¡Ñ}
±¥­}¡­½àôU%
Ñɱ
ÉÑ
¡­½à ÅÕ½ÐíI¥¡Ñ}±¥¬ÅÕ½Ðì°ÄÀ°ÌÔ¤(%¥ÀÌØí¥¹¥ÉlÉulÅtôÌäíQÉÕÌäìQ¡¸ì¥I¥¡Ñ}
±¥¬ôQÉÕ($%Õ¥
ÑɱMÑMÑÑ ´Ä°ÀÌØíU%}
!
-¤(%±Í($%Õ¥
ÑɱMÑMÑÑ ´Ä°ÀÌØíU%}U9
!
-¤(%¹%(ÀÌØí1Ñ}
±¥­}¡­½àôU%
Ñɱ
ÉÑ
¡­½à ÅÕ½Ðí1Ñ}±¥¬ÅÕ½Ðì°ÄÀ°ØÔ¤(%¥ÀÌØí¥¹¥ÉlÍulÅtôÌäíQÉÕÌäìQ¡¸$ì¥1Ñ}
±¥¬ôQÉÕ($%Õ¥
ÑɱMÑMÑÑ ´Ä°ÀÌØíU%}
!
-¤(%±Í($%Õ¥
ÑɱMÑMÑÑ ´Ä°ÀÌØíU%}U9
!
-¤(%¹%)U%MÑMÑÑ¡M]}M!=¤()]¡¥±Ä(ÀÌØíµÍôU%Ñ5Í ¤(M±Ð(
ÍÀÌØíµÍôÀÌØíU%}Y9Q}
1=M(ÀÌØí!ݹô]¥¹Ñ!¹± ÌäìÌäì¤($$$(%ÀÌØí!ݹôÀÌØí±¥­É}½ÁÑ}Ý¥¹½ÜQ¡¸ì%±½ÍÍÉ ½ÁÑ¥½¹ÌÝ¥¹½Ü(íøU%MÑMÑÑ¡M]}!%°ÀÌØí±¥­É}½ÁÑ}Ý¥¹½Ü¤ì!¥¥Ð($$$$á¥Ð($$$¹%(íøMÙ¥¹­±¥­È=ÁÑ¥½¹Ì¥MÙ¥ÌÁÉÍÍ(íø´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´($%ÍÀÌØíµÍôÀÌØíÍÙ}
±¥­É}¥¹½}ÕÑѽ¸($%%¹¥]É¥Ñ ÅÕ½ÐíèÀäÈíµå¥±¹¥¹¤ÅÕ½Ðì°ÅÕ½Ðí±¥­É}¥¹¼ÅÕ½Ðì°ÅÕ½ÐíÍÁÅÕ½Ðì°U%
ÑɱI ÀÌØí
±¥­ÍÁ}%¹ÁÕФ¤($%%U%
ÑɱI ÀÌØíI¥¡Ñ}
±¥­}¡­½à¤ôÀÌØíU%}
!
-Q¡¸($$%%¹¥]É¥Ñ ÅÕ½ÐíèÀäÈíµå¥±¹¥¹¤ÅÕ½Ðì°ÅÕ½Ðí±¥­É}¥¹¼ÅÕ½Ðì°ÅÕ½ÐíI¥¡Ñ}
±¥¬ÅÕ½Ðì°ÅÕ½ÐíQÉÕÅÕ½Ðì¤$($%±Í%U%
ÑɱI ÀÌØíI¥¡Ñ}
±¥­}¡­½à¤ôÀÌØíU%}U9
!
-Q¡¸($$%%¹¥]É¥Ñ ÅÕ½ÐíèÀäÈíµå¥±¹¥¹¤ÅÕ½Ðì°ÅÕ½Ðí±¥­É}¥¹¼ÅÕ½Ðì°ÅÕ½ÐíI¥¡Ñ}
±¥¬ÅÕ½Ðì°ÅÕ½Ðí1MÅÕ½Ðì¤($%¹%$($%%U%
ÑɱI ÀÌØí1Ñ}
±¥­}¡­½à¤ôÀÌØíU%}
!
-Q¡¸($$%%¹¥]É¥Ñ ÅÕ½ÐíèÀäÈíµå¥±¹¥¹¤ÅÕ½Ðì°ÅÕ½Ðí±¥­É}¥¹¼ÅÕ½Ðì°ÅÕ½Ðí1Ñ}
±¥¬ÅÕ½Ðì°ÅÕ½ÐíQÉÕÅÕ½Ðì¤$($%±Í%U%
ÑɱI ÀÌØí1Ñ}
±¥­}¡­½à¤ôÀÌØíU%}U9
!
-Q¡¸($$%%¹¥]É¥Ñ ÅÕ½ÐíèÀäÈíµå¥±¹¥¹¤ÅÕ½Ðì°ÅÕ½Ðí±¥­É}¥¹¼ÅÕ½Ðì°ÅÕ½Ðí1Ñ}
±¥¬ÅÕ½Ðì°ÅÕ½Ðí1MÅÕ½Ðì¤($%¹%($%%U%
ÑɱI ÀÌØí1Ñ}
±¥­}¡­½à¤ôÀÌØíU%}
!
-¹U%
ÑɱI ÀÌØíI¥¡Ñ}
±¥­}¡­½à¤ôÀÌØíU%}
!
-Q¡¸($$%%¹¥]É¥Ñ ÅÕ½ÐíèÀäÈíµå¥±¹¥¹¤ÅÕ½Ðì°ÅÕ½Ðí±¥­É}¥¹¼ÅÕ½Ðì°ÅÕ½ÐíI¥¡Ñ}
±¥¬ÅÕ½Ðì°ÅÕ½ÐíQÉÕÅÕ½Ðì¤$($$%%¹¥]É¥Ñ ÅÕ½ÐíèÀäÈíµå¥±¹¥¹¤ÅÕ½Ðì°ÅÕ½Ðí±¥­É}¥¹¼ÅÕ½Ðì°ÅÕ½Ðí1Ñ}
±¥¬ÅÕ½Ðì°ÅÕ½ÐíQÉÕÅÕ½Ðì¤$$($%±Í%U%
ÑɱI ÀÌØí1Ñ}
±¥­}¡­½à¤ôÀÌØíU%}U9
!
-¹U%
ÑɱI ÀÌØíI¥¡Ñ}
±¥­}¡­½à¤ôÀÌØíU%}U9
!
-Q¡¸($$%%¹¥]É¥Ñ ÅÕ½ÐíèÀäÈíµå¥±¹¥¹¤ÅÕ½Ðì°ÅÕ½Ðí±¥­É}¥¹¼ÅÕ½Ðì°ÅÕ½ÐíI¥¡Ñ}
±¥¬ÅÕ½Ðì°ÅÕ½Ðí1MÅÕ½Ðì¤$($$%%¹¥]É¥Ñ ÅÕ½ÐíèÀäÈíµå¥±¹¥¹¤ÅÕ½Ðì°ÅÕ½Ðí±¥­É}¥¹¼ÅÕ½Ðì°ÅÕ½Ðí1Ñ}
±¥¬ÅÕ½Ðì°ÅÕ½Ðí1MÅÕ½Ðì¤$($%¹%($%5Í ½à À°ÅÕ½ÐìÅÕ½Ðì°ÅÕ½ÐíÑÍÙÅÕ½Ðì¤(¹M±Ð)]¹($(íøì¥å½ÔÁÉÍÌ1P¬Ä(íø´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´(íø´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´(íø´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´(íøÕ¹ÍÑÉѱ¥¬ ¤(íø%IÕ¸ ÅÕ½Ðí9½ÑÁ¹áÅÕ½Ðì¤(íøÝ¡¥±È(íø%Ý¥¹]¥ÑÑ¥Ù ÅÕ½ÐíU¹Ñ¥Ñ±ÅÕ½Ðì¤(íø%%U%
ÑɱI ÀÌØí1Ñ}
±¥­}¡­½à¤ôÀÌØíU%}
!
-¹U%
ÑɱI ÀÌØíI¥¡Ñ}
±¥­}¡­½à¤ôÀÌØíU%}
!
-Q¡¸(íø%͹ ÅÕ½ÐíI¥¡Ñ|ÅÕ½Ðì¤(íø%M±À¡U%
ÑɱI ÀÌØí
±¥­ÍÁ}%¹ÁÕФ¤(íø%͹ ÅÕ½Ðí1Ñ|ÅÕ½Ðì¤(íø%±Í%U%
ÑɱI ÀÌØíI¥¡Ñ}
±¥­}¡­½à¤ôÀÌØíU%}
!
-Q¡¸ì%
¡­½à¥ÌͱѵÀìÁÉÍÌ1P¬9ÕµÁÍÕ(íø$%͹ ÅÕ½ÐíI¥¡Ñ|ÅÕ½Ðì¤(íø%±Í%U%
ÑɱI ÀÌØí1Ñ}
±¥­}¡­½à¤ôÀÌØíU%}
!
-Q¡¸ì%
¡­½à¥ÌͱѵÀìÁÉÍÌ1P¬9ÕµÁÍÕ(íø$%͹ ÅÕ½Ðí1Ñ|ÅÕ½Ðì¤(íø%¹%(íø%M±À¡U%
ÑɱI ÀÌØí
±¥­ÍÁ}%¹ÁÕФ¤ìЭ±¥­ÍÁɽ´¥¹¥¥±(íø]¹(íø¹Õ¹(íø´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´(íø´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´(íø´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´()Õ¹ÍÑÉѱ¥¬ ¤(%IÕ¸ ÅÕ½Ðí9½ÑÁ¹áÅÕ½Ðì¤)Ý¡¥±Ä(%Ý¥¹]¥ÑÑ¥Ù ÅÕ½ÐíU¹Ñ¥Ñ±ÅÕ½Ðì¤(%%ÀÌØí¥¹¥ÉlÉulÅtôÌäíQÉÕÌäì¹ÀÌØí¥¹¥ÉlÍulÅtôÌäíQÉÕÌäìQ¡¸(%͹ ÅÕ½ÐíI¥¡Ñ|ÅÕ½Ðì¤(%M±À¡U%
ÑɱI ÀÌØí
±¥­ÍÁ}%¹ÁÕФ¤(%͹ ÅÕ½Ðí1Ñ|ÅÕ½Ðì¤(%±Í¥ÀÌØí¥¹¥ÉlÉulÅtôÌäíQÉÕÌäìQ¡¸ì%I¥¡Ñ}
±¥¬õQÉÕ($%͹ ÅÕ½ÐíI¥¡Ñ|ÅÕ½Ðì¤$(%±Í%ÀÌØí¥¹¥ÉlÍulÅtôÌäíQÉÕÌäìQ¡¸ì%1Ñ}
±¥¬õQÉÕ($%͹ ÅÕ½Ðí1Ñ|ÅÕ½Ðì¤(%¹%($%M±À¡U%
ÑɱI ÀÌØí
±¥­ÍÁ}%¹ÁÕФ¤)]¹)¹Õ¹
Link to comment
Share on other sites

Well, one thing I can tell you right now and that's the stupidest way I've ever seen to load an INI file and check for known values. The order in which keys appear in an INI file is not static. I strongly suggest you use IniRead() to determine the values instead of trying to be clever and read them all at once but then never actually validate which key you are using the value of.

Link to comment
Share on other sites

Well, one thing I can tell you right now and that's the stupidest way I've ever seen to load an INI file and check for known values.

Well I read the Help file & searched for some examples in the forum & this is what you see above I came up to. Maybe you can point me in the right direction with 1 small example?

Lets say I have an Ini file, With this inside:

[Login info]
Username=value1oÝ÷ Ø¥²Z½è§¦ë[£®¶­sbb33c¶æ&VE÷W6W&æÖRÒæ&VBgV÷C´3¢b3#¶×fÆRæægV÷C²ÂgV÷C´ÆövâæfògV÷C²ÂgV÷CµW6W&æÖRgV÷C²ÂgV÷C´æ÷Eôf÷VæBgV÷C²¢b33cµW6W&æÖUôçWBÒuT7G&Ä7&VFTçWBb33c¶æ&VE÷W6W&æÖRÂcÂÂÂ#

So how would you check if the value1 is present in the ini file & if present then display the value1 in the inputbox & if not present, simply leave the inputbox empty ?

Link to comment
Share on other sites

So how would you check if the value1 is present in the ini file & if present then display the value1 in the inputbox & if not present, simply leave the inputbox empty?

$iniread_username = IniRead("C:\myfile.ini", "Login info", "Username", "Not_Found")
$Username_Input = GUICtrlCreateInput($iniread_username, 60, 10, 80, 20)
if $iniread_username=="Not_Found" then Guictrlsetdata($Username_Input,"")

You could have just used "" instead of "Not_Found" unless you really needed "Not_Found" if key wasnt there.I havent read through all of your code.

edit: had code as quote and quote as code :whistle:

edit 2: Valik beat me to it

Edited by Cue
Link to comment
Share on other sites

I want my code to check if there is a value present & if yes the display it in inputbox & if not then leave inputbox empty, After I press a button & Before my GUI2 Will @SW_SHOW.

I also have already Tried both your suggestions already & it is not working as mather of a fact the code wont check for the value at all & result is that i have the value in my ini file but its not shown.

this is the code piece im using this:

Case $msg = $Pass_options_Item      
$iniread_username = IniRead("C:\myfile.ini", "Login info", "Username", "") 
$Username_Input = GUICtrlCreateInput($iniread_username, 60, 10, 80, 20)
GUISetState(@SW_SHOW, $Window_aotologin_options)oÝ÷ Ù«­¢+Ù
ÍÀÌØíµÍôÀÌØíAÍÍ}½ÁÑ¥½¹Í}%Ñ´$$(ÀÌØí¥¹¥É}ÕÍɹµô%¹¥I ÅÕ½ÐíèÀäÈíµå¥±¹¥¹¤ÅÕ½Ðì°ÅÕ½Ðí1½¥¸¥¹¼ÅÕ½Ðì°ÅÕ½ÐíUÍɹµÅÕ½Ðì°ÅÕ½Ðí9½Ñ}½Õ¹ÅÕ½Ðì¤)¥ÀÌØí¥¹¥É}ÕÍɹµôôÅÕ½Ðí9½Ñ}½Õ¹ÅÕ½ÐìÑ¡¸Õ¥ÑɱÍÑÑ ÀÌØíUÍɹµ}%¹ÁÕаÅÕ½ÐìÅÕ½Ðì¤)U%MÑMÑÑ¡M]}M!=°ÀÌØí]¥¹½Ý}½Ñ½±½¥¹}½ÁÑ¥½¹Ì¤
Edited by chie
Link to comment
Share on other sites

BUMP* I thought I should make 1 small example to show you that the check is not performed When Show Gui2 button is pressed: Just run the code, pess the button, enter value1 & SAVE, restart GUI & as you say the vaule should be there...well its not....

#include <GuiConstants.au3>
Opt("WinTitleMatchMode", 2) ; use any part of the window name

Global $iniread_user

;~ MAin Window
;~ -----------------------------------------------------------------------------------------
$mainwindow = GUICreate("Rater", 300, 100)
$OK = GUICtrlCreateButton("Show GUI2", 120, 50, 60, 23)   ;Button OK (left, top , width , height )
GUISetState(@SW_SHOW)
;~ ***************************************************************************************

;~ Autologin GUI2
;~ -----------------------------------------------------------------------------------------
$Window_aotologin_options = GUICreate("AutoLogin Options", 300, 105) ; GUI2 Window_aotologin_options
$Username_Input = GUICtrlCreateInput($iniread_user, 60, 10, 80, 20) ;Input Username
GUICtrlCreateLabel ("Username",5,11)                        ;       Label Username

$save_user_and_pass__button = GUICtrlCreateButton("Save", 120, 70, 60, 23)   
$delete_user_and_pass__button = GUICtrlCreateButton("Delete", 190, 70, 60, 23)   
GUISetState(@SW_HIDE)
;~ ***************************************************************************************

While 1
    $msg = GUIGetMsg()
 Select
     
     
;~ ***************************************************************************************
;~ ***************************************************************************************
;~ ***************************************************************************************
;~ ;Shouw GUI2 & 3 & REad user & pass from saved Ini file if file exist

        Case $msg = $OK     
            $iniread_user = IniRead("C:\myfile.ini", "Login info", "Username", "")  ;Check is not performed !!!
            GUISetState(@SW_SHOW, $Window_aotologin_options)
            
;~ ***************************************************************************************
;~ ***************************************************************************************
;~ ***************************************************************************************


;~  Will close 1 active GUI Window 
;~ -----------------------------------------------------------------------------------------
        Case $msg = $GUI_EVENT_CLOSE
             $Hwnd = WinGetHandle('')
        If $Hwnd = $mainwindow Then
            Exit
        ElseIf $Hwnd = $Window_aotologin_options Then
            GUISetState(@SW_HIDE,$Window_aotologin_options) 
    EndIf
            
;~ Save username
;~ -----------------------------------------------------------------------------------------
        Case $msg = $save_user_and_pass__button
            IniWrite("C:\myfile.ini", "Login info", "Username", GUICtrlRead($Username_Input))
                GUISetState(@SW_HIDE,$Window_aotologin_options) ; Hide it
                MsgBox(4096, "Result", "Data saved!",1)
                GUISetState(@SW_SHOW, $mainwindow)
                GUISetState(@SW_restore,$mainwindow)
            
;~ Deletes USername
;~ -----------------------------------------------------------------------------------------
        case  $msg = $delete_user_and_pass__button
                IniDelete("C:\myfile.ini", "Login info", "Username")
                MsgBox(4096, "Result", "Data deleted!",1)
                GUISetState(@SW_HIDE,$Window_aotologin_options) ; Hide it
                GUISetState(@SW_SHOW, $mainwindow)
                GUISetState(@SW_restore,$mainwindow)
;~ ***************************************************************************************
    EndSelect
WEnd
Link to comment
Share on other sites

YEs this actyally works for 75% now but do you have any clue why if i press delete button & check the ini file & yes username was deleted but if i @SW_SHOW the GUI2 then the inputbox is not updated, there is still the old data inside.

this is interesting What this means? <> i know there are more signs like this but i dont see them anywhere written in the helpfile or documentation, is there any place(LINK?) I can see the meaning of theese?

Edited by chie
Link to comment
Share on other sites

75% :whistle: ..., the input does not update in the same execution as you never update the control with GuiCtrlSetData to change the stored value.

case  $msg = $delete_user_and_pass__button
                If IniDelete("C:\myfile.ini", "Login info", "Username") Then
                    GUICtrlSetData($Username_Input, '')
                    MsgBox(4096, "Result", "Data deleted!", 1)
                EndIf
                GUISetState(@SW_HIDE, $Window_aotologin_options) ; Hide it
                GUISetState(@SW_SHOW, $mainwindow)
                GUISetState(@SW_restore, $mainwindow)

<> tests if 2 values are not equal. <> is the opposite of =. Look at the Helpfile under Language Reference -> Operators to see more.

Link to comment
Share on other sites

75% :whistle: ..., the input does not update in the same execution as you never update the control with GuiCtrlSetData to change the stored value.

<> tests if 2 values are not equal. <> is the opposite of =. Look at the Helpfile under Language Reference -> Operators to see more.

This is exactly the answer I was looking for(just unbelivable how simple this is.). Thank you, Though I never knew you chould make code do an action by only "If iniread... then do someting".

And just in case someone wont be able to understand the complicated way then this can also be done like this.

This How you can update info in your GUI window just in case so others wont have to search mutch

SOLUTION:

$Username_Input = GUICtrlCreateInput($iniread_user, 60, 10, 80, 20) ;Input Username inputbox
$Pass_Input = GUICtrlCreateInput($iniread_pass, 60, 34, 80, 20)     ;Imput Pass inputbox

Case $msg = $Show_GUI2_Window
            $iniread_user = IniRead("C:\myfile.ini", "Login info", "Username", "") 
            $iniread_pass = IniRead("C:\myfile.ini", "Login info", "Password", "") 
            If $iniread_user Then GUICtrlSetData($Username_Input, $iniread_user)
            If $iniread_user Then GUICtrlSetData($Pass_Input, $iniread_pass)
           GUISetState(@SW_SHOW, $GUi2)
           
Case $msg = $save_user_and_pass__button
            IniWrite("C:\myfile.ini", "Login info", "Username", GUICtrlRead($Username_Input))
            IniWrite("C:\myfile.ini", "Login info", "Password", GUICtrlRead($Pass_Input))
            
case  $msg = $delete_user_and_pass__button
            If IniDelete("C:\myfile.ini", "Login info", "Username") Then GUICtrlSetData($Username_Input, '')
            If IniDelete("C:\myfile.ini", "Login info", "Password") Then GUICtrlSetData($Pass_Input, '')
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...