Sign in to follow this  
Followers 0
Marius

hmz...

12 posts in this topic

#1 ·  Posted (edited)

$skaicius = ""

$eee = 0

If $msg = $button Then

$eee = $eee + 5

If $eee<10 Then

$skaicius = "00" & GUICtrlRead($eee)

If $eee<100 Then

$skaicius = "0" & GUICtrlRead($eee)

If $eee<1000 Then

$skaicius = GUICtrlRead($eee)

EndIf

EndIf

EndIf

EndIf

Doesn't work. $skaicius always shows 0 Where's my mistake?

Edited by Marius

Marius back in da hood! :)

Share this post


Link to post
Share on other sites



$skaicius = ""

$eee = 0

If $msg = $button Then

$eee = $eee + 5

If $eee<10 Then

$skaicius = "00" & GUICtrlRead($eee)

If $eee<100 Then

$skaicius = "0" & GUICtrlRead($eee)

If $eee<1000 Then

$skaicius = GUICtrlRead($eee)

EndIf

EndIf

EndIf

EndIf

Doesn't work.  $skaicius always shows 0  Where's my mistake?

<{POST_SNAPBACK}>

:) Maybe you want to explain what you want to accomplish because this piece of code doesn't make much sense to me ..

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Your both definetly Right,

makes no sense

and trying to use

GUICtrlRead($eee)???

But this person joined today (I helped Marius earlier), has 13 posts and really seems to be trying

good luck

Marius

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

Don't know if your reading an actual edit/input box in a GUI but this may help lead you in the right direction:

$skaicius = ""
$eee = 0
$read = GUICtrlRead($eee)
$msg = GUIGetMsg()
Select
   Case $msg = $button
      $eee = $eee + 5
      If $eee < 10 Then
         $skaicius = ("00" & $read)
         If $eee < 100 Then
            $skaicius = ("0" & $read)
            If $eee < 1000 Then
               $skaicius = $read
            EndIf
         EndIf
      EndIf
  EndSelect

Or if your trying to make it add the $read to the "00" only if the statement before wasn't true then maybe this will help:

$skaicius = ""
$eee = 0
$read = GUICtrlRead($eee)
$msg = GUIGetMsg()
Select
   Case $msg = $button
      $eee = $eee + 5
      If $eee < 10 Then
         $skaicius = ("00" & $read)
      ElseIf $eee < 100 Then
         $skaicius = ("0" & $read)
      Else
         $skaicius = $read
      EndIf
EndSelect

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Ok. Here's full code:

#include <GUIConstants.au3>

#Include <GuiList.au3>

FileDelete ("process.txt")

$parent = GUICreate("Silent Extractor v0.7", 800, 600) ; will create a dialog box that when displayed is centered

dim $additional[6]

$font = "Arial Black"

$font2 = "Arial"

$font3 = "Comic Sans MS"

$label1 = GUICtrlCreateLabel ("Welcome to Silent Extractor!",-1,50,800,60,$SS_CENTER)

GUICtrlSetFont ($label1, 30, -1, -1, $font)

$label1 = GUICtrlCreateLabel ("This program will help you to create auto installations of your favorite softvare in 4 easy steps!!!",-1,120,800,25,$SS_CENTER)

GUICtrlSetFont ($label1, 10, -1, -1, $font2)

$tab=GUICtrlCreateTab (130,160, 540,400)

;

;

;

;

;

GUICtrlCreateTabitem ("Step 1")

GUICtrlCreateGroup ("Choose Windows XP installation folder", 150, 200, 500, 60)

; group start

$edit1 = GUICtrlCreateEdit ( "", 160, 220, 380, 25, $ES_LEFT + $ES_AUTOHSCROLL)

GUICtrlSetFont ($edit1, 10, -1, -1, $font2)

$browse = GUICtrlCreateButton ( "Browse", 550, 220, 90, 25, $BS_VCENTER)

; group end

GUICtrlCreateGroup ("",-99,-99,1,1) ;close group

GUICtrlCreateGroup ("", 150, 270, 245, 270)

GUICtrlCreatePic("windows-vs-linux.jpg",155, 280, 235, 255)

GUICtrlCreateGroup ("",-99,-99,1,1) ;close group

GUICtrlCreateGroup ("Windows Info", 405, 270, 245, 270)

$info1 = GUICtrlCreateEdit ( "No directory selected!", 415, 294, 225, 25, $ES_LEFT)

GUICtrlSetFont ($info1, 10, -1, -1, $font2)

$info2 = GUICtrlCreateEdit ( "No directory selected!", 415, 335, 225, 25, $ES_LEFT)

GUICtrlSetFont ($info2, 10, -1, -1, $font2)

$info3 = GUICtrlCreateEdit ( "No directory selected!", 415, 376, 225, 25, $ES_LEFT)

GUICtrlSetFont ($info3, 10, -1, -1, $font2)

$info4 = GUICtrlCreateEdit ( "No directory selected!", 415, 417, 225, 25, $ES_LEFT)

GUICtrlSetFont ($info4, 10, -1, -1, $font2)

$info5 = GUICtrlCreateEdit ( "No directory selected!", 415, 458, 225, 25, $ES_LEFT)

GUICtrlSetFont ($info5, 10, -1, -1, $font2)

$info6 = GUICtrlCreateEdit ( "No directory selected!", 415, 499, 225, 25, $ES_LEFT)

GUICtrlSetFont ($info6, 10, -1, -1, $font2)

GUICtrlCreateGroup ("",-99,-99,1,1) ;close group

GUICtrlCreateTabitem ("") ; end tabitem definition

;

;

;

;

;

GUICtrlCreateTabitem ("Step 2")

GUICtrlCreateGroup ("Choose name",150, 200, 500, 60)

$name = GUICtrlCreateInput ( "", 160, 220, 480, 25)

GUICtrlCreateGroup ("",-99,-99,1,1) ;close group

GUICtrlCreateGroup ("Choose application and set silent keys",150, 270, 500, 60)

; group start

$edit2 = GUICtrlCreateEdit ( "", 160, 290, 290, 25, $ES_LEFT + $ES_AUTOHSCROLL)

GUICtrlSetFont ($edit2, 10, -1, -1, $font2)

$edit3 = GUICtrlCreateEdit ( "", 460, 290, 80, 25, $ES_LEFT + $ES_AUTOHSCROLL)

GUICtrlSetFont ($edit3, 10, -1, -1, $font2)

$browse2 = GUICtrlCreateButton ( "Browse", 550, 290, 90, 25, $BS_VCENTER)

; group end

GUICtrlCreateGroup ("",-99,-99,1,1) ;close group

;pakeist

GUICtrlCreateGroup ("Additional DOS commands",150, 340, 500, 200)

$additional1 = GUICtrlCreateEdit ( "", 160, 360, 380, 25, $ES_LEFT)

GUICtrlSetFont ($additional1, 10, -1, -1, $font2)

$additional2 = GUICtrlCreateEdit ( "", 160, 395, 380, 25, $ES_LEFT)

GUICtrlSetFont ($additional2, 10, -1, -1, $font2)

$additional3 = GUICtrlCreateEdit ( "", 160, 430, 380, 25, $ES_LEFT)

GUICtrlSetFont ($additional3, 10, -1, -1, $font2)

$additional4 = GUICtrlCreateEdit ( "", 160, 465, 380, 25, $ES_LEFT)

GUICtrlSetFont ($additional4, 10, -1, -1, $font2)

$additional5 = GUICtrlCreateEdit ( "", 160, 500, 380, 25, $ES_LEFT)

GUICtrlSetFont ($additional5, 10, -1, -1, $font2)

;pakeist

GUICtrlCreateGroup ("",-99,-99,1,1) ;close group

$add = GUICtrlCreateButton ( "ADD", 550, 360, 90, 95, $BS_VCENTER )

GUICtrlSetFont ($add, 15, -1, -1, $font)

$cancel = GUICtrlCreateButton ( "Clear", 550, 465, 90, 60, $BS_VCENTER)

GUICtrlCreateTabitem ("") ; end tabitem definition

;

;

;

;

;

GUICtrlCreateTabitem ("Step 3")

GUICtrlCreateGroup ("Review added applications and remove unneeded ones", 150, 200, 500, 335)

$s = 0

$apped = GUICtrlCreateList ( "", 165, 225, 470, 285, $LBS_SORT, $WS_EX_CLIENTEDGE)

GUICtrlSetLimit(-1,200)

$remove = GUICtrlCreateButton ( "Remove", 535, 500, 100, 25, $BS_VCENTER)

$totalapps = GUICtrlCreateLabel ( "Total number of apps:", 165, 500, 150, 25)

GUICtrlSetFont ($totalapps, 10, -1, -1, $font3)

$number = GUICtrlCreateLabel ($s, 310, 500, 200, 50)

GUICtrlSetFont ($number, 15, -1, -1, $font)

GUICtrlCreateGroup ("",-99,-99,1,1) ;close group

GUICtrlCreateTabitem ("") ; end tabitem definition

;

;

;

;

GUICtrlCreateTabitem ("Step 4")

$eee = 0

GUICtrlCreateGroup ("Process Components",140, 200, 520, 60)

$process = GUICtrlCreateButton ( "Process", 160,220 , 100, 25, $BS_VCENTER)

$directory = GUICtrlCreateLabel ( "", 270, 220, 360, 25)

GUICtrlSetFont ($directory, 15, -1, -1, $font2)

$dot = GUICtrlCreateLabel ( "...", 630, 220, 20, 25)

GUICtrlSetFont ($dot, 15, -1, -1, $font2)

GUICtrlCreateTabitem ("") ; end tabitem definition

;

;

;

;

;

;

GUICtrlSetState ($edit2, $GUI_DISABLE)

GUICtrlSetState ($edit3, $GUI_DISABLE)

GUICtrlSetState ($additional1, $GUI_DISABLE)

GUICtrlSetState ($additional2, $GUI_DISABLE)

GUICtrlSetState ($additional3, $GUI_DISABLE)

GUICtrlSetState ($additional4, $GUI_DISABLE)

GUICtrlSetState ($additional5, $GUI_DISABLE)

GUICtrlSetState ($browse2, $GUI_DISABLE)

GUICtrlSetState ($add, $GUI_DISABLE)

GUICtrlSetState ($cancel, $GUI_DISABLE)

GUICtrlSetState ($remove, $GUI_DISABLE)

GUICtrlSetState ($process, $GUI_DISABLE)

GUICtrlSetState ($name, $GUI_DISABLE)

GUICtrlSetState ($apped, $GUI_DISABLE)

GUISetState () ; will display an empty dialog box

While 1

$msg = GUIGetMsg()

If $msg = $browse Then

$windir = FileSelectFolder ( "Choose Windows installation folder", "", 2, @HomeDrive & "\")

GUICtrlSetData ( $edit1, $windir)

If GUICtrlRead ($edit1) <> "" Then

$error = "Error!"

Else

$error = "No directory selected!"

EndIf

$var1 = IniRead($windir & "\I386\PRODSPEC.ini", "Product Specification", "Product", $error)

GUICtrlSetData ( $info1, $var1)

$var2 = IniRead($windir & "\I386\PRODSPEC.ini", "Product Specification", "Version", $error)

GUICtrlSetData ( $info2, $var2)

$var3 = IniRead($windir & "\I386\PRODSPEC.ini", "Product Specification", "Localization", $error)

GUICtrlSetData ( $info3, $var3)

$var4 = IniRead($windir & "\I386\PRODSPEC.ini", "Version", "DriverVer", $error)

GUICtrlSetData ( $info4, $var4)

$var5 = IniRead($windir & "\I386\DRVINDEX.inf", "Version", "CabFiles", $error)

GUICtrlSetData ( $info5, $var5)

$var6 = IniRead($windir & "\I386\BIOSINFO.inf", "Strings", "MSFT", $error)

GUICtrlSetData ( $info6, $var6)

If GUICtrlRead ($info1) = "Error!" And GUICtrlRead ($edit1) <> "" Then

MsgBox(16, "Corrupted installation!", "One or more errors occured. Please check your Windows XP folder!")

EndIf

If $msg = $browse Then

If GUICtrlRead ($info1) <> "Error!" And GUICtrlRead ($info1) <> "No directory selected!" Then

GUICtrlSetState ($edit2, $GUI_ENABLE)

GUICtrlSetState ($edit3, $GUI_ENABLE)

GUICtrlSetState ($additional1, $GUI_ENABLE)

GUICtrlSetState ($additional2, $GUI_ENABLE)

GUICtrlSetState ($additional3, $GUI_ENABLE)

GUICtrlSetState ($additional4, $GUI_ENABLE)

GUICtrlSetState ($additional5, $GUI_ENABLE)

GUICtrlSetState ($browse2, $GUI_ENABLE)

GUICtrlSetState ($add, $GUI_ENABLE)

GUICtrlSetState ($cancel, $GUI_ENABLE)

GUICtrlSetState ($remove, $GUI_ENABLE)

GUICtrlSetState ($process, $GUI_ENABLE)

GUICtrlSetState ($name, $GUI_ENABLE)

GUICtrlSetState ($apped, $GUI_ENABLE)

GUICtrlSetData ( $directory, $windir)

Else

GUICtrlSetState ($edit2, $GUI_DISABLE)

GUICtrlSetState ($edit3, $GUI_DISABLE)

GUICtrlSetState ($additional1, $GUI_DISABLE)

GUICtrlSetState ($additional2, $GUI_DISABLE)

GUICtrlSetState ($additional3, $GUI_DISABLE)

GUICtrlSetState ($additional4, $GUI_DISABLE)

GUICtrlSetState ($additional5, $GUI_DISABLE)

GUICtrlSetState ($browse2, $GUI_DISABLE)

GUICtrlSetState ($add, $GUI_DISABLE)

GUICtrlSetState ($cancel, $GUI_DISABLE)

GUICtrlSetState ($remove, $GUI_DISABLE)

GUICtrlSetState ($process, $GUI_DISABLE)

GUICtrlSetState ($name, $GUI_DISABLE)

GUICtrlSetState ($apped, $GUI_DISABLE)

EndIf

EndIf

EndIf

If $msg = $browse2 Then

$app = FileOpenDialog ( "Select your setup file", @HomeDrive & "\", "All (*.*)")

If $app <> "" Then

GUICtrlSetData ( $edit2, $app)

EndIf

If GUICtrlRead($edit2) = "1" Then

GUICtrlSetData ( $edit2, "")

EndIf

EndIf

If $msg = $add Then

If GUICtrlRead($edit2) <> "" And GUICtrlRead($name) <> "" Then

If GUICtrlRead($edit3) <> "" Then

$old = GUICtrlRead($edit2) & " " & GUICtrlRead($edit3)

$new = StringReplace ( GUICtrlRead($edit2) & " " & GUICtrlRead ($edit3), '"', '/""')

Else

$old = GUICtrlRead($edit2)

$new = StringReplace (GUICtrlRead($edit2), '"', '/""')

EndIf

;

;

;

;

; Here's the damn place

;

;

;

;

$read = GUICtrlRead($eee)

$eee = $eee + 5

If $eee < 10 Then

$skaicius = ("00" & $read)

If $eee < 100 Then

$skaicius = ("0" & $read)

If $eee < 1000 Then

$skaicius = $read

EndIf

EndIf

EndIf

FileWrite ("process.txt", 'REG ADD %KEY%\' & $skaicius & ' /VE /D "' & GUICtrlRead($name) & '" /f' & @CRLF)

;

;

; Autoit suppose to write to process.txt

;

;

;

;

;

$super = 0

For $i=1 to 5

If GUICtrlRead(Eval('additional' & $i)) <> "" Then

$super = $super + 1

EndIf

Next

$s = $s + 1

GUICtrlSetData($apped, '"' & GUICtrlRead($name) & '" ' & "with [" & $super & "] additional task(s) (Link: " & $old & ")|")

GUICtrlSetData ($number, $s)

EndIf

GUICtrlSetData ( $edit2, "")

GUICtrlSetData ( $edit3, "")

GUICtrlSetData ( $additional1, "")

GUICtrlSetData ( $additional2, "")

GUICtrlSetData ( $additional3, "")

GUICtrlSetData ( $additional4, "")

GUICtrlSetData ( $additional5, "")

GUICtrlSetData ( $name, "")

EndIf

If $msg = $cancel Then

GUICtrlSetData ( $edit2, "")

GUICtrlSetData ( $edit3, "")

GUICtrlSetData ( $additional1, "")

GUICtrlSetData ( $additional2, "")

GUICtrlSetData ( $additional3, "")

GUICtrlSetData ( $additional4, "")

GUICtrlSetData ( $additional5, "")

GUICtrlSetData ( $name, "")

EndIf

If $msg = $remove Then

$i_index = _GUICtrlListGetCaretIndex($apped) ;;added

_GUICtrlListDeleteItem($apped, $i_index) ;;added

If $s > 0 Then

$s = $s - 1

EndIf

GUICtrlSetData ( $number, $s)

EndIf

If $msg = $process Then

DirRemove($windir & "\$OEM$", 1)

DirCreate($windir & "\$OEM$")

DirCreate($windir & "\$OEM$\$$")

DirCreate($windir & "\$OEM$\$$\System32")

FileWrite ($windir & "\$OEM$\cmdlines.txt", "RunOnceEx.cmd" & @CRLF)

FileWrite ($windir & "\$OEM$\cmdlines.txt", "rundll32.exe iernonce.dll,RunOnceExProcess")

FileCopy ( "cmdow.exe", $windir & "\$OEM$\$$\System32", 1)

FileWrite ($windir & "\$OEM$\RunOnceEx.cmd", "cmdow @ /HID" & @CRLF)

FileWrite ($windir & "\$OEM$\RunOnceEx.cmd", "@echo off" & @CRLF)

FileWrite ($windir & "\$OEM$\RunOnceEx.cmd", "SET KEY=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx" & @CRLF)

FileWrite ($windir & "\$OEM$\RunOnceEx.cmd", 'REG ADD %KEY% /V TITLE /D "Installing and upgrading the system..." /f' & @CRLF)

EndIf

If $msg = $GUI_EVENT_CLOSE Then

ExitLoop

EndIf

Wend

Edited by Marius

Marius back in da hood! :)

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

I use message box very often to check info and errors so i tried this on your problem

$eee= 0

$name = "process" ;------ gave this a value

$read = GUICtrlRead($eee) ; same as $read = $eee

$eee = $eee + 5

If $eee < 10 Then ;**************** this is true

$skaicius = ("00" & $read)

If $eee < 100 Then ;***************** then this is true

$skaicius = ("0" & $read)

If $eee < 1000 Then ; *************** then again this is true

$skaicius = $read ; final result same value as $eee its 0

EndIf

EndIf

EndIf

******************* you are actually saying

$eee = 0

$read = $eee

$Skaicius = $read

***final result**

$Skaicius = 0

MsgBox(0,"process.txt", 'REG ADD %KEY%\' & $skaicius & ' /VE /D "' & GUICtrlRead($name) & '" /f' & @CRLF) ; see actual info

hope it helps

Edited by Valuater

NEWHeader1.png

Share this post


Link to post
Share on other sites

so. I need to use else if? :)


Marius back in da hood! :)

Share this post


Link to post
Share on other sites

so. I need to use else if? :)

<{POST_SNAPBACK}>

NO

through this process $eee only = 0

??? Elseif WHAT?????


NEWHeader1.png

Share this post


Link to post
Share on other sites

ok. figured out. Thanks Valuater.

Here's what I did:

$eee = $eee + 5

If $eee < 10 Then

$skaicius = ("00" & $eee)

Else

If $eee < 100 Then

$skaicius = ("0" & $eee)

Else

If $eee < 1000 Then

$skaicius = $eee

EndIf

EndIf

EndIf

FileWrite ("process.txt", 'REG ADD %KEY%\' & $skaicius & ' /VE /D "' & GUICtrlRead($name) & '" /f' & @CRLF)


Marius back in da hood! :)

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

now

$eee = 5

$eee is less than 10

less than 100

and

less than 1000

**** thus

Skaicius = 5

your not winning here

8)

************* maybe this?????

$eee = $eee + 5

If $eee < 10 Then

$skaicius = ("00" & $eee)

Else

If $eee > 10 And $eee < 100 Then

$skaicius = ("0" & $eee)

Else

If $eee > 100 And $eee < 1000 Then

$skaicius = $eee

EndIf

EndIf

EndIf

??????

Not sure what you want

8)

Edited by Valuater

NEWHeader1.png

Share this post


Link to post
Share on other sites

ok. Thanks. Now everything works just the way it should work.

New question to crack --> new topic by me. :)


Marius back in da hood! :)

Share this post


Link to post
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
Sign in to follow this  
Followers 0